fail early

This commit is contained in:
j 2016-01-07 15:39:57 +05:30
parent 8eba8e41e5
commit c33f580edf

48
install
View file

@ -27,28 +27,6 @@ class Install(Thread):
self.start()
def run(self):
target = self.target
target = os.path.normpath(os.path.join(os.path.abspath(target)))
if not os.path.exists(target):
os.makedirs(target)
os.chdir(target)
release = self.get_release()
self.status['release'] = release
for module in release['modules']:
self.status['installing'] = module
self.status['progress'] = 0
self.status['size'] = 0
package_tar = release['modules'][module]['name']
url = self.url(package_tar)
package_tar = os.path.join(self.target, package_tar)
self.download(url, package_tar)
tar = tarfile.open(package_tar)
tar.extractall()
tar.close()
os.unlink(package_tar)
os.symlink('openmedialibrary/ctl', 'ctl')
self.status['progress'] = 0
self.status['installing'] = 'setup'
if sys.platform.startswith('linux'):
apt_packages = ''
dnf_packages = ''
@ -95,6 +73,30 @@ class Install(Thread):
if 'poppler' in apt_packages:
print('You need to install pdftocairo (part of poppler-utils)')
input("After installing those packages, press Enter to continue...")
sys.exit(1)
target = self.target
target = os.path.normpath(os.path.join(os.path.abspath(target)))
if not os.path.exists(target):
os.makedirs(target)
os.chdir(target)
release = self.get_release()
self.status['release'] = release
for module in release['modules']:
self.status['installing'] = module
self.status['progress'] = 0
self.status['size'] = 0
package_tar = release['modules'][module]['name']
url = self.url(package_tar)
package_tar = os.path.join(self.target, package_tar)
self.download(url, package_tar)
tar = tarfile.open(package_tar)
tar.extractall()
tar.close()
os.unlink(package_tar)
os.symlink('openmedialibrary/ctl', 'ctl')
self.status['progress'] = 0
self.status['installing'] = 'setup'
if sys.platform.startswith('linux'):
os.system('./ctl install_launcher')
os.system('./ctl setup')
self.status['progress'] = 1
@ -154,7 +156,7 @@ if __name__ == '__main__':
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\n\tsudo pip3 install pyOpenSSL")
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)