You are viewing a plain text version of this content. The canonical link for it is here.
Posted to builds@apache.org by "Dave Brondsema (JIRA)" <ji...@apache.org> on 2015/08/25 03:26:46 UTC

[jira] [Comment Edited] (BUILDS-113) Install Python dependencies on Jenkins machines

    [ https://issues.apache.org/jira/browse/BUILDS-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14710410#comment-14710410 ] 

Dave Brondsema edited comment on BUILDS-113 at 8/25/15 1:26 AM:
----------------------------------------------------------------

You can use a python virtualenv in your build to install those yourself.  Here's what we do for https://builds.apache.org/job/Allura/ which is a python app.  It bootstraps by downloading virtualenv directly.  This perhaps can be done more elegantly.  Or at least a more recent version of virtualenv.  But it works.  "requirements.txt" lists the python packages we install.

{noformat}
#!/bin/bash
rm -rf ".allura-venv"
if [ ! -d ".allura-venv" ]; then
    if [ ! -f virtualenv-*/virtualenv.py ]; then
        wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz || exit
        tar xvfz virtualenv-*.tar.gz
    fi
    python virtualenv-*/virtualenv.py .allura-venv
fi

. .allura-venv/bin/activate

# retry a few times
MAIN_PIP="pip install -r requirements.txt --download-cache=/tmp/python-pip-cache"
$MAIN_PIP || (echo "retrying pip install after short sleep"; sleep 10; $MAIN_PIP) || (echo "retrying pip install after short sleep"; sleep 10; $MAIN_PIP) || exit
{noformat}



was (Author: brondsem):
You can use a python virtualenv in your build to install those yourself.  Here's what we do for https://builds.apache.org/job/Allura/ which is a python app.  It bootstraps by downloading virtualenv directly.  This perhaps can be done more elegantly.  Or at least a more recent version of virtualenv.  But it works.  "requirements.txt" lists the python packages we install.

#!/bin/bash
rm -rf ".allura-venv"
if [ ! -d ".allura-venv" ]; then
    if [ ! -f virtualenv-*/virtualenv.py ]; then
        wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz || exit
        tar xvfz virtualenv-*.tar.gz
    fi
    python virtualenv-*/virtualenv.py .allura-venv
fi

. .allura-venv/bin/activate

# retry a few times
MAIN_PIP="pip install -r requirements.txt --download-cache=/tmp/python-pip-cache"
$MAIN_PIP || (echo "retrying pip install after short sleep"; sleep 10; $MAIN_PIP) || (echo "retrying pip install after short sleep"; sleep 10; $MAIN_PIP) || exit



> Install Python dependencies on Jenkins machines
> -----------------------------------------------
>
>                 Key: BUILDS-113
>                 URL: https://issues.apache.org/jira/browse/BUILDS-113
>             Project: Infra Build Platform
>          Issue Type: Task
>            Reporter: Akila
>
> Hi,
> I need Python and  some pip packages on Jenkins machines in order to run integration tests for Apache Stratos project. Following is a script that we use to install those on Ubuntu.
> sudo apt-get install -y git python python-pip python-dev gcc zip
> sudo pip install paho-mqtt
> sudo pip install psutil
> sudo pip install pexpect
> sudo pip install pycrypto
> sudo pip install gitpython
> sudo pip install yapsy
> Would you be able to install the above packages?
> Thanks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)