|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
| 3 | +# There are 2 distinct pieces that get zipped and cached |
| 4 | +# - The venv site-packages dir including the installed dependencies |
| 5 | +# - The pandas build artifacts, using the build cache support via |
| 6 | +# scripts/use_build_cache.py |
| 7 | +# |
| 8 | +# if the user opted in to use the cache and we're on a whitelisted fork |
| 9 | +# - if the server doesn't hold a cached version of venv/pandas build, |
| 10 | +# do things the slow way, and put the results on the cache server |
| 11 | +# for the next time. |
| 12 | +# - if the cache files are available, instal some necessaries via apt |
| 13 | +# (no compiling needed), then directly goto script and collect 200$. |
| 14 | +# |
| 15 | + |
3 | 16 | echo "inside $0"
|
4 |
| -# Install Dependencies |
| 17 | +# Install Dependencie |
| 18 | +SITE_PKG_DIR=$VIRTUAL_ENV/lib/python$TRAVIS_PYTHON_VERSION/site-packages |
| 19 | +echo "Using SITE_PKG_DIR: $SITE_PKG_DIR" |
5 | 20 |
|
6 | 21 | # workaround for travis ignoring system_site_packages in travis.yml
|
7 | 22 | rm -f $VIRTUAL_ENV/lib/python$TRAVIS_PYTHON_VERSION/no-global-site-packages.txt
|
8 | 23 |
|
9 |
| -# Hard Deps |
10 |
| -pip install $PIP_ARGS --use-mirrors cython nose python-dateutil pytz |
11 |
| - |
12 |
| -# try and get numpy as a binary deb |
| 24 | +if [ x"$LOCALE_OVERRIDE" != x"" ]; then |
| 25 | + # make sure the locale is available |
| 26 | + # probably useless, since you would need to relogin |
| 27 | + sudo locale-gen "$LOCALE_OVERRIDE" |
| 28 | +fi; |
13 | 29 |
|
14 |
| -# numpy is preinstalled on 2.x |
15 |
| -# if [ ${TRAVIS_PYTHON_VERSION} == "2.7" ]; then |
16 |
| -# sudo apt-get $APT_ARGS install python-numpy; |
17 |
| -# fi |
| 30 | +#scipy is not included in the cached venv |
| 31 | +if [ x"$FULL_DEPS" == x"true" ] ; then |
| 32 | + # for pytables gets the lib as well |
| 33 | + sudo apt-get $APT_ARGS install libhdf5-serial-dev; |
18 | 34 |
|
19 |
| -if [ ${TRAVIS_PYTHON_VERSION} == "3.2" ]; then |
20 |
| - sudo apt-get $APT_ARGS install python3-numpy; |
21 |
| -elif [ ${TRAVIS_PYTHON_VERSION} == "3.3" ]; then # should be >=3,3 |
22 |
| - pip $PIP_ARGS install numpy==1.7.0; |
23 |
| -else |
24 |
| - pip $PIP_ARGS install numpy==1.6.1; |
| 35 | + if [ ${TRAVIS_PYTHON_VERSION} == "3.2" ]; then |
| 36 | + sudo apt-get $APT_ARGS install python3-scipy |
| 37 | + elif [ ${TRAVIS_PYTHON_VERSION} == "2.7" ]; then |
| 38 | + sudo apt-get $APT_ARGS install python-scipy |
| 39 | + fi |
25 | 40 | fi
|
26 | 41 |
|
27 |
| -# Optional Deps |
28 |
| -if [ x"$FULL_DEPS" == x"true" ]; then |
29 |
| - echo "Installing FULL_DEPS" |
30 |
| - if [ ${TRAVIS_PYTHON_VERSION} == "2.7" ]; then |
31 |
| - sudo apt-get $APT_ARGS install python-scipy; |
32 |
| - fi |
| 42 | +# Everything installed inside this clause into site-packages |
| 43 | +# will get included in the cached venv downloaded from the net |
| 44 | +# in PTF mode |
| 45 | +if ( ! $VENV_FILE_AVAILABLE ); then |
| 46 | + echo "Running full monty" |
| 47 | + # Hard Deps |
| 48 | + pip install $PIP_ARGS nose python-dateutil pytz |
| 49 | + pip install $PIP_ARGS cython |
33 | 50 |
|
34 |
| - if [ ${TRAVIS_PYTHON_VERSION} == "3.2" ]; then |
35 |
| - sudo apt-get $APT_ARGS install python3-scipy; |
| 51 | + if [ ${TRAVIS_PYTHON_VERSION} == "3.3" ]; then # should be >=3,3 |
| 52 | + pip install $PIP_ARGS numpy==1.7.0 |
| 53 | + elif [ ${TRAVIS_PYTHON_VERSION} == "3.2" ]; then |
| 54 | + # sudo apt-get $APT_ARGS install python3-numpy; # 1.6.2 or precise |
| 55 | + pip install $PIP_ARGS numpy==1.6.1 |
| 56 | + else |
| 57 | + pip install $PIP_ARGS numpy==1.6.1 |
36 | 58 | fi
|
37 | 59 |
|
38 |
| - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then |
39 |
| - sudo apt-get $APT_ARGS install libhdf5-serial-dev; |
40 |
| - pip install numexpr |
41 |
| - pip install tables |
| 60 | + # Optional Deps |
| 61 | + if [ x"$FULL_DEPS" == x"true" ]; then |
| 62 | + echo "Installing FULL_DEPS" |
| 63 | + pip install $PIP_ARGS cython |
| 64 | + |
| 65 | + if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then |
| 66 | + # installed explicitly above, to get the library as well |
| 67 | + # sudo apt-get $APT_ARGS install libhdf5-serial-dev; |
| 68 | + pip install numexpr |
| 69 | + pip install tables |
| 70 | + pip install $PIP_ARGS xlwt |
| 71 | + fi |
| 72 | + |
| 73 | + pip install $PIP_ARGS matplotlib |
| 74 | + pip install $PIP_ARGS openpyxl |
| 75 | + pip install $PIP_ARGS xlrd>=0.9.0 |
| 76 | + pip install $PIP_ARGS 'http://downloads.sourceforge.net/project/pytseries/scikits.timeseries/0.91.3/scikits.timeseries-0.91.3.tar.gz?r=' |
| 77 | + pip install $PIP_ARGS patsy |
| 78 | + |
| 79 | + # fool statsmodels into thinking pandas was already installed |
| 80 | + # so it won't refuse to install itself. We want it in the zipped venv |
| 81 | + |
| 82 | + mkdir $SITE_PKG_DIR/pandas |
| 83 | + touch $SITE_PKG_DIR/pandas/__init__.py |
| 84 | + echo "version='0.10.0-phony'" > $SITE_PKG_DIR/pandas/version.py |
| 85 | + pip install $PIP_ARGS git+git://github.com/statsmodels/statsmodels@c9062e43b8a5f7385537ca95#egg=statsmodels |
| 86 | + |
| 87 | + rm -Rf $SITE_PKG_DIR/pandas # scrub phoney pandas |
42 | 88 | fi
|
43 | 89 |
|
44 |
| - pip install $PIP_ARGS --use-mirrors openpyxl matplotlib; |
45 |
| - pip install $PIP_ARGS --use-mirrors xlrd xlwt; |
46 |
| - pip install $PIP_ARGS 'http://downloads.sourceforge.net/project/pytseries/scikits.timeseries/0.91.3/scikits.timeseries-0.91.3.tar.gz?r=' |
47 |
| -fi |
| 90 | + # pack up the venv and cache it |
| 91 | + if [ x"$STORE_KEY" != x"" ] && $UPLOAD; then |
| 92 | + VENV_FNAME="venv-$TRAVIS_PYTHON_VERSION.zip" |
48 | 93 |
|
49 |
| -if [ x"$VBENCH" == x"true" ]; then |
50 |
| - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then |
51 |
| - sudo apt-get $APT_ARGS install libhdf5-serial-dev; |
52 |
| - pip install numexpr |
53 |
| - pip install tables |
| 94 | + zip $ZIP_FLAGS -r "$HOME/$VENV_FNAME" $SITE_PKG_DIR/ |
| 95 | + ls -l "$HOME/$VENV_FNAME" |
| 96 | + echo "posting venv" |
| 97 | + # silent, don't expose key |
| 98 | + curl -s --form upload=@"$HOME/$VENV_FNAME" "$CACHE_FILE_STORE_URL/$VENV_FNAME" |
54 | 99 | fi
|
55 |
| - pip $PIP_ARGS install sqlalchemy git+git://github.com/pydata/vbench.git; |
56 |
| -fi |
57 | 100 |
|
58 |
| -#build and install pandas |
59 |
| -python setup.py build_ext install |
60 |
| - |
61 |
| -#HACK: pandas is a statsmodels dependency |
62 |
| -# so we need to install it after pandas |
63 |
| -if [ x"$FULL_DEPS" == x"true" ]; then |
64 |
| - pip install patsy |
65 |
| - # pick recent 0.5dev dec/2012 |
66 |
| - pip install git+git://github.com/statsmodels/statsmodels@c9062e43b8a5f7385537ca95#egg=statsmodels |
67 | 101 | fi;
|
68 | 102 |
|
69 |
| -# make sure the desired locale is generated |
70 |
| -if [ x"$LOCALE_OVERRIDE" != x"" ]; then |
71 |
| - # piggyback this build for plotting tests. oh boy. |
72 |
| - pip install $PIP_ARGS --use-mirrors matplotlib; |
| 103 | +#build and install pandas |
| 104 | +if [ x"$BUILD_CACHE_DIR" != x"" ]; then |
| 105 | + scripts/use_build_cache.py -d |
| 106 | + python setup.py install; |
| 107 | +else |
| 108 | + python setup.py build_ext install |
| 109 | +fi |
73 | 110 |
|
74 |
| - sudo locale-gen "$LOCALE_OVERRIDE" |
| 111 | +# package pandas build artifacts and send them home |
| 112 | +# that's everything the build cache (scripts/use_build_cache.py) |
| 113 | +# stored during the build (.so, pyx->.c and 2to3) |
| 114 | +if (! $CACHE_FILE_AVAILABLE) ; then |
| 115 | + echo "Posting artifacts" |
| 116 | + strip "$BUILD_CACHE_DIR/*" &> /dev/null |
| 117 | + echo "$BUILD_CACHE_DIR" |
| 118 | + cd "$BUILD_CACHE_DIR"/ |
| 119 | + zip -r $ZIP_FLAGS "$HOME/$CYTHON_HASH".zip * |
| 120 | + cd "$TRAVIS_BUILD_DIR" |
| 121 | + pwd |
| 122 | + zip "$HOME/$CYTHON_HASH".zip $(find pandas | grep -P '\.(pyx|pxd)$' | sed -r 's/.(pyx|pxd)$/.c/') |
| 123 | + |
| 124 | + # silent, don't expose key |
| 125 | + curl -s --form upload=@"$HOME/$CYTHON_HASH".zip "$CACHE_FILE_STORE_URL/$CYTHON_HASH.zip" |
75 | 126 | fi
|
| 127 | + |
| 128 | +true |
0 commit comments