only install packages for platform

This commit is contained in:
j 2016-02-06 16:23:24 +05:30
parent 639a0bcd24
commit d4f26df196

View file

@ -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,12 +91,15 @@ class Install(Thread):
release = self.get_release()
self.status["release"] = release
self.status["progress"] = 0
platform = get_platform()
for module in sorted(release['modules']):
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']):
if release['modules'][module].get('platform', platform) == platform:
package_tar = release['modules'][module]['name']
tar = tarfile.open(package_tar)
tar.extractall()