Merge pull request #16 from whimboo/virtualenv

Update virtualenv to v1.7, fixes issue #15
This commit is contained in:
Henrik Skupin 2012-02-15 06:15:25 -08:00
Родитель 1686862743 8d63d97c04
Коммит 7ebce4afb7
3 изменённых файлов: 34 добавлений и 30 удалений

Просмотреть файл

@ -1,15 +1,15 @@
#!/usr/bin/env bash
MOZMILL_VERSION=$1
VERSION_MOZMILL=$1
MERCURIAL_VERSION=2.1
PYTHON_VERSION=$(python -c "import sys;print sys.version[:3]")
VIRTUALENV_VERSION=1.5.2
VERSION_MERCURIAL=2.1
VERSION_PYTHON=$(python -c "import sys;print sys.version[:3]")
VERSION_VIRTUALENV=1.7
ENV_DIR=mozmill-env
TARGET_ARCHIVE=$(dirname $(pwd))/$MOZMILL_VERSION-$(basename $(pwd)).zip
TARGET_ARCHIVE=$(dirname $(pwd))/$VERSION_MOZMILL-$(basename $(pwd)).zip
VIRTUALENV_URL=https://bitbucket.org/ianb/virtualenv/raw/$VIRTUALENV_VERSION/virtualenv.py
URL_VIRTUALENV=https://raw.github.com/pypa/virtualenv/$VERSION_VIRTUALENV/virtualenv.py
cleanup () {
@ -22,9 +22,9 @@ if [ ! -n "$1" ] ; then
exit 1
fi
echo "Fetching latest version of virtualenv and creating new environment"
mkdir tmp && curl $VIRTUALENV_URL > tmp/virtualenv.py
python tmp/virtualenv.py --no-site-packages $ENV_DIR
echo "Fetching version $VERSION_VIRTUALENV of virtualenv and creating new environment"
mkdir tmp && curl $URL_VIRTUALENV > tmp/virtualenv.py
python tmp/virtualenv.py $ENV_DIR
echo "Activating the new environment"
source $ENV_DIR/bin/activate
@ -35,23 +35,27 @@ if [ ! -n "${VIRTUAL_ENV:+1}" ]; then
fi
echo "Installing required Python modules"
pip install --upgrade --global-option="--pure" mercurial==$MERCURIAL_VERSION
pip install --upgrade --global-option="--pure" mercurial==$VERSION_MERCURIAL
pip install --upgrade simplejson
echo "Installing Mozmill $MOZMILL_VERSION"
pip install --upgrade mozmill==$MOZMILL_VERSION
echo "Installing Mozmill $VERSION_MOZMILL"
pip install --upgrade mozmill==$VERSION_MOZMILL
echo "Deactivating the environment"
deactivate
echo "Copying template files and reorganizing folder structure"
mv $ENV_DIR/lib/python$PYTHON_VERSION/site-packages/ $ENV_DIR/python-lib
mv $ENV_DIR/lib/python$VERSION_PYTHON/site-packages/ $ENV_DIR/python-lib
FOLDERS="lib/ include/ python-lib/pip* bin/activate* bin/python* bin/easy_install* bin/pip*"
for folder in $FOLDERS ; do
rm -r $ENV_DIR/$folder
done
# Remove the local symlink which gets created and doesn't seem to be necessary.
# See: https://github.com/pypa/virtualenv/issues/118
rm -r $ENV_DIR/local
cp -r templates/* $ENV_DIR
echo "Updating scripts for relocation of the environment"

Просмотреть файл

@ -1,15 +1,15 @@
#!/usr/bin/env bash
MOZMILL_VERSION=$1
VERSION_MOZMILL=$1
MERCURIAL_VERSION=2.1
PYTHON_VERSION=$(python -c "import sys;print sys.version[:3]")
VIRTUALENV_VERSION=1.5.2
VERSION_MERCURIAL=2.1
VERSION_PYTHON=$(python -c "import sys;print sys.version[:3]")
VERSION_VIRTUALENV=1.7
ENV_DIR=mozmill-env
TARGET_ARCHIVE=$(dirname $(pwd))/$MOZMILL_VERSION-$(basename $(pwd)).zip
TARGET_ARCHIVE=$(dirname $(pwd))/$VERSION_MOZMILL-$(basename $(pwd)).zip
VIRTUALENV_URL=https://bitbucket.org/ianb/virtualenv/raw/$VIRTUALENV_VERSION/virtualenv.py
URL_VIRTUALENV=https://raw.github.com/pypa/virtualenv/$VERSION_VIRTUALENV/virtualenv.py
cleanup () {
@ -22,9 +22,9 @@ if [ ! -n "$1" ] ; then
exit 1
fi
echo "Fetching latest version of virtualenv and creating new environment"
mkdir tmp && curl $VIRTUALENV_URL > tmp/virtualenv.py
python tmp/virtualenv.py --no-site-packages $ENV_DIR
echo "Fetching version $VERSION_VIRTUALENV of virtualenv and creating new environment"
mkdir tmp && curl $URL_VIRTUALENV > tmp/virtualenv.py
python tmp/virtualenv.py $ENV_DIR
echo "Activating the new environment"
source $ENV_DIR/bin/activate
@ -35,17 +35,17 @@ if [ ! -n "${VIRTUAL_ENV:+1}" ]; then
fi
echo "Installing required Python modules"
pip install --upgrade --global-option="--pure" mercurial==$MERCURIAL_VERSION
pip install --upgrade --global-option="--pure" mercurial==$VERSION_MERCURIAL
pip install --upgrade simplejson
echo "Installing Mozmill $MOZMILL_VERSION"
pip install --upgrade mozmill==$MOZMILL_VERSION
echo "Installing Mozmill $VERSION_MOZMILL"
pip install --upgrade mozmill==$VERSION_MOZMILL
echo "Deactivating the environment"
deactivate
echo "Copying template files and reorganizing folder structure"
mv $ENV_DIR/lib/python$PYTHON_VERSION/site-packages/ $ENV_DIR/python-lib
mv $ENV_DIR/lib/python$VERSION_PYTHON/site-packages/ $ENV_DIR/python-lib
FOLDERS="lib/ .Python include/ python-lib/pip* bin/activate* bin/python* bin/easy_install* bin/pip*"
for folder in $FOLDERS ; do

Просмотреть файл

@ -14,11 +14,11 @@ import zipfile
VERSION_MERCURIAL = "2.1"
VERSION_MINTTY = "1.0.1"
VERSION_MSYS = "1.0.11"
VERSION_VIRTUALENV = "1.5.2"
VERSION_VIRTUALENV = "1.7"
URL_MSYS = "http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-%(VERSION)s/MSYS-%(VERSION)s.exe/download" % { 'VERSION' : VERSION_MSYS }
URL_MINTTY = "http://mintty.googlecode.com/files/mintty-%s-msys.zip" % VERSION_MINTTY
URL_VIRTUALENV = "https://bitbucket.org/ianb/virtualenv/raw/%s/virtualenv.py" % VERSION_VIRTUALENV
URL_VIRTUALENV = "https://raw.github.com/pypa/virtualenv/%s/virtualenv.py" % VERSION_VIRTUALENV
base_dir = os.path.abspath(os.path.dirname(__file__))
template_dir = os.path.join(base_dir, "templates")
@ -86,10 +86,10 @@ print "Copy Python installation (including pythonXX.dll into environment"
os.system("xcopy /S /I /H %s %s\\python" % (sys.prefix, env_dir))
os.system("xcopy %s\\system32\\python*.dll %s" % (os.environ['WINDIR'], python_dir))
print "Download 'virtualenv' and create new virtual environment"
print "Fetching version %s of virtualenv and creating new environment" % VERSION_VIRTUALENV
virtualenv_path = os.path.join(download_dir, os.path.basename(URL_VIRTUALENV))
download(URL_VIRTUALENV, virtualenv_path)
subprocess.check_call(["python", virtualenv_path, "--no-site-packages", env_dir])
subprocess.check_call(["python", virtualenv_path, env_dir])
print "Reorganizing folder structure"
os.system("move /y %s\\Scripts %s" % (env_dir, python_dir))