From d4f26df196a8aec9a985f5fbdd2b98a90a59aeea Mon Sep 17 00:00:00 2001 From: j Date: Sat, 6 Feb 2016 16:23:24 +0530 Subject: [PATCH] only install packages for platform --- Open Media Library/Resources/install.py | 31 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/Open Media Library/Resources/install.py b/Open Media Library/Resources/install.py index 1d5b7cc..57926c5 100755 --- a/Open Media Library/Resources/install.py +++ b/Open Media Library/Resources/install.py @@ -20,6 +20,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 Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_OPTIONS(self): self.send_response(200, 'OK') @@ -79,17 +91,20 @@ class Install(Thread): release = self.get_release() self.status["release"] = release self.status["progress"] = 0 + platform = get_platform() for module in sorted(release['modules']): - package_tar = release['modules'][module]['name'] - url = self.release_url.replace('release.json', package_tar) - self.download(url, package_tar) + if release['modules'][module].get('platform', platform) == platform: + package_tar = release['modules'][module]['name'] + url = self.release_url.replace('release.json', package_tar) + self.download(url, package_tar) self.status["step"] = 'Installing...' for module in sorted(release['modules']): - package_tar = release['modules'][module]['name'] - tar = tarfile.open(package_tar) - tar.extractall() - tar.close() - os.unlink(package_tar) + if release['modules'][module].get('platform', platform) == platform: + package_tar = release['modules'][module]['name'] + tar = tarfile.open(package_tar) + tar.extractall() + tar.close() + os.unlink(package_tar) os.symlink('openmedialibrary/ctl', 'ctl') makedirs('data') with open('data/release.json', 'w') as fd: