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]
extends =
basic-numpy.cfg
../cython/buildout.cfg
../pygolang/buildout.cfg
../macros/macro.pythonpath.eggs.cfg
parts = numpy
[python_for_numpy_build:sys.version_info >= (3,8)]
<= python-interpreter
interpreter = ${:_buildout_section_name_}
eggs =
${pygolang:egg}
${cython:egg}
executable = ${buildout:bin-directory}/${:interpreter}
[numpy-env]
BLAS=None
LAPACK=None
ATLAS=None
[numpy:sys.version_info >= (3,8)]
recipe = slapos.recipe.build
python = ${cython-interpreter: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))
[numpy]
recipe = zc.recipe.egg:custom
egg = numpy
environment = numpy-env
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))
[versions]
numpy = 1.16.4
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',
'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
[numpy:sys.version_info >= (3,8)]
depends = ${numpy-pythonpath:recipe}
[versions]
numpy = ${versions:numpy}
[numpy-pythonpath]
<= macro.pythonpath.eggs
environment = numpy-env
eggs = ${cython:egg}
[versions:sys.version_info >= (3,8)]
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]
extends =
openblas-numpy.cfg
../cython/buildout.cfg
../pygolang/buildout.cfg
parts =
numpy
[python_for_numpy_build:sys.version_info >= (3,8)]
<= python-interpreter
interpreter = ${:_buildout_section_name_}
eggs =
${pygolang:egg}
${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.cfg
../openblas/buildout.cfg
parts = numpy
[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]
extends =
scipy.cfg
# ../macros/macro.sub.buildout.cfg
../numpy/openblas.cfg
../pandas/buildout.cfg
# ../pygolang/buildout.cfg
parts = scipy
parts =
scipy
[scipy-env]
<= numpy-env
[scipy-prerequisite]
recipe = slapos.recipe.build
depends = ${scipy-eggs:recipe}
install =
update =
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]
recipe = zc.recipe.egg:custom
egg = scipy
environment = scipy-env
rpath = ${numpy:rpath}
[scipy-eggs]
recipe = zc.recipe.egg
eggs =
${cython:egg}
${numpy:egg}
${pandas:egg}
pythran
pybind11
[versions]
scipy = 1.0.1
[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]
<= python-interpreter
interpreter = ${:_buildout_section_name_}
[scipy-setup-eggs]
recipe = zc.recipe.egg
eggs =
${pygolang:egg}
${cython:egg}
${numpy:egg}
${pandas:egg}
pythran
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)]
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 +=
# Always build GCC for Fortran (see openblas).
max_version = 0
[python]
part = python3.8
[jupyter]
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