fix(python3.7)

This commit is contained in:
Jacob Heider 2023-04-21 03:30:10 -04:00
parent 2de4c6558e
commit 43662c24d6
No known key found for this signature in database
GPG key ID: 59D15ADC7DCD39BB

View file

@ -50,6 +50,17 @@ build:
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
confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/')
# 3.7 and older use `python3.7m` for include dir
SUFFIX=m
# 3.7 aborts on linux+aarch64 with this
ARGS=${ARGS/--with-ensurepip/--without-ensurepip}
fi
./configure $ARGS
make --jobs {{ hw.concurrency }}
make install
@ -67,18 +78,17 @@ build:
# we provide the binaries in a separate package
# but we dont use --without-ensurepip because stuff expects python to
# come bundled with setuptools
rm pip*
# older versions use a different config dir
if semverator satisfies '<3.8' {{ version }}; then
confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/')
# 3.7 and older use `python3.7m` for include dir
SUFFIX=m
fi
find . -mindepth 1 -maxdepth 1 -type f -name 'pip*' -exec rm {} \;
# make relocatable
cd {{prefix}}
for binfile in $shebangs $confdir/python-config.py; do
if ! test -f $binfile; then
binfile=${binfile/{{version.marketing}}/{{version.marketing}}$SUFFIX}
fi
if ! test -f $binfile; then
continue
fi
binfile=$(readlink -f $binfile)
sed -i.bak -e 's|#!{{ prefix }}/bin/|#!/usr/bin/env |g' $binfile
rm $binfile.bak
@ -138,13 +148,17 @@ build:
test:
dependencies:
tea.xyz/gx/cc: c99
crates.io/semverator: '*'
script: |
# 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.
python -c "import sqlite3"
# check to see if we can create a venv
python -m venv myvenv
# we can't ensurepip on 3.7 so, this won't work
if semverator satisfies '^3.8' {{ version }}; then
python -m venv myvenv
fi
# Check if some other modules import. Then the linked libs are working.
python -c "import _ctypes"