mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 02:25:18 +03:00
fix python static conf paths
This commit is contained in:
parent
6eb84d1405
commit
6a6a0330ba
|
@ -45,73 +45,93 @@ build:
|
||||||
freedesktop.org/pkg-config: ^0.29
|
freedesktop.org/pkg-config: ^0.29
|
||||||
crates.io/semverator: '*'
|
crates.io/semverator: '*'
|
||||||
|
|
||||||
#TODO $libdir/_sysconfigdata__darwin_darwin.py contains non-relocatable paths
|
script:
|
||||||
script: |
|
# fixes the build scripts so they use the standard environment variables we set
|
||||||
sed -i.bak -e 's|system_lib_dirs = .*|system_lib_dirs = os.getenv("LIBRARY_PATH").split(":")|' ./setup.py
|
- |
|
||||||
sed -i.bak -e 's|system_include_dirs = .*|system_include_dirs = os.getenv("CPATH").split(":")|' ./setup.py
|
sed -i.bak -e 's|system_lib_dirs = .*|system_lib_dirs = os.getenv("LIBRARY_PATH").split(":")|' ./setup.py
|
||||||
|
sed -i.bak -e 's|system_include_dirs = .*|system_include_dirs = os.getenv("CPATH").split(":")|' ./setup.py
|
||||||
|
|
||||||
if semverator satisfies '<3.8' {{ version }}; then
|
# older versions use a different config dir
|
||||||
# older versions use a different config dir
|
- |
|
||||||
confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/')
|
if semverator satisfies '<3.8' {{ version }}; then
|
||||||
|
# older versions use a different config dir
|
||||||
|
confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/')
|
||||||
|
|
||||||
# 3.7 and older use `python3.7m` for include dir
|
# 3.7 and older use `python3.7m` for include dir
|
||||||
SUFFIX=m
|
SUFFIX=m
|
||||||
|
|
||||||
# 3.7 aborts on linux+aarch64 with this
|
# 3.7 aborts on linux+aarch64 with this
|
||||||
ARGS=${ARGS/--with-ensurepip/--without-ensurepip}
|
ARGS=${ARGS/--with-ensurepip/--without-ensurepip}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./configure $ARGS
|
- ./configure $ARGS
|
||||||
make --jobs {{ hw.concurrency }}
|
- make --jobs {{ hw.concurrency }}
|
||||||
make install
|
- make install
|
||||||
|
|
||||||
# customize `pip install` locations to tea defaults
|
# customize `pip install` locations to tea defaults
|
||||||
cp props/sitecustomize.py {{prefix}}/lib/python{{version.marketing}}
|
- cp props/sitecustomize.py {{prefix}}/lib/python{{version.marketing}}
|
||||||
|
|
||||||
# provide unversioned symlinks
|
# provide unversioned symlinks
|
||||||
cd {{prefix}}/bin
|
- run: |
|
||||||
for x in python idle pydoc; do
|
for x in python idle pydoc; do
|
||||||
ln -sf ${x}{{ version.marketing }} $x
|
ln -sf ${x}{{ version.marketing }} $x
|
||||||
done
|
done
|
||||||
ln -sf python{{ version.marketing }}-config python-config
|
ln -sf python{{ version.marketing }}-config python-config
|
||||||
|
working-directory: ${{prefix}}/bin
|
||||||
|
|
||||||
# we provide the binaries in a separate package
|
# we provide the binaries in a separate package
|
||||||
# but we don’t use --without-ensurepip because stuff expects python to
|
# but we don’t use --without-ensurepip because stuff expects python to
|
||||||
# come bundled with setuptools
|
# come bundled with setuptools
|
||||||
find . -mindepth 1 -maxdepth 1 -type f -name 'pip*' -exec rm {} \;
|
- run: find . -mindepth 1 -maxdepth 1 -type f -name 'pip*' -exec rm {} \;
|
||||||
|
working-directory: ${{prefix}}/bin
|
||||||
|
|
||||||
# make relocatable
|
# make relocatable
|
||||||
cd {{prefix}}
|
- run: |
|
||||||
for binfile in $shebangs $confdir/python-config.py; do
|
for binfile in $shebangs $confdir/python-config.py; do
|
||||||
if ! test -f $binfile; then
|
if ! test -f $binfile; then
|
||||||
binfile=${binfile/{{version.marketing}}/{{version.marketing}}$SUFFIX}
|
binfile=${binfile/{{version.marketing}}/{{version.marketing}}$SUFFIX}
|
||||||
fi
|
fi
|
||||||
if ! test -f $binfile; then
|
if ! test -f $binfile; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
binfile=$(readlink -f $binfile)
|
binfile=$(readlink -f $binfile)
|
||||||
sed -i.bak -e 's|#!{{ prefix }}/bin/|#!/usr/bin/env |g' $binfile
|
sed -i.bak -e 's|#!{{ prefix }}/bin/|#!/usr/bin/env |g' $binfile
|
||||||
rm $binfile.bak
|
rm $binfile.bak
|
||||||
done
|
done
|
||||||
|
|
||||||
sed -i.bak -e 's|{{ prefix }}|\\$(shell tea --prefix)/python.org/v{{version.major}}|g' $confdir/Makefile
|
sed -i.bak -e 's|{{ prefix }}|\\$(shell tea --prefix)/python.org/v{{version.major}}|g' $confdir/Makefile
|
||||||
rm $confdir/Makefile.bak
|
rm $confdir/Makefile.bak
|
||||||
|
working-directory: ${{prefix}}
|
||||||
|
|
||||||
|
- run:
|
||||||
|
cat $PROP >> _sysconfigdata__*.py
|
||||||
|
working-directory:
|
||||||
|
${{prefix}}/lib/python{{version.marketing}}
|
||||||
|
prop: |
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
tea_prefix = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../../../'))
|
||||||
|
for key in build_time_vars:
|
||||||
|
if isinstance(build_time_vars[key], str):
|
||||||
|
build_time_vars[key] = re.sub(r'(\s|^)/opt/', r'\g<1>{}/'.format(tea_prefix), build_time_vars[key])
|
||||||
|
|
||||||
# force pip to user-install mode without sudo
|
# force pip to user-install mode without sudo
|
||||||
ln -s /dev {{prefix}}/lib/python{{version.marketing}}/site-packages
|
- ln -s /dev {{prefix}}/lib/python{{version.marketing}}/site-packages
|
||||||
# ^^ probs nuts lol, but the below has repurcussions
|
# ^^ probs nuts lol, but the below has repurcussions
|
||||||
# chmod -w {{prefix}}/lib/python{{version.marketing}}
|
# chmod -w {{prefix}}/lib/python{{version.marketing}}
|
||||||
# ^^ makes rm -rf ~/.tea/python.org on macOS fail
|
# ^^ makes rm -rf ~/.tea/python.org on macOS fail
|
||||||
|
|
||||||
# some stuff expects python includes to be accessible without the prefix
|
# some stuff expects python includes to be accessible without the prefix
|
||||||
cd include
|
- run: |
|
||||||
mv python{{version.marketing}}$SUFFIX/* .
|
mv python{{version.marketing}}$SUFFIX/* .
|
||||||
rmdir python{{version.marketing}}$SUFFIX
|
rmdir python{{version.marketing}}$SUFFIX
|
||||||
ln -s . python{{version.marketing}}
|
ln -s . python{{version.marketing}}
|
||||||
# Keep the suffixed version if we started with one
|
# Keep the suffixed version if we started with one
|
||||||
if test -n "$SUFFIX"; then
|
if test -n "$SUFFIX"; then
|
||||||
ln -s . python{{version.marketing}}$SUFFIX
|
ln -s . python{{version.marketing}}$SUFFIX
|
||||||
fi
|
fi
|
||||||
|
working-directory: ${{prefix}}/include
|
||||||
|
|
||||||
env:
|
env:
|
||||||
ARGS:
|
ARGS:
|
||||||
|
@ -149,39 +169,53 @@ test:
|
||||||
dependencies:
|
dependencies:
|
||||||
tea.xyz/gx/cc: c99
|
tea.xyz/gx/cc: c99
|
||||||
crates.io/semverator: '*'
|
crates.io/semverator: '*'
|
||||||
script: |
|
script:
|
||||||
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
|
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
|
||||||
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
|
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
|
||||||
python -c "import sqlite3"
|
- python -c "import sqlite3"
|
||||||
|
|
||||||
# check to see if we can create a venv
|
# check to see if we can create a venv
|
||||||
# we can't ensurepip on 3.7 so, this won't work
|
# we can't ensurepip on 3.7 so, this won't work
|
||||||
if semverator satisfies '^3.8' {{ version }}; then
|
- |
|
||||||
python -m venv myvenv
|
if semverator satisfies '^3.8' {{ version }}; then
|
||||||
fi
|
python -m venv myvenv
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if some other modules import. Then the linked libs are working.
|
# Check if some other modules import. Then the linked libs are working.
|
||||||
python -c "import _ctypes"
|
- |
|
||||||
# python -c "import _decimal" #FIXME
|
python -c "import _ctypes"
|
||||||
python -c "import pyexpat"
|
# python -c "import _decimal" #FIXME
|
||||||
python -c "import zlib"
|
python -c "import pyexpat"
|
||||||
|
python -c "import zlib"
|
||||||
|
|
||||||
# Verify that the selected DBM interface works
|
# Verify that the selected DBM interface works
|
||||||
# FIXME: doen't work
|
# FIXME: doen't work
|
||||||
# python $FIXTURE
|
# - run:
|
||||||
|
# python $FIXTURE
|
||||||
|
# fixture: |
|
||||||
|
# import dbm
|
||||||
|
# with dbm.ndbm.open("test", "c") as db:
|
||||||
|
# db[b"foo \\xbd"] = b"bar \\xbd"
|
||||||
|
# with dbm.ndbm.open("test", "r") as db:
|
||||||
|
# assert list(db.keys()) == [b"foo \\xbd"]
|
||||||
|
# assert b"foo \\xbd" in db
|
||||||
|
# assert db[b"foo \\xbd"] == b"bar \\xbd"
|
||||||
|
|
||||||
if which -a pip | grep '{{ prefix }}'; then
|
- |
|
||||||
exit 1
|
if which -a pip | grep '{{ prefix }}'; then
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo '#include <Python.h>' > fixture.c
|
- run: |
|
||||||
echo '#include <python{{version.major}}.{{version.minor}}/Python.h>' >> fixture.c
|
mv $FIXTURE b.c
|
||||||
cc -c fixture.c
|
cc -c b.c
|
||||||
fixture: |
|
fixture: |
|
||||||
import dbm
|
#include <Python.h>
|
||||||
with dbm.ndbm.open("test", "c") as db:
|
#include <python{{version.major}}.{{version.minor}}/Python.h>
|
||||||
db[b"foo \\xbd"] = b"bar \\xbd"
|
|
||||||
with dbm.ndbm.open("test", "r") as db:
|
- run:
|
||||||
assert list(db.keys()) == [b"foo \\xbd"]
|
test $(python $FIXTURE) = {{prefix}}/include/python{{version.marketing}}
|
||||||
assert b"foo \\xbd" in db
|
fixture: |
|
||||||
assert db[b"foo \\xbd"] == b"bar \\xbd"
|
import sysconfig
|
||||||
|
include_path = sysconfig.get_paths()['include']
|
||||||
|
print(include_path)
|
||||||
|
|
Loading…
Reference in a new issue