From: Frederic Massart Date: Fri, 3 May 2013 04:56:35 +0000 (+0800) Subject: Composer can be downloaded gzipped X-Git-Tag: v0.4~15 X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=23e08483cf3374d88134a449af9f57ef88a89319;p=mdk.git Composer can be downloaded gzipped --- diff --git a/lib/commands/behat.py b/lib/commands/behat.py index 9879ac6..00a8f2a 100644 --- a/lib/commands/behat.py +++ b/lib/commands/behat.py @@ -26,6 +26,7 @@ import os import urllib import re import logging +import gzip from time import sleep from lib.command import Command from lib.tools import process, ProcessInThread @@ -131,7 +132,14 @@ class BehatCommand(Command): logging.info('Installing Composer') cliFile = 'behat_install_composer.php' cliPath = os.path.join(M.get('path'), 'behat_install_composer.php') - urllib.urlretrieve('http://getcomposer.org/installer', cliPath) + (to, headers) = urllib.urlretrieve('http://getcomposer.org/installer', cliPath) + if headers.dict.get('content-encoding') == 'gzip': + f = gzip.open(cliPath, 'r') + content = f.read() + f.close() + f = open(cliPath, 'w') + f.write(content) + f.close() M.cli('/' + cliFile, stdout=None, stderr=None) os.remove(cliPath) M.cli('composer.phar', args='install --dev', stdout=None, stderr=None) diff --git a/lib/commands/phpunit.py b/lib/commands/phpunit.py index 32198a5..51cec73 100644 --- a/lib/commands/phpunit.py +++ b/lib/commands/phpunit.py @@ -24,6 +24,7 @@ http://github.com/FMCorz/mdk import logging import os +import gzip import urllib from lib.command import Command from lib.tools import process @@ -75,7 +76,14 @@ class PhpunitCommand(Command): logging.info('Installing Composer') cliFile = 'phpunit_install_composer.php' cliPath = os.path.join(M.get('path'), 'phpunit_install_composer.php') - urllib.urlretrieve('http://getcomposer.org/installer', cliPath) + (to, headers) = urllib.urlretrieve('http://getcomposer.org/installer', cliPath) + if headers.dict.get('content-encoding') == 'gzip': + f = gzip.open(cliPath, 'r') + content = f.read() + f.close() + f = open(cliPath, 'w') + f.write(content) + f.close() M.cli('/' + cliFile, stdout=None, stderr=None) os.remove(cliPath) M.cli('composer.phar', args='install --dev', stdout=None, stderr=None)