Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
setup.py: Recommend installation command for pkgs #6575
Conversation
mdboom
added the
needs_review
label
Jun 11, 2016
|
This is still a work in progress, I haven't tested it to my satisfaction - but would love some feedback on the method used as I've never contributed to matplotlib before. |
tacaswell
added this to the
2.1 (next point release)
milestone
Jun 12, 2016
AbdealiJK
referenced
this pull request
Jun 22, 2016
Closed
Recommendation to install packages for various OS #6546
QuLogic
commented on an outdated diff
Jun 23, 2016
| @@ -531,6 +540,38 @@ def do_custom_build(self): | ||
| """ | ||
| pass | ||
| + def install_help_msg(self): | ||
| + """ | ||
| + The help message to show if the package is not installed. The help | ||
| + message shown depends on whether some class variables are present. | ||
| + """ | ||
| + def _try_managers(*managers): | ||
| + for manager in managers: | ||
| + pkg_name = self.pkg_names.get(manager, None) | ||
| + if pkg_name: | ||
| + try: | ||
| + _ = check_output(["which", manager], |
QuLogic
Member
|
QuLogic
commented on the diff
Jun 23, 2016
| + return ('Try installing {0} with `{1} install {2}`' | ||
| + .format(self.name, manager, pkg_name)) | ||
| + except subprocess.CalledProcessError: | ||
| + pass | ||
| + | ||
| + message = None | ||
| + if sys.platform == "win32": | ||
| + url = self.pkg_names.get("windows_url", None) | ||
| + if url: | ||
| + message = ('Please check {0} for instructions to install {1}' | ||
| + .format(url, self.name)) | ||
| + elif sys.platform == "darwin": | ||
| + message = _try_managers("brew", "port") | ||
| + elif sys.platform.startswith("linux"): | ||
| + release = platform.linux_distribution()[0].lower() | ||
| + if release in ('debian', 'ubuntu'): |
AbdealiJK
Contributor
|
QuLogic
commented on an outdated diff
Jun 23, 2016
| + | ||
| + message = None | ||
| + if sys.platform == "win32": | ||
| + url = self.pkg_names.get("windows_url", None) | ||
| + if url: | ||
| + message = ('Please check {0} for instructions to install {1}' | ||
| + .format(url, self.name)) | ||
| + elif sys.platform == "darwin": | ||
| + message = _try_managers("brew", "port") | ||
| + elif sys.platform.startswith("linux"): | ||
| + release = platform.linux_distribution()[0].lower() | ||
| + if release in ('debian', 'ubuntu'): | ||
| + message = _try_managers('apt-get') | ||
| + elif release in ('centos', 'redhat', 'fedora'): | ||
| + message = _try_managers('dnf', 'yum') | ||
| + return message | ||
|
|
AbdealiJK
commented on the diff
Jun 23, 2016
| + stderr=subprocess.STDOUT) | ||
| + return ('Try installing {0} with `{1} install {2}`' | ||
| + .format(self.name, manager, pkg_name)) | ||
| + except subprocess.CalledProcessError: | ||
| + pass | ||
| + | ||
| + message = None | ||
| + if sys.platform == "win32": | ||
| + url = self.pkg_names.get("windows_url", None) | ||
| + if url: | ||
| + message = ('Please check {0} for instructions to install {1}' | ||
| + .format(url, self.name)) | ||
| + elif sys.platform == "darwin": | ||
| + message = _try_managers("brew", "port") | ||
| + elif sys.platform.startswith("linux"): | ||
| + release = platform.linux_distribution()[0].lower() |
AbdealiJK
Contributor
|
|
Bump - reminder for review of this PR |
tacaswell
and 1 other
commented on an outdated diff
Jul 12, 2016
| @@ -531,6 +540,41 @@ def do_custom_build(self): | ||
| """ | ||
| pass | ||
| + def install_help_msg(self): | ||
| + """ | ||
| + The help message to show if the package is not installed. The help | ||
| + message shown depends on whether some class variables are present. |
tacaswell
Owner
|
|
|
|
@tacaswell Do you recommend we use |
|
It will only be seen if things go wrong anyway Given the amount of sound and fury in the upstream bug, I am inclined to let this shake it self out a bit more before jumping on a solution. On the other hand, better to deal with it now than later (when we have forgotten). |
|
Maybe we could merge the PR but keep the issue open or create a new tracking issue to keep track of it ? |
AbdealiJK commentedJun 11, 2016
If a package is not found, provide a better error message
that also explains how to install the package or gives the
user a link explaining what to do to install the package.
The supported methods are:
(For example: apt-get for Ubuntu/Debian, dnf and yum for
Fedora/CentOS/RHEL, brew and port for OSX)
Fixes #6546