Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MODULE_DISTROI.lsb_release_info())
self.assertEqual(distro.distro_release_info(),
MODULE_DISTROI.distro_release_info())
os_release_keys = [
'name',
'version',
'id',
'id_like',
'pretty_name',
'version_id',
'codename',
]
for key in os_release_keys:
self.assertEqual(distro.os_release_attr(key),
MODULE_DISTROI.os_release_attr(key))
lsb_release_keys = [
'distributor_id',
'description',
'release',
'codename',
]
for key in lsb_release_keys:
self.assertEqual(distro.lsb_release_attr(key),
MODULE_DISTROI.lsb_release_attr(key))
distro_release_keys = [
'id',
'name',
'version_id',
('python2-pyaudio',
'python-pyaudio')),
'gentoo': (
'sudo emerge --ask --verbose',
('pyaudio',
'pyaudio')),
'suse': (
'sudo zypper install',
('python-PyAudio',
'python3-PyAudio')),
'debian': (
'sudo apt-get install',
('python-pyaudio',
'python3-pyaudio'))}
distroid = distro.os_release_attr('id_like')
for distribution, command in pm.items():
base_command, packages_names = command
if distribution in distroid:
if len(sys.argv) > 1 and sys.argv[1] == 'py2':
python_version = 0
elif len(sys.argv) > 1 and sys.argv[1] == 'py3':
python_version = 1
else:
print("Usage: python installpyaudio.py (py2/py3)")
sys.exit(1)
install_command = "{} {}".format(
base_command, packages_names[python_version])
elif platform.system().lower() == "darwin":
install_command = 'brew install portaudio'
def get_ansi_color():
"""
Simple wrapper to `distro` to return the distribution preferred ANSI color.
See .
"""
return distro.os_release_attr('ansi_color') or None