Commit 68d338fe authored by Xavier Thompson's avatar Xavier Thompson

WIP: Use PYTHONPATH

parent 1de997e2
[buildout]
parts =
[macro.pythonpath.eggs]
recipe = slapos.recipe.build
_name_ = ${:_buildout_section_name_}
init =
prerequisite = """
[.%(_name_)s.prerequisite]
recipe = slapos.recipe.build
init =
section = self.buildout['%(_name_)s']
self.eggs = [e.strip() for e in section['eggs'].splitlines() if e.strip()]
update =
from zc.buildout.easy_install import working_set
buildout = self.buildout['buildout']
eggs_directory = buildout['eggs-directory']
develop_eggs_directory = buildout['develop-eggs-directory']
dists = working_set(self.eggs, [develop_eggs_directory, eggs_directory])
paths = ':'.join(dist.location for dist in dists)
self.buildout['%(environment)s']['PYTHONPATH'] = paths
print("PYTHONPATH=" + paths)
""" % options
self.buildout.parse(prerequisite)
[buildout]
parts =
[macro.sub.buildout]
recipe = slapos.recipe.build
install =
import os
from zc.buildout.buildout import _isurl, urljoin
from slapos.rebootstrap.bootstrap import setup_script
base = options['_profile_base_location_']
if _isurl(base):
abspath = lambda path: urljoin(base + '/', path)
else:
abspath = lambda path: os.path.realpath(os.path.join(base, path))
keep_options = (
'eggs-directory'
'develop-eggs-directory',
'bin-directory',
'parts-directory',
'extends-cache',
'extensions',
'download-cache',
'newest',
'shared-part-list',
)
buildout = {}
buildout_section = self.buildout['buildout']
for option in keep_options:
try:
value = options.get.get(option, buildout_section[option])
buildout[option] = '\n ' + value.replace('\n', '\n ')
except KeyError:
pass
extends = '\n '.join(
abspath(path.strip())
for path in options.get('extends', '').splitlines()
if path.strip()
)
parts = options['parts'].replace('\n', '\n ')
versions = self.buildout.get(buildout_section['versions'])
buildout['versions'] = 'versions'
os.mkdir(location)
with open(os.path.join(location, 'buildout.cfg'), 'w') as buildout_conf:
buildout_conf.write(
options['template'] % {
'buildout': '\n'.join('%s = %s' % item for item in buildout.items()),
'extends': extends,
'contents': options.get('contents', ''),
'parts': options['parts'],
'versions': '\n'.join('%s = %s' % item for item in versions.items()),
}
)
buildout = os.path.join(location, 'bin', 'buildout')
os.mkdir(os.path.dirname(buildout))
setup_script(buildout, options['python'])
call((buildout, '-U'), cwd=location)
template =
[buildout]
%(buildout)s
extends =
%(extends)s
parts =
%(parts)s
extensions -= slapos.rebootstrap
%(contents)s
[versions]
%(versions)s
[buildout]
parts = numpy
[numpy-env]
BLAS=None
LAPACK=None
ATLAS=None
[numpy]
recipe = zc.recipe.egg:custom
egg = numpy
[versions]
numpy = 1.16.4
[buildout] [buildout]
extends = extends =
basic-numpy.cfg
../cython/buildout.cfg ../cython/buildout.cfg
../pygolang/buildout.cfg ../macros/macro.pythonpath.eggs.cfg
parts = numpy parts = numpy
[python_for_numpy_build:sys.version_info >= (3,8)] [numpy-env]
<= python-interpreter BLAS=None
interpreter = ${:_buildout_section_name_} LAPACK=None
eggs = ATLAS=None
${pygolang:egg}
${cython:egg}
executable = ${buildout:bin-directory}/${:interpreter}
[numpy:sys.version_info >= (3,8)] [numpy]
recipe = slapos.recipe.build recipe = zc.recipe.egg:custom
python = ${cython-interpreter:executable} egg = numpy
base = ${:_profile_base_location_} environment = numpy-env
install =
import os
from zc.buildout.buildout import _isurl, urljoin
from slapos.rebootstrap.bootstrap import setup_script
base = options['base']
if _isurl(base):
extends = lambda path: urljoin(base + '/', path)
else:
extends = lambda path: os.path.realpath(os.path.join(base, path))
buildout_extra = [] [versions]
buildout_section = self.buildout['buildout'] numpy = 1.16.4
for option_name in ('download-cache', 'newest', 'shared-part-list'):
option_value = buildout_section.get(option_name)
if option_value:
buildout_extra.append('%s = %s' % (option_name, option_value))
os.mkdir(location) [numpy:sys.version_info >= (3,8)]
with open(os.path.join(location, 'buildout.cfg'), 'w') as buildout_conf: depends = ${numpy-pythonpath:recipe}
buildout_conf.write(
options['template'] % {
'extends': '\n '.join(map(extends, (
'../../stack/slapos.cfg',
'basic-numpy.cfg',
))),
'buildout': '\n'.join(buildout_extra),
}
)
buildout = os.path.join(location, 'bin', 'buildout')
os.mkdir(os.path.dirname(buildout))
setup_script(buildout, options['python'])
call((buildout, '-U'), cwd=location)
template =
[buildout]
extends = %(extends)s
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
bin-directory = ${buildout:bin-directory}
extensions -= slapos.rebootstrap
%(buildout)s
parts = numpy
[versions] [numpy-pythonpath]
numpy = ${versions:numpy} <= macro.pythonpath.eggs
environment = numpy-env
eggs = ${cython:egg}
[versions:sys.version_info >= (3,8)] [versions:sys.version_info >= (3,8)]
numpy = 1.22.0 numpy = 1.22.0
[buildout]
extends =
basic-numpy.cfg
../openblas/buildout.cfg
[numpy-env]
OPENBLAS = ${openblas:location}/lib/libopenblas.so
LAPACK = ${openblas:location}/lib/libopenblas.so
ATLAS = ${openblas:location}/lib/libopenblas.so
[numpy]
environment = numpy-env
rpath =
${openblas:location}/lib
[buildout] [buildout]
extends = extends =
openblas-numpy.cfg buildout.cfg
../cython/buildout.cfg ../openblas/buildout.cfg
../pygolang/buildout.cfg parts = numpy
parts = [numpy-env]
numpy OPENBLAS = ${openblas:location}/lib/libopenblas.so
LAPACK = ${openblas:location}/lib/libopenblas.so
[python_for_numpy_build:sys.version_info >= (3,8)] ATLAS = ${openblas:location}/lib/libopenblas.so
<= python-interpreter
interpreter = ${:_buildout_section_name_} [numpy]
eggs = environment = numpy-env
${pygolang:egg} rpath = ${openblas:location}/lib
${cython:egg}
executable = ${buildout:bin-directory}/${:interpreter}
[numpy:sys.version_info >= (3,8)]
recipe = slapos.recipe.build
python = ${python_for_numpy_build:executable}
base = ${:_profile_base_location_}
install =
import os
from zc.buildout.buildout import _isurl, urljoin
from slapos.rebootstrap.bootstrap import setup_script
base = options['base']
if _isurl(base):
extends = lambda path: urljoin(base + '/', path)
else:
extends = lambda path: os.path.realpath(os.path.join(base, path))
buildout_extra = []
buildout_section = self.buildout['buildout']
for option_name in ('download-cache', 'newest', 'shared-part-list'):
option_value = buildout_section.get(option_name)
if option_value:
buildout_extra.append('%s = %s' % (option_name, option_value))
os.mkdir(location)
with open(os.path.join(location, 'buildout.cfg'), 'w') as buildout_conf:
buildout_conf.write(
options['template'] % {
'extends': '\n '.join(map(extends, (
'../../stack/slapos.cfg',
'openblas-numpy.cfg',
))),
'buildout': '\n'.join(buildout_extra),
}
)
buildout = os.path.join(location, 'bin', 'buildout')
os.mkdir(os.path.dirname(buildout))
setup_script(buildout, options['python'])
call((buildout, '-U'), cwd=location)
template =
[buildout]
extends = %(extends)s
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
bin-directory = ${buildout:bin-directory}
parts-directory = ${buildout:parts-directory}
extensions -= slapos.rebootstrap
%(buildout)s
parts = numpy
[versions]
numpy = ${versions:numpy}
[versions:sys.version_info >= (3,8)]
numpy = 1.22.0
[buildout] [buildout]
extends = extends =
scipy.cfg
# ../macros/macro.sub.buildout.cfg
../numpy/openblas.cfg ../numpy/openblas.cfg
../pandas/buildout.cfg ../pandas/buildout.cfg
# ../pygolang/buildout.cfg parts = scipy
parts = [scipy-env]
scipy <= numpy-env
[scipy-prerequisite] [scipy]
recipe = slapos.recipe.build recipe = zc.recipe.egg:custom
depends = ${scipy-eggs:recipe} egg = scipy
install = environment = scipy-env
update = rpath = ${numpy:rpath}
from zc.buildout.easy_install import working_set
options = self.options
buildout = self.buildout['buildout']
scipy_eggs = self.buildout['scipy-eggs']
scipy_env = self.buildout['scipy-env']
eggs_directory = buildout['eggs-directory']
develop_eggs_directory = buildout['develop-eggs-directory']
setup_eggs = scipy_eggs['eggs'].splitlines()
setup_eggs = tuple(e.strip() for e in setup_eggs if e.strip())
dists = working_set(setup_eggs, [develop_eggs_directory, eggs_directory])
paths = ':'.join(dist.location for dist in dists)
scipy_env['PYTHONPATH'] = paths
[scipy-eggs] [versions]
recipe = zc.recipe.egg scipy = 1.0.1
eggs =
${cython:egg}
${numpy:egg}
${pandas:egg}
pythran
pybind11
[scipy:sys.version_info >= (3,8)] [scipy:sys.version_info >= (3,8)]
depends = ${scipy-prerequisite:recipe} depends = ${scipy-pythonpath:recipe}
[scipy-pythonpath]
<= macro.pythonpath.eggs
environment = scipy-env
eggs = ${scipy-setup-eggs:eggs}
[python_for_scipy_build:False] [scipy-setup-eggs]
<= python-interpreter recipe = zc.recipe.egg
interpreter = ${:_buildout_section_name_}
eggs = eggs =
${pygolang:egg}
${cython:egg} ${cython:egg}
${numpy:egg} ${numpy:egg}
${pandas:egg} ${pandas:egg}
pythran pythran
pybind11 pybind11
executable = ${buildout:bin-directory}/${:interpreter}
[scipy:False]
<= macro.sub.buildout
python = ${python_for_scipy_build:executable}
extends =
scipy.cfg
parts =
scipy
[versions:sys.version_info >= (3,8)] [versions:sys.version_info >= (3,8)]
pybind11 = 2.9.2 pybind11 = 2.9.2
......
[buildout]
extends =
../numpy/openblas.cfg
parts =
scipy
[scipy-env]
<= numpy-env
[scipy]
recipe = zc.recipe.egg:custom
egg = scipy
environment = scipy-env
setup-eggs =
${cython:egg}
${numpy:egg}
rpath = ${numpy:rpath}
[versions]
scipy = 1.0.1
...@@ -18,6 +18,9 @@ parts += ...@@ -18,6 +18,9 @@ parts +=
# Always build GCC for Fortran (see openblas). # Always build GCC for Fortran (see openblas).
max_version = 0 max_version = 0
[python]
part = python3.8
[jupyter] [jupyter]
python_executable = ${buildout:bin-directory}/${:interpreter} python_executable = ${buildout:bin-directory}/${:interpreter}
......
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