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

Merge branch 'fixes' into 'master'

Add buildout documentation. Update documentation

See merge request !21
parents 900dff3d 19d128ee
Pipeline #6074 passed with stages
in 4 minutes and 6 seconds
......@@ -196,7 +196,7 @@ package-z
os.environ["BOB_DOCUMENTATION_SERVER"] = server
result = link_documentation(additional_packages, stringio(f))
expected = [
'http://docs.python.org/%d.%d' % sys.version_info[:2],
'https://docs.python.org/%d.%d' % sys.version_info[:2],
'http://matplotlib.org',
'https://setuptools.readthedocs.io/en/latest/',
server % 'bob.extension',
......@@ -209,7 +209,7 @@ package-z
os.environ["BOB_DOCUMENTATION_SERVER"] = server
result = link_documentation(additional_packages, stringio(f))
expected = [
'http://docs.python.org/%d.%d' % sys.version_info[:2],
'https://docs.python.org/%d.%d' % sys.version_info[:2],
'http://matplotlib.org',
'https://setuptools.readthedocs.io/en/latest/',
server % 'bob.extension',
......
......@@ -439,7 +439,7 @@ def link_documentation(additional_packages = ['python', 'numpy'], requirements_f
# standard documentation: Python
mapping = {}
if 'python' in packages:
python_manual = 'http://docs.python.org/%d.%d' % sys.version_info[:2]
python_manual = 'https://docs.python.org/%d.%d' % sys.version_info[:2]
print ("Adding intersphinx source %s" % python_manual)
mapping[python_manual] = None
packages.remove('python')
......
By far, the easiest and best supported installation method for Bob
packages uses `zc.buildout`_.
Using buildout requires you define a configuration file, normally named
``buildout.cfg``, which describes which packages are supposed to be
installed on the current environment. `Our custom buildout
extension <https://pypi.python.org/pypi/bob.buildout>`__ will hook-in
externally compiled software from that configuration file.
The key-idea is that for every project, you create a new environment that contains the
packages you need for the task. A project may be a product you are
working on or a research paper, for you which you will publish
reproducible results. Each environment will be isolated so there is low
risk of interference between your projects.
.. note::
Keep this in mind: 1 task, 1 environment. Do not mix.
Using ``zc.buildout``
=====================
To start, create an empty work directory on your disk, and ``cd`` into
it:
.. code:: sh
$ mkdir exp01
$ cd exp01
Download a stock bootstrap script for ``zc.buildout``:
.. code:: sh
$ wget https://bootstrap.pypa.io/bootstrap-buildout.py
Create ``buildout.cfg`` file, in the same folder as
``bootstrap-buildout.py``. The contents will depend on which Bob
packages you would like to work with, but it generally looks like this:
.. code:: ini
[buildout]
parts = scripts
extensions = bob.buildout
prefer-final = true
; use prefer-final = false **only** to get betas and pre-releases
eggs = bob.io.image
bob.learn.linear
; options for bob.buildout
debug = false
; debug = true will compile bob packages in debug mode
verbose = true
; verbose = true will make the build process more verbose
newest = false
; newest = true will install the newest version of all packages
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
Notice the ``eggs`` entry inside the ``buildout`` section. It defines
all python packages you will directly use on this environment. In this
case, I only need the functionality of loading image files, machines and
trainers for linear systems so, my eggs section contains only two
packages: ``bob.io.image`` and ``bob.learn.linear``. Dependencies for
those packages will be automatically managed, **as long as you keep**
``bob.buildout`` **in your list of** ``extensions``.
Now, bootstrap your new environment and instruct ``zc.buildout`` to
download and install packages (and dependencies) locally:
.. code:: sh
$ python bootstrap-buildout.py
$ ./bin/buildout
.. note::
Buildout by default looks for ``buildout.cfg`` in your current folder and uses that configuration file. You can specify a different config file with the ``-c`` option:
.. code:: sh
$ ./bin/buildout -c develop.cfg
That is it! Once the buildout finishes, all packages have been
downloaded and installed locally. Buildout will create a ``python``
script that sets up your environment correctly so it finds the locally
installed packages. Calling it, starts a new Python interpreter with all
the prescribed functionality available. Run a test:
.. code:: sh
$ ./bin/python
...
>>> import bob.io.image
>>> print(bob.io.image.get_config())
...
>>> import bob.learn.linear
>>> print(bob.learn.linear.get_config())
...
Using mr.developer
------------------
One extension that is regularly used in most of Bob‘s packages is
`mr.developer <https://pypi.python.org/pypi/mr.developer>`__. It can be
used to automatically check out packages from git repositories, and
places them into the ./src directory. It can be simply set up:
.. code:: ini
[buildout]
...
extensions = bob.buildout
mr.developer
auto-checkout = *
; The order that you develop things matter: dependencies should be first.
develop = src/bob.blitz
[sources]
bob.blitz = git git@gitlab.idiap.ch:bob/bob.blitz
; You can also specify a branch
; bob.blitz = git git@gitlab.idiap.ch:bob/bob.blitz branch=mybranch01
; Note: all sources will be checked out even if they are not in "develop ="
; You can also develop a local package (localized in your file system)
bob.pkg = fs bob.pkg full-path=/path/to/bob.pkg
...
A new section called [sources] appears, where the package information
for `mr.developer <https://pypi.python.org/pypi/mr.developer>`__ is
initialized, for more details, please read it’s documentation. Again,
mr.developer does not automatically place the packages into the
``develop`` list (and neither in the ``eggs``), so you have to do that
yourself.
.. note::
mr.developer will not update your sources if they are already
checkedout. If you change your sources and run ``./bin/buildout``
again, it will not update your sources. You have to do that
manually.
Order of packages in ``eggs`` and ``develop``
---------------------------------------------
The order of packages that you list in ``eggs`` and ``develop`` are important and dependencies should be listed first.
Especially, when you want to use a private package and is not available through `pypi`_.
For example, you want to use the ``bob.bio.vein`` package and it has a dependency on ``bob.bio.base`` which is not published on `pypi`_.
Also, ``bob.bio.base`` depends on ``bob.db.base`` which is not published on `pypi`_ either.
The correct order to add these dependencies would be:
.. code:: ini
eggs = bob.db.base
bob.bio.base
bob.bio.vein
...
develop = src/bob.db.base
src/bob.bio.base
src/bob.bio.vein
If you do not specify them in order, you might face with some errors like this::
Could not find index page for 'bob.bio.base' (maybe misspelled?)
If you see such errors, you may need to add the missing package to ``eggs`` and ``develop`` and ``sources`` (**of course,
respecting the order of dependencies**).
Hooking-in privately compiled externals
---------------------------------------
If you have placed external libraries outside default search paths, make
sure you set the buildout ``prefixes`` variable to point to the root of
the installation paths for those. Here is an example:
.. code:: ini
[buildout]
parts = scripts
extensions = bob.buildout
eggs = bob.io.image
bob.learn.linear
prefixes = /path/to/my-install
/path/to/my-other-install
[scripts]
recipe = bob.buildout:scripts
.. include:: links.rst
......@@ -23,7 +23,7 @@ You can check it out by:
.. code-block:: sh
$ wget https://gitlab.idiap.ch/bo/bob.extension/raw/master/examples/bob.example.extension.tar.bz2
$ wget https://gitlab.idiap.ch/bob/bob.extension/raw/master/bob/extension/data/bob.example.extension.tar.bz2
$ tar -xjf bob.example.extension.tar.bz2
$ cd bob.example.extension
......@@ -109,7 +109,7 @@ By default, when using boost you should at least add the ``system`` module, i.e.
...
)
Other modules and options can be set manually using `the standard options for Python extensions <http://docs.python.org/2/extending/building.html>`_.
Other modules and options can be set manually using `the standard options for Python extensions <https://docs.python.org/2/extending/building.html>`_.
Most of the bob packages come with pure C++ code and Python bindings, where we commonly use the `Python C-API <https://docs.python.org/2/extending/index.html>`_ for the bindings.
When your library compiles and links against the pure C++ code, you can simply use the ``bob_packages`` as above.
......
......@@ -6,6 +6,9 @@
|project| Satellite Package Development and Maintenance
=========================================================
.. note::
This guide assumes that you have installed |project| following the instructions on https://www.idiap.ch/software/bob/install.
This tutorial explains how to build and distribute `Python`-based working environments for |project|.
By following these instructions you will be able to:
......@@ -21,7 +24,7 @@ This is a great way to release code for laboratory exercises or for a particular
.. note::
The core of our strategy is based on standard tools for *defining* and *deploying* Python packages.
If you are not familiar with Python's ``setuptools``, ``distutils`` or PyPI, it can be beneficial to `learn about those <https://docs.python.org/2/distutils/>`_ before you start.
If you are not familiar with Python's ``setuptools``, ``distutils`` or PyPI, it can be beneficial to `learn about those <https://docs.python.org/distutils/>`_ before you start.
Python's `Setuptools`_ and `Distutils`_ are mechanisms to *define and distribute* Python code in a packaged format, optionally through `PyPI`_, a web-based Python package index and distribution portal.
`zc.buildout`_ is a tool to *deploy* Python packages locally, automatically setting up and encapsulating your work environment.
......@@ -35,11 +38,11 @@ Fire-up a shell window and than do this:
.. code-block:: sh
$ wget https://gitlab.idiap.ch/bob/bob.extension/raw/master/examples/bob.example.project.tar.bz2
$ wget https://gitlab.idiap.ch/bob/bob.extension/raw/master/bob/extension/data/bob.example.project.tar.bz2
$ tar -xjf bob.example.project.tar.bz2
$ cd bob.example.project
We now recommend you read the file ``README.rst``, which is written in `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ format, situated at the root of the just downloaded material.
We now recommend you read the file ``README.rst``, which is written in `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ format (see also `reStructuredText Primer <http://www.sphinx-doc.org/en/stable/rest.html>`_), situated at the root of the just downloaded material.
It contains important information on other functionality such as document generation and unit testing, which will not be covered on this introductory material.
The anatomy of a minimal package should look like the following:
......@@ -117,7 +120,7 @@ package, all of which is contained in the ``setup`` function:
)
In detail, it defines the name and the version of this package, which files belong to the package (those files are automatically collected by the ``find_packages`` function), other packages that we depend on, namespaces (see below) and console scripts.
The full set of options can be inspected in the `Setuptools documentation <http://pythonhosted.org/setuptools/setuptools.html>`_.
The full set of options can be inspected in the `Setuptools documentation <https://setuptools.readthedocs.io>`_.
To be able to use the package, we first need to build it.
Here is how to go from nothing to everything:
......@@ -150,7 +153,7 @@ Here is how to go from nothing to everything:
If you just want to get things rolling, using ``python bootstrap-buildout.py`` will, in most cases, do the right thing.
.. note::
When you have installed an older version of |project| -- i.e. |project| v1.x, you might need to uninstall it first, see https://gitlab.idiap.ch/bob/bob/wikis/Installation.
When you have installed an older version of |project| -- i.e. |project| v1.x, you might need to uninstall it first, see https://www.idiap.ch/software/bob/install.
......@@ -161,65 +164,32 @@ Here is how to go from nothing to everything:
**Using Bob 2.0 at Idiap**
At Idiap_, we provide a pre-installed version of the latest stable version of the packages.
To use these packages, you just have to bootstrap your package with the following command:
.. code-block:: sh
$ /idiap/group/torch5spro/releases/bob-stable/py27/bin/python bootstrap-buildout.py
or
.. code-block:: sh
$ /idiap/group/torch5spro/releases/bob-stable/py34/bin/python bootstrap-buildout.py
if you prefer Python 3.
On the other hand, when you want to use the latest (unstable) versions of the |project| packages in your satellite package, you might want to use:
.. code-block:: sh
$ /idiap/group/torch5spro/nightlies/last/bob/linux-x86_64-release/bin/python bootstrap-buildout.py
.. warning::
This python version is replaced every night.
Do not use it in any over-night calculations.
Sometimes, you don't want to use the packages that are published on PyPI_, but the latest (nightly compiled) versions of all our packages.
In this case, use:
.. code-block:: sh
$ ./bin/buildout buildout:find-links=https://www.idiap.ch/software/bob/packages/nightlies/last buildout:prefer-final=false
.. note::
You can freely mix the all possible ways to obtain packages.
For example, you can use the ``bob-stable`` installations, and hand-select some packages to be downloaded from PyPI_ or from the nightlies packages (see above), e.g., using ``mr.developer`` (see below).
To use it, refer to: `Using Bob at Idiap <https://gitlab.idiap.ch/bob/bob/wikis/Using-Bob-at-Idiap>`_
Using buildout
==============
Buildout has set up you local environment with packages that it finds from different sources.
Buildout (see :doc:`buildout`) has set up you local environment with packages that it finds from different sources.
It is initialized by the ``buildout.cfg`` file, which is part of the package that you unzipped above.
Let's have a look inside it:
.. code-block:: guess
; vim: set fileencoding=utf-8 :
[buildout]
parts = scripts
develop = .
eggs = bob.example.project
extensions = bob.buildout
develop = .
; options for bob.buildout
debug = true
verbose = true
newest = false
verbose = true
debug = false
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
It is organized in several *sections*, which are indicated by ``[]``, where the default section ``[buildout]`` is always required.
Some of the entries need attention.
......@@ -236,8 +206,8 @@ Some of the entries need attention.
* The next entry is the ``develop`` list.
There, you can list directories that contain Python packages, which will be build in exactly the order that you specified there.
With this option, you can tell buildout particularly, in which directories it should look for some packages.
Note that the ``develop``ed packages are not automatically included into the ``eggs``.
Of course, you need to develop the current package, which is stored in ``.`` i.e, the current directory.
Note that the ``develop`` packages are not automatically included into the ``eggs``.
Of course, you need to develop the current package, which is stored in ``.``, i.e, the current directory.
The remaining options define, how the packages are build.
For example, the ``debug`` flag defined, how the :ref:`C++ code <extension-c++>` in all the packages is built.
......@@ -293,6 +263,12 @@ Finally, buildout will perform the following steps:
4. It will populate the ``./bin`` directory with all the ``console_scripts`` that you have specified in the ``setup.py``.
In our example, this is ``./bin/version.py``.
.. note::
One thing to note in package development is that when you
change the entry points in ``setup.py`` of a package, you need to
run ``./bin/buildout`` again.
Your local environment
======================
......@@ -329,10 +305,11 @@ Also, when using the newly generated ``./bin/python`` script, you can access all
- numpy: 1.8.2 (/usr/lib/python2.7/dist-packages)
- setuptools: 15.1 ([PATH]/bob.example.project/eggs/setuptools-15.1-py2.7.egg)
Everything is now setup for you to continue the development of this package.
Modify all required files to setup your own package name, description and dependencies.
Start adding files to your library (or libraries) and, if you wish, make this package available in a place with public access to make your research public.
We recommend using GitHub.
We recommend using Gitlab or GitHub.
Optionally, `drop-us a message <https://groups.google.com/d/forum/bob-devel>`_ talking about the availability of this package so we can add it to the growing list of `Satellite Packages`_.
......@@ -388,7 +365,7 @@ Once you have edited both ``doc/conf.py`` and ``doc/index.rst`` you can run the
.. code-block:: sh
$ ./bin/sphinx-build doc sphinx
$ ./bin/sphinx-build -n doc sphinx
...
This example generates the output of the sphinx processing in the directory ``sphinx``.
......@@ -413,7 +390,7 @@ To run the test units on your package call:
.. code-block:: sh
$ ./bin/nosetests -v
$ ./bin/nosetests -sv
bob.example.library.test.test_reverse ... ok
----------------------------------------------------------------------
......
......@@ -22,6 +22,7 @@ Documentation
:maxdepth: 2
guide
buildout
extension
cpp_api
py_api
......
......@@ -7,7 +7,7 @@
.. _bob's website: https://www.idiap.ch/software/bob
.. _bob: https://www.idiap.ch/software/bob
.. _c++: http://www2.research.att.com/~bs/C++.html
.. _distutils: http://docs.python.org/distutils/
.. _distutils: https://docs.python.org/distutils/
.. _git: http://git-scm.com/
.. _gitlab: http://gitlab.idiap.ch/
.. _idiap: http://www.idiap.ch
......@@ -16,8 +16,8 @@
.. _pep 386: http://www.python.org/dev/peps/pep-0386/
.. _python: http://www.python.org
.. _pypi: http://pypi.python.org
.. _satellite packages: https://gitlab.idiap.ch/bob/bob/wikis/Packages
.. _setuptools: http://trac.edgewall.org/wiki/setuptools
.. _satellite packages: https://www.idiap.ch/software/bob/packages
.. _setuptools: https://setuptools.readthedocs.io
.. _sphinx: http://sphinx.pocoo.org
.. _zc.buildout: http://pypi.python.org/pypi/zc.buildout/
.. _mr.developer: http://pypi.python.org/pypi/mr.developer/
......
include README.rst bootstrap-buildout.py buildout.cfg COPYING version.txt requirements.txt
recursive-include doc *.py *.rst
recursive-include doc *.py *.rst *.ico *.png
.. vim: set fileencoding=utf-8 :
.. Fri Dec 23 13:41:36 CET 2016
.. image:: http://img.shields.io/badge/docs-stable-yellow.png
:target: http://pythonhosted.org/bob.example.extension/index.html
.. image:: http://img.shields.io/badge/docs-latest-orange.png
:target: https://www.idiap.ch/software/bob/docs/latest/bob/bob.example.extension/master/index.html
.. image:: https://gitlab.idiap.ch/bob/bob.example.extension/badges/master/build.svg
:target: https://gitlab.idiap.ch/bob/bob.example.extension/commits/master
.. image:: https://img.shields.io/badge/gitlab-project-0000c0.svg
:target: https://gitlab.idiap.ch/bob/bob.example.extension
.. image:: http://img.shields.io/pypi/v/bob.example.extension.png
:target: https://pypi.python.org/pypi/bob.example.extension
.. image:: http://img.shields.io/pypi/dm/bob.example.extension.png
:target: https://pypi.python.org/pypi/bob.example.extension
============================
Example buildout environment
============================
This simple example demonstrates how to wrap Bob-based scripts on buildout
This package is part of the signal-processing and machine learning toolbox
Bob_. This simple example demonstrates how to wrap Bob-based scripts on buildout
environments. This may be useful for homework assignments, tests or as a way to
distribute code to reproduce your publication. In summary, if you need to give
out code to others, we recommend you do it following this template so your code
can be tested, documented and run in an orderly fashion.
Installation
------------
.. note::
Follow our `installation`_ instructions. Then, using the Python interpreter
provided by the distribution, bootstrap and buildout this package::
To follow these instructions locally you will need a local copy of this
package. For that, you can use the github tarball API to download the
package::
$ python bootstrap-buildout.py
$ ./bin/buildout
$ wget --no-check-certificate https://gitlab.idiap.ch/bob/bob.project.example/tarball/master -O- | tar xz
$ mv idiap-bob.project* bob.project.example
Documentation and Further Information
-------------------------------------
Please refer to the latest Bob user guide, accessing from the `Bob website
<http://www.idiap.ch/software/bob>`_ for how to create your own packages based
on this example. In particular, the Section entitled `Organize Your Work in
Satellite Packages
<http://www.idiap.ch/software/bob/docs/releases/last/sphinx/html/OrganizeYourCode.html>`_
on this example. In particular, the Section entitled `Bob Satellite Package
Development and Maintenance
<https://pythonhosted.org/bob.extension/guide.html>`_
contains details on how to setup, build and roll out your code.
Contact
-------
For questions or reporting issues to this software package, contact our
development `mailing list`_.
.. Place your references here:
.. _bob: https://www.idiap.ch/software/bob
.. _installation: https://www.idiap.ch/software/bob/install
.. _mailing list: https://www.idiap.ch/software/bob/discuss
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.dos.anjos@gmail.com>
# Sun 15 Apr 14:01:39 2012
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Inverts the list of floating point numbers given on command line
"""
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.dos.anjos@gmail.com>
# Sun 15 Apr 14:01:39 2012
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Prints the version of bob and exits
"""
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.dos.anjos@gmail.com>
# Wed 15 Aug 09:59:33 2012
#
# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Test Units
"""
......
......@@ -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,8 +43,9 @@ 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,
......@@ -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])
......
; vim: set fileencoding=utf-8 :
; Manuel Guenther <manuel.guenther@idiap.ch>
; Thu Oct 9 16:51:06 CEST 2014
; Fri Dec 23 13:40:37 CET 2016
[buildout]
parts = scripts
develop = .
eggs = bob.example.extension
extensions = bob.buildout
develop = .
; options for bob.buildout
debug = true
verbose = true
newest = false
verbose = true
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
\ No newline at end of file
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.anjos@idiap.ch>
# Mon 13 Aug 2012 12:38:15 CEST
#
# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
import os
import sys
import glob
import pkg_resources