[Common] Replace platform.linux_distribution function
As of python 3.5, this function is marked as deprecated. So, [distro][1] is the one we will use (this package is listed at the example package in the python's [docs][2]). [1] https://pypi.org/project/distro/ [2] https://docs.python.org/3/library/platform.html#platform.dist
This commit is contained in:
parent
1a134cab1b
commit
2296906ed3
|
@ -30,6 +30,10 @@ All modules will require the [common](#common) section dependencies.
|
|||
- [Pillow] - Optional: Support for resizing tracker icons.
|
||||
- [dbus-python] - Optional: Show item location in filemanager.
|
||||
|
||||
#### Linux and BSD
|
||||
|
||||
- [distro] - Optional: OS platform information.
|
||||
|
||||
#### Windows OS
|
||||
|
||||
- [pywin32]
|
||||
|
@ -75,6 +79,7 @@ All modules will require the [common](#common) section dependencies.
|
|||
[pillow]: https://pypi.org/project/Pillow/
|
||||
[libtorrent]: https://libtorrent.org/
|
||||
[zope.interface]: https://pypi.org/project/zope.interface/
|
||||
[distro]: https://github.com/nir0s/distro
|
||||
[pywin32]: https://github.com/mhammond/pywin32
|
||||
[certifi]: https://pypi.org/project/certifi/
|
||||
[py2-ipaddress]: https://pypi.org/project/py2-ipaddress/
|
||||
|
|
|
@ -53,12 +53,17 @@ if platform.system() in ('Windows', 'Microsoft'):
|
|||
|
||||
os.environ['SSL_CERT_FILE'] = where()
|
||||
|
||||
# gi makes dbus available on Window but don't import it as unused.
|
||||
|
||||
if platform.system() not in ('Windows', 'Microsoft', 'Darwin'):
|
||||
# gi makes dbus available on Window but don't import it as unused.
|
||||
try:
|
||||
import dbus
|
||||
except ImportError:
|
||||
dbus = None
|
||||
try:
|
||||
import distro
|
||||
except ImportError:
|
||||
distro = None
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -266,8 +271,8 @@ def get_os_version():
|
|||
elif osx_check():
|
||||
os_version = list(platform.mac_ver())
|
||||
os_version[1] = '' # versioninfo always empty.
|
||||
elif linux_check():
|
||||
os_version = platform.linux_distribution()
|
||||
elif distro:
|
||||
os_version = distro.linux_distribution()
|
||||
else:
|
||||
os_version = (platform.release(),)
|
||||
|
||||
|
|
|
@ -11,3 +11,4 @@ pywin32; sys_platform == 'win32'
|
|||
py2-ipaddress; sys_platform == 'win32' and python_version == '2'
|
||||
certifi; sys_platform == 'win32'
|
||||
zope.interface>=4.4.2
|
||||
distro; 'win' not in sys_platform
|
||||
|
|
Loading…
Reference in New Issue