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

Don't raise ImportError on non-linux platforms #202

Merged
merged 1 commit into from
Dec 24, 2017
Merged

Don't raise ImportError on non-linux platforms #202

merged 1 commit into from
Dec 24, 2017

Conversation

asottile
Copy link
Contributor

@asottile asottile commented Dec 4, 2017

In order to be able to use distro in cross-platform programs without duplicated import guards, distro shouldn't raise on import.

For what it's worth, after this patch distro acts mostly in the same way as platform.linux_distribution on non-linux platforms:

>>> platform.linux_distribution()
('', '', '')
>>> distro.id(), distro.version(), distro.codename()
('', '', '')

@asottile
Copy link
Contributor Author

asottile commented Dec 4, 2017

This will fix my patch here on non-linux platforms: asottile-archive/pip-custom-platform#15

@nir0s
Copy link
Collaborator

nir0s commented Dec 24, 2017

The reason this was added is partly because platform.linux_distribution returns empty when it doesn't know how to identify the distro it's running on. In a Windows/Darwin case, it's not that we can't identify it, it's just that it's not supposed to.

@asottile
Copy link
Contributor Author

I think that's fine, at the very least it's the status quo for the platform module.

This patch makes using distro in a cross platform way much easier and definitely makes migrating from old platform-based code dead simple.

@nir0s
Copy link
Collaborator

nir0s commented Dec 24, 2017

@asottile btw, it would be awesome to get your feedback on https://github.com/cloudify-cosmo/wagon.

@asottile
Copy link
Contributor Author

@nir0s looks pretty neat! Seems to be trying to solve the same problems as pip-custom-platform too.

I'd be curious to see the full workflow of how wagon gets used -- for pip-custom-platform it's largely:

  • build wheels for all supported platform combinations for all supported packages
  • place those wheels on an internal pypi server
  • s/pip/pip-custom-platform/g in installation scripts

@nir0s nir0s merged commit 25aa3f8 into python-distro:master Dec 24, 2017
@asottile asottile deleted the remove_import_error branch July 17, 2018 22:31
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.

2 participants