From 7e63150c6e59a45b5a60178e468e553e5c598a12 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 7 Jan 2016 17:12:00 +0530 Subject: [PATCH] move linux checks to one place --- install | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/install b/install index 90e1909..9042f45 100755 --- a/install +++ b/install @@ -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()