refactor install

This commit is contained in:
j 2014-08-22 18:38:44 +02:00
parent 148c760daa
commit 06d74f809d

31
install
View file

@ -56,24 +56,31 @@ class Install(Thread):
if sys.platform == 'darwin': if sys.platform == 'darwin':
self.install_launchd() self.install_launchd()
elif sys.platform == 'linux2': elif sys.platform == 'linux2':
apt_packages = ''
yum_packages = ''
try: try:
import Image import Image
import simplejson import simplejson
import lxml import lxml
except: except:
if has_bin('apt-get'): apt_packages += ' python2.7 python-imaging python-simplejson python-lxml'
os.system('sudo apt-get install python2.7 python-imaging python-lxml poppler-utils') yum_packages += ' python-imaging python-simplejson python-lxml'
elif has_bin('yum'):
os.system('sudo yum install python-imaging python-simplejson python-lxml')
else:
print('You need to install PIL and simplejson\ni.e. sudo pip install --allow-external PIL --allow-unverified PIL PIL simplejson lxml')
if not has_bin('pdftocairo'): if not has_bin('pdftocairo'):
if has_bin('apt-get'): apt_packages += ' poppler-utils'
os.system('sudo apt-get install poppler-utils') yum_packages += ' poppler-utils'
elif has_bin('yum'): if not os.path.exists('/usr/sbin/miredo'):
os.system('sudo yum install poppler-utils') apt_packages += ' miredo'
else:
if has_bin('apt-get') and apt_packages:
os.system('sudo apt-get install ' + apt_packages)
elif has_bin('yum') and yum_packages:
os.system('sudo yum install ' + yum_packages)
else:
print('You need to install PIL and simplejson\ni.e. sudo pip install --allow-external PIL --allow-unverified PIL PIL simplejson lxml')
if 'poppler' in apt_packages:
print('You need to install pdftocairo (part of poppler-utils)') print('You need to install pdftocairo (part of poppler-utils)')
if 'miredo' in apt_packages:
print('You need to install miredo (or get IPv6 in another way)')
self.install_application() self.install_application()
self.status['done'] = True self.status['done'] = True
@ -167,7 +174,7 @@ if __name__ == '__main__':
else: else:
target = sys.argv[1] target = sys.argv[1]
if os.path.exists(target): if os.path.exists(target):
print('%s exists, remove before re-installing Open Media Library' % target) print('%s exists, remove it before re-installing Open Media Library' % target)
sys.exit(1) sys.exit(1)
install = Install(target) install = Install(target)
install.join() install.join()