Merge branch 'fix-virtualenv' into 'master'

Prefer pyvenv instead of virtualenv for Python 3.3+

`virtualenv` uses python2 by default on my machine.
Using `pyvenv` (see https://docs.python.org/3/library/venv.html#module-venv) instead of `virtualenv` fixes the problem and let's me perform `python3 setup.py install` in the virtual environment.

See merge request !119
This commit is contained in:
Daniel Martí 2016-04-14 08:04:28 +00:00
commit 1539b67537
2 changed files with 12 additions and 12 deletions

View file

@ -57,22 +57,22 @@ Python's `pip` also works:
sudo pip3 install fdroidserver sudo pip3 install fdroidserver
The combination of `virtualenv` and `pip` is great for testing out the The combination of `pyvenv` and `pip` is great for testing out the
latest versions of `fdroidserver`. Using `pip`, `fdroidserver` can latest versions of `fdroidserver`. Using `pip`, `fdroidserver` can
even be installed straight from git. First, make sure you have even be installed straight from git. First, make sure you have
installed the python header files, virtualenv and pip. They should be installed the python header files, venv and pip. They should be
included in your OS's default package manager or you can install them included in your OS's default package manager or you can install them
via other mechanisms like Brew/dnf/pacman/emerge/Fink/MacPorts. via other mechanisms like Brew/dnf/pacman/emerge/Fink/MacPorts.
For Debian based distributions: For Debian based distributions:
apt-get install python3-dev python3-pip libjpeg-dev zlib1g-dev virtualenv apt-get install python3-dev python3-pip python3-venv libjpeg-dev zlib1g-dev
Then here's how to install: Then here's how to install:
git clone https://gitlab.com/fdroid/fdroidserver.git git clone https://gitlab.com/fdroid/fdroidserver.git
cd fdroidserver cd fdroidserver
virtualenv env/ pyvenv env/
source env/bin/activate source env/bin/activate
pip3 install -e . pip3 install -e .
python3 setup.py install python3 setup.py install

View file

@ -54,11 +54,11 @@ cd $WORKSPACE
python3 setup.py sdist python3 setup.py sdist
rm -rf $WORKSPACE/env rm -rf $WORKSPACE/env
virtualenv --python=python3 $WORKSPACE/env pyvenv $WORKSPACE/env
. $WORKSPACE/env/bin/activate . $WORKSPACE/env/bin/activate
pip install dist/fdroidserver-*.tar.gz pip3 install dist/fdroidserver-*.tar.gz
# run tests in new pip+virtualenv install # run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
@ -66,12 +66,12 @@ fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
# test install using install direct from git repo # test install using install direct from git repo
cd $WORKSPACE cd $WORKSPACE
rm -rf $WORKSPACE/env rm -rf $WORKSPACE/env
virtualenv --python=python3 --system-site-packages $WORKSPACE/env pyvenv --system-site-packages $WORKSPACE/env
. $WORKSPACE/env/bin/activate . $WORKSPACE/env/bin/activate
pip install -e $WORKSPACE pip3 install -e $WORKSPACE
python3 setup.py install python3 setup.py install
# run tests in new pip+virtualenv install # run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
@ -85,14 +85,14 @@ sh hooks/pre-commit
cd $WORKSPACE cd $WORKSPACE
set +e set +e
# use the virtualenv python so pylint checks against its installed libs # use the pyvenv so pylint checks against its installed libs
PYTHONPATH=$WORKSPACE/.pylint-plugins python3 /usr/bin/pylint \ PYTHONPATH=$WORKSPACE/.pylint-plugins python3 /usr/bin/pylint \
--output-format=parseable --reports=n \ --output-format=parseable --reports=n \
--load-plugins astng_hashlib \ --load-plugins astng_hashlib \
fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable
# to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these: # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these:
# running pylint in the virtualenv is causing this FATAL error, which is a bug: # running pylint in the pyvenv/virtualenv is causing this FATAL error, which is a bug:
# https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import # https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import
[ $(($? & 1)) = "1" ] && echo "FATALs found" [ $(($? & 1)) = "1" ] && echo "FATALs found"
[ $(($? & 2)) = "2" ] && exit 2 [ $(($? & 2)) = "2" ] && exit 2