Repository: streamlink/streamlink

Issue:
No man page with pip install
### Checklist

- [ ] This is a bug report.
- [x] This is a feature request.
- [ ] This is a plugin (improvement) request.
- [x] I have read the contribution guidelines.

### Description

When installing streamlink with pip, no man page gets installed

### Expected / Actual behavior

a man page gets installed during installation of streamlink with pip

### Reproduction steps / Explicit stream URLs to test

1. ``pip install --user streamlink``
2. ``man streamlink``
3. ``No manual entry for streamlink``
4. I get the same results when using ``pip install streamlink``

### Logs

```
[cli][debug] OS:         Linux-4.13.0-43-generic-x86_64-with-Ubuntu-17.10-artful
[cli][debug] Python:     3.6.3
[cli][debug] Streamlink: 0.12.1
[cli][debug] Requests(2.18.4), Socks(1.6.7), Websocket(0.47.0)
usage: streamlink [OPTIONS] <URL> [STREAM]

```


Discussion:
I wouldn't so much call this a bug as a feature request... `pip` packages typically do not install man pages. `pip` doesn't really support it, you can include pre-built man pages, but we would want to generate it at install time. There are 3rd party script that you can use, but they need to be available when you install the package, so must be included. 

I tried to do it with `argparse-manpage`, and it doesn't quite work - it could probably be made to work correctly though.
Is it even pip's job to create man pages? If you're using the `--user` parameter, there's no way for pip to install man pages in the `manpath`, as those man paths are usually configured only system-wide and are user independent. And even if pip is used for globally installing packages (which is bad and will result in file conflicts sooner or later), it is not its job to write files in one of the system man paths.
I'd say that the proper distro packages need to be installed for having man pages.
I imagine most distros would _require_ a man page to be accepted, and that's definitely something that should be handled by the package maintainer. 

If `pip` did install man pages, they would not work for `--user` (as @bastimeyer said), without updating `$PATH`. System-wide and virtualenv installs would work though. 

We could use sphinx to build the man page and include that in the sdist/wheel - actually might be a nice addition (when it works), and it's relatively simple to do :) 
I'm not familiar with any Python packages which install man pages via pip and would actually be against it due to packaging standards and this being unexpected behavior. Man pages should be handled by distro packages and have specific requirements based on the distro (take the debian docs for example: https://www.debian.org/doc/debian-policy/#manual-pages).

There has also been discussion on this previously [here](https://github.com/pypa/packaging-problems/issues/72) by members of the pypa team. I don't really think this can of worms is worth opening. How would we handle conflicts where a user installs the package, then installs the pip version? There would be a conflict in management there which could negatively impact the user's system. In addition we provide online documentation and the `--help` option is quite extensive and follows the standards expected for a Python project.
updated this issue to feature request.

just a little FYI, youtube-dl does come with a man page when installed with pip, even when used ``--user``
you can use `streamlink --help` which will get you all commands.

If you need more stuff just use the website https://streamlink.github.io/cli.html

The man page is not really important enough, to get packed with `pip`.
Had another look at it and it should be fairly trivial to add a manpage to the wheels. Let's reopen...

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,7 @@
 import versioneer
 
 
+data_files = []
 deps = [
     "requests>=2.21.0,<3.0",
     "isodate",
@@ -63,6 +64,19 @@ def is_wheel_for_windows():
     entry_points["gui_scripts"] = ["streamlinkw=streamlink_cli.main:main"]
 
 
+additional_files = [
+    ("share/man/man1", ["docs/_build/man/streamlink.1"])
+]
+
+for destdir, srcfiles in additional_files:
+    files = []
+    for srcfile in srcfiles:
+        if path.exists(srcfile):
+            files.append(srcfile)
+    if files:
+        data_files.append((destdir, files))
+
+
 setup(name="streamlink",
       version=versioneer.get_version(),
       cmdclass=versioneer.get_cmdclass(),
@@ -85,6 +99,7 @@ def is_wheel_for_windows():
       packages=find_packages("src"),
       package_dir={"": "src"},
       entry_points=entry_points,
+      data_files=data_files,
       install_requires=deps,
       test_suite="tests",
       python_requires=">=3.6, <4",


Test patch: