Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
1d823456
Commit
1d823456
authored
Feb 16, 2023
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bootstrap of PyPy when OS does not have Python 2
parent
690d4bb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
41 deletions
+65
-41
component/pypy/buildout.cfg
component/pypy/buildout.cfg
+65
-41
No files found.
component/pypy/buildout.cfg
View file @
1d823456
...
...
@@ -7,55 +7,79 @@ extends =
../ncurses/buildout.cfg
../openssl/buildout.cfg
../pkgconfig/buildout.cfg
../python-2.7/buildout.cfg
../sqlite3/buildout.cfg
../zlib/buildout.cfg
[pycparser-shared]
# XXX:
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/eliben/pycparser/archive/release_v2.21.tar.gz
md5sum = cf4b60f0beca2a25bb599e9e858a8223
configure-command = :
make-binary =
make-targets = $${PYTHON:-python2} setup.py install --install-lib %(location)s
[pypy2]
recipe = slapos.recipe.
cmmi
recipe = slapos.recipe.
build
shared = true
version = 2.7
executable = @@LOCATION@@/bin/pypy
url = https://downloads.python.org/pypy/pypy${:version}-v7.3.11-src.tar.bz2
md5sum = 249ad8b0ddffbb16a9d416c3ae85dd2c
configure-command =
set lib_pypy/pypy_tools/build_cffi_imports.py
sed -i '/"_tkinter",/s/^/#/' lib_pypy/pypy_tools/build_cffi_imports.py
cat <<EOF > Makefile
PREFIX = %(location)s
export PYPY_USESSION_BASENAME=slapos
export TMPDIR=\$(realpath ..)
all: pypy/goal/pypy-c $1
\$^
c_src_dir:
cd pypy/goal && PYTHONPATH=${pycparser-shared:location} $${PYTHON:-python2} ../../rpython/bin/rpython --batch --source --opt=jit --shared targetpypystandalone
ln -s ../usession-\$\$PYPY_USESSION_BASENAME-\$\$USER/testing_1 \$@
pypy/goal/pypy-c: c_src_dir
\$(MAKE) -C \$<
mv \$</libpypy-c.so \$</pypy-c pypy/goal
touch \$@
install:
mkdir -p \$(PREFIX)/bin \$(PREFIX)/include
find lib_pypy lib-python/%(version)s -type d '(' '(' -name __pycache__ -o -name _tkinter -o -name test -o -name tests ')' -prune -o -print ')' \
|while read d; do mkdir -p \$(PREFIX)/\$\$d && find \$\$d -maxdepth 1 -type f ! -name '*.o' ! -name '*.c' |xargs -r cp -t \$(PREFIX)/\$\$d; done
d=lib-python/%(version)s/test && mkdir -p \$(PREFIX)/\$\$d && for x in __init__ pystone regrtest test_support; do echo \$\$d/\$\$x.py; done |xargs -r cp -t \$(PREFIX)/\$\$d
cd lib-python && cp conftest.py stdlib-version.* \$(PREFIX)/lib-python
cp -r include/pypy_*.h pypy/module/cpyext/include/* pypy/module/cpyext/parse/* \$(PREFIX)/include
cd pypy/goal && cp libpypy-c.so \$(PREFIX)/bin && cp pypy-c \$(PREFIX)/bin/pypy
post-install =
cd '%(location)s/bin'
for x in '' 2 %(version)s
do ln -s pypy python$x
done
pycparser-url = https://github.com/eliben/pycparser/archive/release_v2.21.tar.gz
pycparser-md5sum = cf4b60f0beca2a25bb599e9e858a8223
init =
import os, sys
options['executable'] = os.path.join(location, 'bin', 'pypy')
if sys.version_info.major == 2:
self.python = sys.executable
else:
# XXX: We don't care which Python 2 we use to build PyPy
# and we don't want to rebootstrap twice.
depends = options.depends
options.depends = set(depends)
self.python = self.buildout['python2.7']['executable']
options.depends = depends
install =
import os
env = self.environ
pycparser = self.extract(self.download(
options['pycparser-url'], options['pycparser-md5sum']))
pycparser_lib = os.path.join(pycparser, 'lib')
call((self.python, 'setup.py', 'install', '--install-lib', pycparser_lib),
cwd=guessworkdir(pycparser), env=env)
pypy_src = guessworkdir(self.extract(self.download()))
build_cffi_imports = 'lib_pypy/pypy_tools/build_cffi_imports.py'
version = options['version']
with open(os.path.join(pypy_src, 'Makefile'), 'w') as f:
f.write(options['makefile'].replace('\n|','\n')[1:] % {
'build_cffi_imports': build_cffi_imports,
'location': location,
'pycparser': pycparser_lib,
'python': self.python,
'version': version,
})
for cmd in ( ('sed', '-i', '/"_tkinter",/s/^/#/', build_cffi_imports)
, ('make',)
, ('make', 'install')
):
call(cmd, cwd=pypy_src, env=env)
for x in '', version[0], version:
os.symlink('pypy', os.path.join(location, 'bin', 'python' + x))
# WKRD: Buildout does not preserve leading tabs in .installed.cfg
# so prefix with a dummy character.
makefile =
|PREFIX = %(location)s
|export PYPY_USESSION_BASENAME=slapos
|export TMPDIR=$(realpath ..)
|all: pypy/goal/pypy-c %(build_cffi_imports)s
| $^
|c_src_dir:
| cd pypy/goal && PYTHONPATH=%(pycparser)s %(python)s ../../rpython/bin/rpython --batch --source --opt=jit --shared targetpypystandalone
| ln -s ../usession-$$PYPY_USESSION_BASENAME-$$USER/testing_1 $@
|pypy/goal/pypy-c: c_src_dir
| $(MAKE) -C $<
| mv $</libpypy-c.so $</pypy-c pypy/goal
| touch $@
|install:
| mkdir -p $(PREFIX)/bin $(PREFIX)/include
| find lib_pypy lib-python/%(version)s -type d '(' '(' -name __pycache__ -o -name _tkinter -o -name test -o -name tests ')' -prune -o -print ')' \
| |while read d; do mkdir -p $(PREFIX)/$$d && find $$d -maxdepth 1 -type f ! -name '*.o' ! -name '*.c' |xargs -r cp -t $(PREFIX)/$$d; done
| d=lib-python/%(version)s/test && mkdir -p $(PREFIX)/$$d && for x in __init__ pystone regrtest test_support; do echo $$d/$$x.py; done |xargs -r cp -t $(PREFIX)/$$d
| cd lib-python && cp conftest.py stdlib-version.* $(PREFIX)/lib-python
| cp -r include/pypy_*.h pypy/module/cpyext/include/* pypy/module/cpyext/parse/* $(PREFIX)/include
| cd pypy/goal && cp libpypy-c.so $(PREFIX)/bin && cp pypy-c $(PREFIX)/bin/pypy
environment =
C_INCLUDE_PATH=${bzip2:location}/include:${gdbm:location}/include:${libexpat:location}/include:${ncurses:location}/include:${ncurses:location}/include:${openssl:location}/include:${sqlite3:location}/include:${zlib:location}/include
LDFLAGS=-L${bzip2:location}/lib -L${gdbm:location}/lib -L${libexpat:location}/lib -L${libffi:location}/lib -L${ncurses:location}/lib -L${openssl:location}/lib -L${sqlite3:location}/lib -L${zlib:location}/lib -Wl,-rpath=${bzip2:location}/lib -Wl,-rpath=${gdbm:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${libffi:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${sqlite3:location}/lib -Wl,-rpath=${zlib:location}/lib
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment