Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py: Recommend installation command for pkgs #6575

Merged
merged 1 commit into from Jul 12, 2016
Merged

setup.py: Recommend installation command for pkgs #6575

merged 1 commit into from Jul 12, 2016

Conversation

AbdealiLoKo
Copy link
Contributor

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:

  • Provide a link for windows
  • Provide a command using a package manager for the OS
    (For example: apt-get for Ubuntu/Debian, dnf and yum for
    Fedora/CentOS/RHEL, brew and port for OSX)

Fixes #6546

@AbdealiLoKo
Copy link
Contributor Author

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 tacaswell added this to the 2.1 (next point release) milestone Jun 12, 2016
pkg_name = self.pkg_names.get(manager, None)
if pkg_name:
try:
_ = check_output(["which", manager],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a shutil.which, but unfortunately, it's 3.3+. It's probably not worth it to conditionally call it, but can you add a comment about switching to it when we drop 2.7?

@AbdealiLoKo
Copy link
Contributor Author

Bump - reminder for review of this PR

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note to this docstring explaining how to add the feature to sub-classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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:
 - Provide a link for windows
 - Provide a command using a package manager for the OS
   (For example: apt-get for Ubuntu/Debian, dnf and yum for
    Fedora/CentOS/RHEL, brew and port for OSX)
@tacaswell
Copy link
Member

👍 I'll merge this as soon as CI passes again (just to be paranoid).

@AbdealiLoKo
Copy link
Contributor Author

@tacaswell Do you recommend we use distro instead of platform.linux_distribution as users will get a DeprecationWarning when they run this on py3.5 Similar issue: pypa/pip#3823

@tacaswell
Copy link
Member

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).

@AbdealiLoKo
Copy link
Contributor Author

Maybe we could merge the PR but keep the issue open or create a new tracking issue to keep track of it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants