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':
self.install_launchd()
elif sys.platform == 'linux2':
apt_packages = ''
yum_packages = ''
try:
import Image
import simplejson
import lxml
except:
if has_bin('apt-get'):
os.system('sudo apt-get install python2.7 python-imaging python-lxml poppler-utils')
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')
apt_packages += ' python2.7 python-imaging python-simplejson python-lxml'
yum_packages += ' python-imaging python-simplejson python-lxml'
if not has_bin('pdftocairo'):
if has_bin('apt-get'):
os.system('sudo apt-get install poppler-utils')
elif has_bin('yum'):
os.system('sudo yum install poppler-utils')
else:
apt_packages += ' poppler-utils'
yum_packages += ' poppler-utils'
if not os.path.exists('/usr/sbin/miredo'):
apt_packages += ' miredo'
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)')
if 'miredo' in apt_packages:
print('You need to install miredo (or get IPv6 in another way)')
self.install_application()
self.status['done'] = True
@ -167,7 +174,7 @@ if __name__ == '__main__':
else:
target = sys.argv[1]
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)
install = Install(target)
install.join()