Skip to content

Commit c4bc0df

Browse files
committed
Extract some .travis.yml bits into scripts
1 parent 0b2d58c commit c4bc0df

File tree

3 files changed

+50
-17
lines changed

3 files changed

+50
-17
lines changed

.travis.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,9 @@ install:
2525
- sudo git pull
2626
- popd
2727

28-
script:
29-
- pushd $HOME
30-
- sudo env PYTHON_BUILD_ROOT=/opt/pyenv/plugins/python-build
31-
/opt/pyenv/plugins/python-build/bin/python-build $VERSION $INSTALL_DEST/$VERSION
32-
- sudo ln -s $INSTALL_DEST/$VERSION $INSTALL_DEST/$ALIAS
33-
- virtualenv --distribute --python=$INSTALL_DEST/$VERSION/bin/python
34-
/home/travis/virtualenv/python$VERSION
35-
- ln -s $HOME/virtualenv/python$VERSION $HOME/virtualenv/python$ALIAS
36-
- $HOME/virtualenv/python$VERSION/bin/pip install --upgrade $PACKAGES
37-
- popd
28+
script: ./build-python
3829

39-
after_success:
40-
- mkdir -p $TRAVIS_BUILD_DIR/$LSB_RELEASE
41-
- tar cjf $TRAVIS_BUILD_DIR/$LSB_RELEASE/python-$ALIAS.tar.bz2
42-
$INSTALL_DEST/$VERSION
43-
$INSTALL_DEST/$ALIAS
44-
$HOME/virtualenv/python$VERSION
45-
$HOME/virtualenv/python$ALIAS
30+
after_success: ./create-archive
4631

4732
after_failure:
4833
- cat /tmp/python-build.*.log

build-python

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
5+
[[ $INSTALL_DEST ]]
6+
[[ $VERSION ]]
7+
8+
sudo env PYTHON_BUILD_ROOT=/opt/pyenv/plugins/python-build \
9+
/opt/pyenv/plugins/python-build/bin/python-build $VERSION $INSTALL_DEST/$VERSION
10+
11+
if [[ $ALIAS ]] ; then
12+
sudo ln -s $INSTALL_DEST/$VERSION $INSTALL_DEST/$ALIAS
13+
fi
14+
15+
virtualenv --distribute --python=$INSTALL_DEST/$VERSION/bin/python \
16+
/home/travis/virtualenv/python$VERSION
17+
18+
if [[ $ALIAS ]] ; then
19+
ln -s $HOME/virtualenv/python$VERSION $HOME/virtualenv/python$ALIAS
20+
fi
21+
22+
if [[ $PACKAGES ]] ; then
23+
$HOME/virtualenv/python$VERSION/bin/pip install --upgrade $PACKAGES
24+
fi

create-archive

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
5+
[[ $LSB_RELEASE ]]
6+
[[ $INSTALL_DEST ]]
7+
[[ $VERSION ]]
8+
9+
: ${TAR_PATHS:=}
10+
: ${DEST:=${1}}
11+
12+
TAR_PATHS="$TAR_PATHS $INSTALL_DEST/$VERSION $HOME/virtualenv/python$VERSION"
13+
14+
if [[ $ALIAS ]] ; then
15+
TAR_PATHS="$TAR_PATHS $INSTALL_DEST/$ALIAS $HOME/virtualenv/python$ALIAS"
16+
DEST="$TRAVIS_BUILD_DIR/$LSB_RELEASE/python-${ALIAS}.tar.bz2"
17+
else
18+
if [[ ! $DEST ]] ; then
19+
DEST="$TRAVIS_BUILD_DIR/$LSB_RELEASE/python-${VERSION}.tar.bz2"
20+
fi
21+
fi
22+
23+
mkdir -p $(dirname $DEST)
24+
exec tar -cjf $DEST $TAR_PATHS

0 commit comments

Comments
 (0)