Commit e53cc14e authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

First commit

parents
*~
*.swp
*.pyc
*.so
*.dylib
CMakeLists.txt
bin
eggs
parts
.installed.cfg
.mr.developer.cfg
*.egg-info
develop-eggs
sphinx
dist
.nfs*
.gdb_history
build
*.egg
src/
*.png
*.pdf
include README.rst
include bootstrap.py
include buildout.cfg
recursive-include doc *.rst *.png conf.py
recursive-include bob/example/faceverify/data *.hdf5
.. vim: set fileencoding=utf-8 :
.. Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
.. Mon 20 Jul 2015 16:57:00 CEST
====================
Bob Meta Package
====================
Bob is a free signal-processing and machine learning toolbox originally
developed by the Biometrics group at `Idiap`_ Research Institute, Switzerland.
The toolbox is written in a mix of `Python`_ and `C++`_ and is designed to be
both efficient and reduce development time. It is composed of a reasonably
large number of `packages`_ that implement tools for image, audio & video
processing, machine learning and pattern recognition.
**This is a meta package containing depencies w.r.t the layers 0 and 1 of Bob. The purpose of this package is to make it easy the deployment task in different platforms.**
If just want to use Bob's functionalities on your experiments, you are **not**
supposed to install this package on your machine, but rather `create your own
personalised work environment
<https://github.com/idiap/bob/wiki/Installation>`_ depending on your needs, by
collecting individual sub-packages based on your requirements.
If you are developing Bob packages which are supposed to built along side our
`nightly build system <https://www.idiap.ch/software/bob/buildbot/waterfall>`_,
please read on.
Installation
------------
As per-usual, make sure all external `dependencies`_ are installed on your host
before trying to compile the whole of Bob. Once all dependencies_ are
satisfied, you should be able to::
$ python bootstrap.py
$ ./bin/buildout
You may tweak the options in ``buildout.cfg`` to disable/enable verbosity and
debug builds, **before you run** ``./bin/buildout``.
Documentation
-------------
You can generate the documentation for all packages in this container, after
installation, using Sphinx::
$ ./bin/sphinx-build . sphinx
This shall place in the directory ``sphinx``, the current version for the
documentation of the package.
Testing
-------
You can run a set of tests using the nose test runner::
$ ./bin/nosetests -sv
You can run our documentation tests using sphinx itself::
$ ./bin/sphinx-build -b doctest . sphinx
Adding a Package
----------------
To add a package, just add it in the dependency list.
.. warning::
Before adding a package to this prototype, please ensure that the package:
* contains a README clearly indicating how to install the package (including
external dependencies required). Also, please add package badges for the
build status and coverage as shown in other packages (even if your package
is not yet integrated to Travis or Coveralls).
* Has unit tests.
* Is integrated with Travis-CI, and correctly tests on that platform (i.e.
it builds, it tests fine and a documentation can be constructed and tested
w/o errors)
* Is integrated with Coveralls for reporting test coverage
If you don't know how to do this, ask for information on the bob-devel
mailing list.
Updating a Package
------------------
TODO::
$ ./bin/get_versions.py
Removing a Package
------------------
To add a package, just remove it from the dependency list.
.. External References
.. _c++: http://www2.research.att.com/~bs/C++.html
.. _python: http://www.python.org
.. _idiap: http://www.idiap.ch
.. _packages: https://github.com/idiap/bob/wiki/Packages
.. _wiki: https://github.com/idiap/bob/wiki
.. _bug tracker: https://github.com/idiap/bob/issues
.. _dependencies: https://github.com/idiap/bob/wiki/Dependencies
#see http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
__import__('pkg_resources').declare_namespace(__name__)
# Andre Anjos <andre.anjos@idiap.ch>
# Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# Mon 20 Jul 17:30:00 CEST 2015
# Lists the final version of a given package in PyPI
# Uses the package 'pkgtools' for such.
import os
import sys
import re
import pkgtools.pypi
import distutils.version
import pkg_resources
PKG_NAME = "bob.meta"
def get_releases(package):
try:
return pkgtools.pypi.PyPIJson(package).retrieve()['releases'].keys()
except:
return []
def get_max_version(versions):
try:
v = list(reversed(sorted([distutils.version.StrictVersion(k) for k in versions])))
final = [k for k in v if not k.prerelease]
if final: return final[0]
return v[0]
except:
v = list(reversed(sorted([distutils.version.LooseVersion(k) for k in versions])))
final = [k for k in v if not re.search(r'[a-z]', k.vstring)]
if final: return final[0]
return v[0]
def get_dependencies():
package = pkg_resources.working_set.by_key[PKG_NAME]
return [str(r) for r in package.requires()]
def main():
dependencies = get_dependencies()
print "install_requires=["
for d in dependencies:
versions = get_releases(d)
print " {0} == {1}".format(d,get_max_version(versions))
print "],"
if __name__ == '__main__':
main()
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import os
import shutil
import sys
import tempfile
from optparse import OptionParser
tmpeggs = tempfile.mkdtemp()
usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
Bootstraps a buildout-based project.
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.
Note that by using --find-links to point to local resources, you can keep
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("-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 "
"*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 "
"even if they are alphas or betas."))
parser.add_option("-c", "--config-file",
help=("Specify the path to the buildout configuration "
"file to be used."))
parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")
options, args = parser.parse_args()
######################################################################
# 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 not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# 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]
setup_args = dict(to_dir=tmpeggs, download_delay=0)
if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)
######################################################################
# Install buildout
ws = pkg_resources.working_set
cmd = [sys.executable, '-c',
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]
find_links = os.environ.get(
'bootstrap-testing-find-links',
options.find_links or
('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None)
)
if find_links:
cmd.extend(['-f', find_links])
setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location
requirement = 'zc.buildout'
version = options.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
_final_parts = '*final-', '*final'
def _final_version(parsed_version):
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True
index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
index.add_find_links((find_links,))
req = pkg_resources.Requirement.parse(requirement)
if index.obtain(req) is not None:
best = []
bestv = None
for dist in index[req.project_name]:
distv = dist.parsed_version
if _final_version(distv):
if bestv is None or distv > bestv:
best = [dist]
bestv = distv
elif distv == bestv:
best.append(dist)
if best:
best.sort()
version = best[-1].version
if version:
requirement = '=='.join((requirement, version))
cmd.append(requirement)
import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])
######################################################################
# Import and run buildout
ws.add_entry(tmpeggs)
ws.require(requirement)
import zc.buildout.buildout
if not [a for a in args if '=' not in a]:
args.append('bootstrap')
# if -c was provided, we push it back into args for buildout' main function
if options.config_file is not None:
args[0:0] = ['-c', options.config_file]
zc.buildout.buildout.main(args)
shutil.rmtree(tmpeggs)
; vim: set fileencoding=utf-8 :
; Andre Anjos <andre.anjos@idiap.ch>
; Mon 16 Apr 08:29:18 2012 CEST
[buildout]
parts = scripts
eggs = bob.meta
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = .
; options for bob.buildout extension
debug = false
verbose = true
newest = false
[sources]
[scripts]
recipe = bob.buildout:scripts
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# Tue Apr 24 18:55:40 CEST 2012
# This file contains the python (distutils/setuptools) instructions so your
# package can be installed on **any** host system. It defines some basic
# information like the package name for instance, or its homepage.
#
# It also defines which other packages this python package depends on and that
# are required for this package's operation. The python subsystem will make
# sure all dependent packages are installed or will install them for you upon
# the installation of this package.
#
# The 'buildout' system we use here will go further and wrap this package in
# such a way to create an isolated python working environment. Buildout will
# make sure that dependencies which are not yet installed do get installed, but
# **without** requiring administrative privileges on the host system. This
# allows you to test your package with new python dependencies w/o requiring
# administrative interventions.
from setuptools import setup, find_packages
# The only thing we do in this file is to call the setup() function with all
# parameters that define our package.
setup(
# This is the basic information about your project. Modify all this
# information before releasing code publicly.
name='bob.meta',
version='2.0.0a1',
description='',
url='',
license='GPLv3',
author='Tiago de Freitas Pereira',
author_email='tiago.pereira@idiap.ch',
long_description=open('README.rst').read(),
# This line is required for any distutils based packaging.
packages=find_packages(),
include_package_data=True,
zip_safe=True,
# This line defines which packages should be installed when you "install"
# this package. All packages that are mentioned here, but are not installed
# on the current system will be installed locally and only visible to the
# scripts of this package. Don't worry - You won't need administrative
# privileges when using buildout.
install_requires=[
"setuptools",
"pkgtools",
#layer 0
"bob.ap",
"bob.blitz",
"bob.buildout",
"bob.core",
"bob.db.base",
"bob.extension",
"bob.io.base",
"bob.math",
"bob.measure",
"bob.sp",
#layer 1
"bob.io.image",
"bob.io.matlab",
"bob.io.video",
"bob.ip.base",
"bob.ip.color",
"bob.ip.draw",
"bob.ip.gabor",
"bob.learn.activation",
"bob.learn.boosting",
"bob.learn.em",
"bob.learn.libsvm",
"bob.learn.linear",
"bob.learn.mlp"
],
# This package is good examples of namespace implementations
# using several layers. You can check them out here:
# https://github.com/idiap/bob/wiki/Satellite-Packages
namespace_packages = [
'bob',
],
# This entry defines which scripts you will have inside the 'bin' directory
# once you install the package (or run 'bin/buildout'). The order of each
# entry under 'console_scripts' is like this:
# script-name-at-bin-directory = module.at.your.library:function
entry_points={
'console_scripts':
[
'get_versions.py = bob.meta.script.get_versions:main',
],
},
classifiers = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
],
)
Supports Markdown
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