move linux checks to one place

This commit is contained in:
j 2016-01-07 17:12:00 +05:30
parent b188f702d6
commit 7e63150c6e
1 changed files with 12 additions and 12 deletions

24
install
View File

@ -29,6 +29,16 @@ class Install(Thread):
def run(self):
if sys.platform.startswith('linux'):
import platform
distro = platform.linux_distribution()
if distro[0] == 'Ubuntu' and distro[1] < '14.10':
try:
from OpenSSL.SSL import TLSv1_2_METHOD
except:
print("Open Media Library currently only works on Ubuntu 14.10 and later")
print("You can also install a current version of pyOpenSSL:\n\tsudo apt-get install python3-pip python3-dev libffi-dev\n\tsudo pip3 install pyOpenSSL")
self.failed = True
return
apt_packages = ''
dnf_packages = ''
try:
@ -65,12 +75,12 @@ class Install(Thread):
if has_bin('apt-get') and apt_packages:
print('You need additional packages: %s' % apt_packages)
print('sudo apt-get install -y ' + apt_packages)
print('run: sudo apt-get install -y ' + apt_packages)
self.failed = True
return
elif has_bin('dnf') and dnf_packages:
print('Installing additional packages: %s' % dnf_packages)
print('sudo dnf install -y ' + dnf_packages)
print('run: sudo dnf install -y ' + dnf_packages)
self.failed = True
return
elif apt_packages:
@ -154,16 +164,6 @@ if __name__ == '__main__':
print('%s exists, remove it before re-installing Open Media Library' % target)
sys.exit(1)
if sys.platform.startswith('linux'):
import platform
distro = platform.linux_distribution()
if distro[0] == 'Ubuntu' and distro[1] < '14.10':
try:
from OpenSSL.SSL import TLSv1_2_METHOD
except:
print("Open Media Library currently only works on Ubuntu 14.10 and later")
print("You can also install a current version of pyOpenSSL:\n\tsudo apt-get install python3-pip python3-dev libffi-dev\n\tsudo pip3 install pyOpenSSL")
sys.exit(1)
install = Install(target)
install.join()