-
Notifications
You must be signed in to change notification settings - Fork 64
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
Work for v2 (Windows+Mac OS support, Linux inconsistencies) #185
Conversation
This is a wonderful effort and I like the implementation. It's very clean. Thank you. Several comments.
@xavfernandez @andy-maier @MartijnBraam @funkyfuture. Would love your input here. |
Sure thing, I'll break this whole effort into two requests. :) Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a few superficial remarks. you may ping me when the code has been merged into one module again,
though imo it's close to being too long for one module (which is at this point rather a matter of gusto and not yet hard to maintain), but essentially agree with @nir0s points.
|
||
""" | ||
The ``distro`` package (``distro`` stands for Linux Distribution) provides | ||
information about the Linux distribution it runs on, such as a reliable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that'd need to be adjusted.
""" | ||
return _distro.info(pretty, best) | ||
|
||
if platform.system() == 'Linux': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imports should be on the top of the module and be absolute. older Python versions have from __future__ import absolute_imports
available.
elif platform.system() == 'Mac OS': | ||
from ._mac_os import get_distribution | ||
else: | ||
from ._distribution import EmptyDistribution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather UnknownDistribution
or Unidentified…
?
@funkyfuture I've split this into another PR #186 for just Linux. I'm keeping this PR here mostly for the check boxes. Thank you for your review! :) |
I'd still like to get these changes merged. Is this still on the table? |
I'd also like to see this - particularly macOS. |
Any reason this was closed? |
My pull requests for this project have dwelled too long. Anyone is welcome to finish the work out if they'd like. I left the branch un-deleted. |
Been doing a little work for v2 in my own branch. If anything else needs to be added I'll add it to the checklist. Here's what I have so far:
Checklist
python -m distro
orpython -m distro -j
but since we're incrementing a major version and this feature isn't used by our most important upstream pip this is probably fine?LinuxDistribution
object to inherit from a new objectDistribution
which is the base for all distribution info objects.get_distribution()
which gets theDistribution
object for the current OS platform. This is where sub-classes ofLinuxDistribution
are created if there is an inconsistency between one of the *-release sources (such asLinuxMintDistribution
.)ImportError
is raised if not on Windows, Linux, or Mac OS platforms.MacOSDistribution
needs to be completely finished and needs testing. I don't have my own Mac OS to get real values for this but I'm sure most of the values can be guessed after seeing a few real values ofplatform.mac_ver()
.CloudLinuxDistribution
needs to be created to deal with inconsistencies for Cloud Linux once Add test cases for CloudLinux 5, 6, and 7 #180 has been merged.DebianDistribution
for when debian doesn't use parens for it's codename in "stretch/sid".EmptyDistribution
object to return whendistro.linux_distribution()
is called on a non-Linux platform.Questions to Resolve
distro.linux_distribution()
on a non-Linux platform emit a warning?distro.windows_distribution()
anddistro.mac_distribution
? I'm in favor of saying "No" to this to encourage users to usedistro.distribution()
and only keepingdistro.linux_distribution()
for legacy reasons.ImportError
if we're on a system we don't recognize or should we just return anEmptyDistribution
object for unknown platforms?References
#177 #178 #180 #184
cc: @nir0s