Commit b9cc1a45 authored by André Anjos's avatar André Anjos 💬

[bootstrap] Updated buildout bootstrap script

parent 63b47b13
language: python
matrix:
include:
- python: 2.6
- python: 2.7
env:
- secure: QCFbUk130GqYGWYVTzjFWIIbZKPHyjgK6V/kNo7iAdvZzCHLAZIPW9FQKkg8JGqPU8TWVVbZ++u1ATAXE4kiC7SXEUxMoxlOpR+L4z/zJWVgeNA1pS8JJh8hm9CXW5FbcFXt8ewLjsL7IrYPK+VgrvWLytks+Z9JL12YL2MupdA=
- secure: FaGAPqroDqoWDIoiia1fSxm1/Oo2QPca2WZYTsADHxe5Iir5gBkxCTwREEo6fPedVZPaTLBxOodis7K8KrJ9UTInGRW0NvlAgYVpCFzMm5v2NLCUyDtVcZ00HNqUUyE2YjgWrWxS6M7CNdlOi4gvrf85SIjSYwBlbQrX2bVSpGw=
- BOB_DOCUMENTATION_SERVER=https://www.idiap.ch/software/bob/docs/latest/bioidiap/%s/master
- python: 3.2
env:
- NUMPYSPEC===1.8.0
- python: 3.3
env:
- NUMPYSPEC===1.8.0
before_install:
- sudo add-apt-repository -y ppa:biometrics/bob
- sudo apt-get update -qq
- sudo apt-get install -qq --force-yes libboost-all-dev libblitz1-dev libjpeg8-dev libnetpbm10-dev libpng12-dev libtiff4-dev libgif-dev libhdf5-serial-dev libgif-dev libmatio-dev
- sudo apt-get install -qq --force-yes libatlas-dev libatlas-base-dev liblapack-dev gfortran
- sudo apt-get install -qq --force-yes python-opencv libcv-dev libcvaux-dev libopencv-dev libvl-dev
- sudo apt-get install -qq --force-yes texlive-latex-base texlive-latex-extra texlive-math-extra texlive-latex-recommended texlive-fonts-recommended
- if [ -n "${NUMPYSPEC}" ]; then pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel numpy$NUMPYSPEC; fi
- pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel numpy sphinx matplotlib==1.3.1 nose==1.3.0 jinja2==2.6 pygments==1.6 coveralls cpp-coveralls
install:
- python bootstrap-buildout.py
- ./bin/buildout
script:
- ./bin/python -c 'from bob.fingervein import get_config; print(get_config())'
- ./bin/coverage run --source=bob.fingervein ./bin/nosetests -sv
- ./bin/sphinx-build -b doctest doc sphinx
- ./bin/sphinx-build -b html doc sphinx
after_success:
- coveralls
- ./src/bob.extension/scripts/upload-sphinx.sh
This diff is collapsed.
......@@ -25,7 +25,10 @@ import tempfile
from optparse import OptionParser
tmpeggs = tempfile.mkdtemp()
__version__ = '2015-07-01'
# See zc.buildout's changelog if this version is up to date.
tmpeggs = tempfile.mkdtemp(prefix='bootstrap-')
usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
......@@ -40,13 +43,14 @@ this script from going over the network.
'''
parser = OptionParser(usage=usage)
parser.add_option("-v", "--version", help="use a specific zc.buildout version")
parser.add_option("--version",
action="store_true", default=False,
help=("Return bootstrap.py version."))
parser.add_option("-t", "--accept-buildout-test-releases",
dest='accept_buildout_test_releases',
action="store_true", default=False,
help=("Normally, if you do not specify a --version, the "
"bootstrap script and buildout gets the newest "
help=("Normally, if you do not specify a --buildout-version, "
"the bootstrap script and buildout gets the newest "
"*final* versions of zc.buildout and its recipes and "
"extensions for you. If you use this flag, "
"bootstrap and buildout will get the newest releases "
......@@ -59,25 +63,33 @@ parser.add_option("-f", "--find-links",
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--buildout-version",
help="Use a specific zc.buildout version")
parser.add_option("--setuptools-version",
help="use a specific setuptools version")
help="Use a specific setuptools version")
parser.add_option("--setuptools-to-dir",
help=("Allow for re-use of existing directory of "
"setuptools versions"))
options, args = parser.parse_args()
if options.version:
print("bootstrap.py version %s" % __version__)
sys.exit(0)
######################################################################
# load/install setuptools
try:
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
if os.path.exists('ez_setup.py'):
exec(open('ez_setup.py').read(), ez)
else:
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
......@@ -88,12 +100,19 @@ if not options.allow_site_packages:
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
# Strip all site-packages directories from sys.path that
# are not sys.prefix; this is because on Windows
# sys.prefix is a site-package directory.
if sitepackage_path != sys.prefix:
sys.path[:] = [x for x in sys.path
if sitepackage_path not in x]
setup_args = dict(to_dir=tmpeggs, download_delay=0)
if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
if options.setuptools_to_dir is not None:
setup_args['to_dir'] = options.setuptools_to_dir
ez['use_setuptools'](**setup_args)
import setuptools
......@@ -110,7 +129,12 @@ for path in sys.path:
ws = pkg_resources.working_set
setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location
# Fix sys.path here as easy_install.pth added before PYTHONPATH
cmd = [sys.executable, '-c',
'import sys; sys.path[0:0] = [%r]; ' % setuptools_path +
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]
......@@ -123,11 +147,8 @@ find_links = os.environ.get(
if find_links:
cmd.extend(['-f', find_links])
setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location
requirement = 'zc.buildout'
version = options.version
version = options.buildout_version
if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout.
import setuptools.package_index
......@@ -167,7 +188,7 @@ if version:
cmd.append(requirement)
import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
if subprocess.call(cmd) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment