Conditional Requirements In Setup.py
Solution 1:
You probably want to use the platform module to try to identify the system details.
Best bet is to try and use a combo of platform.architecture()
, platform.platform()
, and platform.system()
with proper error handling and consideration of all possible return info.
Example:
I am running on Win10, here are the outputs of those functions (and one more):
>>> import platform
>>> print(platform.architecture())
('32bit', 'WindowsPE')
>>> print(platform.platform())
Windows-10-10.0.17134-SP0
>>> print(platform.processor())
Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
>>> print(platform.system())
Windows
Edit
The above answer does not necessarily return the info that you want (I left out mention of any deprecated functions from the platform module).
Digging a little deeper, yields this SO result which explains that the built-in platform functions for gathering distro names are deprecated.
The official docs point in the direction of a PyPi package called distro. The distro docs on PyPi acknowledge the need for this type of info and an example usage found there looks like this:
>>> import distro
>>> distro.linux_distribution(full_distribution_name=False)
('centos', '7.1.1503', 'Core')
Post a Comment for "Conditional Requirements In Setup.py"