buildout.cfg 2.49 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
[buildout]
extends =
  ../../stack/slapos.cfg
  ../gcc/buildout.cfg
  ../cython/buildout.cfg
  ../scipy/buildout.cfg
parts =
  python-cocoapi-build-install-egg

[python-cocoapi-repository]
recipe = plone.recipe.command
stop-on-error = true
repository = https://github.com/cocodataset/cocoapi.git
tag = master
git-binary = ${git:location}/bin/git
patch-binary = ${patch:location}/bin/patch
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = export HOME=${:location}; (${:git-binary} clone --quiet -b ${:tag} ${:repository} ${:location}; cd ${:location}; ${:patch-binary} -p1 -d . < ${:_profile_base_location_}/setup.py.patch ) || (rm -fr ${:location}; exit 1)

[python-cocoapi-build-interpreter]
recipe = zc.recipe.egg
initialization =
  import scipy.spatial.ckdtree # load our own libstdc++ explicitly at the very beginning
eggs =
  setuptools
  ${cython:egg}
  ${scipy:egg}
  ${numpy:egg}
interpreter = python-cocoapi-build-interpreter
scripts = python-cocoapi-build-interpreter
location = ${buildout:parts-directory}/${:_buildout_section_name_}

[python-cocoapi-build]
recipe = slapos.recipe.build
location = ${buildout:parts-directory}/${:_buildout_section_name_}
workdir = ${python-cocoapi-repository:location}/PythonAPI
python-bin = ${buildout:bin-directory}/${python-cocoapi-build-interpreter:interpreter}
gcc-location = ${gcc:location}
script =
  os.makedirs(location)
  workdir = self.options['workdir']
  python_bin = self.options['python-bin']
  gcc_location = self.options['gcc-location']
  env = {'PATH':':'.join([gcc_location+'/bin',
                          os.environ['PATH']]),
         'CC':gcc_location+'/bin/gcc',
         'CXX':gcc_location+'/bin/g++',
         }
  call([python_bin, 'setup.py', 'build_ext'], cwd=workdir, env=env)
  call([python_bin, 'setup.py', 'bdist_egg'], cwd=workdir, env=env)

[python-cocoapi-build-install-egg]
recipe = slapos.recipe.build
unzip-binary = ${unzip:location}/bin/unzip
python-cocoapi-repository-path = ${python-cocoapi-repository:location}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
need-python-cocoapi-build = ${python-cocoapi-build:location}
egg = pycocotools
script =
  os.makedirs(location)
  workdir = self.options['python-cocoapi-repository-path']+'/PythonAPI'
  egg_name = 'pycocotools-2.0-py2.7-linux-x86_64.egg'
  dist_dir = os.path.join(workdir, 'dist')
  dest_dir = os.path.join(self.buildout['buildout']['eggs-directory'], egg_name)
  call([self.options['unzip-binary'], '-o', os.path.join(dist_dir, egg_name), '-d', dest_dir])