limit to platform in install

This commit is contained in:
j 2016-01-31 19:02:29 +05:30
parent fe9e2c65bc
commit 2c61fcc111

36
install
View file

@ -14,6 +14,18 @@ def makedirs(dirname):
if not os.path.exists(dirname):
os.makedirs(dirname)
def get_platform():
name = sys.platform
if name.startswith('darwin'):
name = 'darwin64'
elif name.startswith('linux'):
import platform
if platform.architecture()[0] == '64bit':
name = 'linux64'
else:
name = 'linux32'
return name
class Install(Thread):
base_url = 'http://downloads.openmedialibrary.com/'
@ -98,18 +110,20 @@ class Install(Thread):
release = self.get_release()
self.status['release'] = release
print("Installing Open Media Library:")
platform = get_platform()
for module in sorted(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(target, package_tar)
self.download(url, package_tar)
tar = tarfile.open(package_tar)
tar.extractall()
tar.close()
os.unlink(package_tar)
if release['modules'][module].get('platform', platform) == platform:
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(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'