2022-08-02 14:03:17 +03:00
|
|
|
|
distributable:
|
2023-01-02 19:24:33 +03:00
|
|
|
|
url: https://www.python.org/ftp/python/{{ version.raw }}/Python-{{ version.raw }}.tar.xz
|
2022-08-02 14:03:17 +03:00
|
|
|
|
strip-components: 1
|
|
|
|
|
|
|
|
|
|
versions:
|
|
|
|
|
github: python/cpython/tags
|
|
|
|
|
|
2022-10-30 17:32:32 +03:00
|
|
|
|
companions:
|
|
|
|
|
pip.pypa.io: '*'
|
|
|
|
|
|
2023-01-02 19:24:33 +03:00
|
|
|
|
unpackaged:
|
|
|
|
|
- version: ^2
|
|
|
|
|
platform: darwin
|
|
|
|
|
arch: aarc64
|
|
|
|
|
reason: help-wanted
|
|
|
|
|
|
2022-09-08 23:40:35 +03:00
|
|
|
|
provides:
|
|
|
|
|
- bin/python
|
2023-03-26 21:36:43 +03:00
|
|
|
|
- bin/python{{ version.major }}
|
|
|
|
|
- bin/python{{ version.marketing }}
|
2022-09-08 23:40:35 +03:00
|
|
|
|
|
2022-11-25 19:03:11 +03:00
|
|
|
|
interprets:
|
|
|
|
|
extensions: py
|
|
|
|
|
args: python
|
|
|
|
|
|
2022-08-02 14:03:17 +03:00
|
|
|
|
dependencies:
|
2022-10-30 17:32:32 +03:00
|
|
|
|
# recommended (but none are actually required)
|
2022-08-03 21:27:08 +03:00
|
|
|
|
zlib.net: 1
|
2022-08-05 04:19:01 +03:00
|
|
|
|
sourceware.org/bzip2: 1
|
|
|
|
|
openssl.org: ^1.1
|
|
|
|
|
sourceware.org/libffi: 3
|
|
|
|
|
libexpat.github.io: 2
|
|
|
|
|
bytereef.org/mpdecimal: 2
|
|
|
|
|
tukaani.org/xz: 5
|
|
|
|
|
sqlite.org: 3
|
|
|
|
|
gnu.org/readline: 8
|
|
|
|
|
invisible-island.net/ncurses: 6
|
2023-03-27 18:57:59 +03:00
|
|
|
|
# linux:
|
|
|
|
|
# oracle.com/berkeley-db: 18
|
2022-08-02 14:03:17 +03:00
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
|
dependencies:
|
|
|
|
|
tea.xyz/gx/cc: c99
|
|
|
|
|
tea.xyz/gx/make: '*'
|
2022-08-05 04:19:01 +03:00
|
|
|
|
freedesktop.org/pkg-config: ^0.29
|
2023-03-14 02:58:22 +03:00
|
|
|
|
crates.io/semverator: '*'
|
2022-08-05 04:19:01 +03:00
|
|
|
|
|
2022-09-08 23:40:35 +03:00
|
|
|
|
#TODO $libdir/_sysconfigdata__darwin_darwin.py contains non-relocatable paths
|
2022-08-02 14:03:17 +03:00
|
|
|
|
script: |
|
2022-08-03 21:27:08 +03:00
|
|
|
|
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
|
|
|
|
|
|
2022-08-02 14:03:17 +03:00
|
|
|
|
./configure $ARGS
|
|
|
|
|
make --jobs {{ hw.concurrency }}
|
|
|
|
|
make install
|
2022-08-05 23:22:53 +03:00
|
|
|
|
|
2023-03-18 16:12:16 +03:00
|
|
|
|
# customize `pip install` locations to tea defaults
|
|
|
|
|
cp props/sitecustomize.py {{prefix}}/lib/python{{version.marketing}}
|
|
|
|
|
|
2022-09-08 23:40:35 +03:00
|
|
|
|
# provide unversioned symlinks
|
|
|
|
|
cd {{prefix}}/bin
|
2022-10-27 07:36:26 +03:00
|
|
|
|
for x in python idle pydoc; do
|
2022-09-08 23:40:35 +03:00
|
|
|
|
ln -sf ${x}{{ version.marketing }} $x
|
|
|
|
|
done
|
2022-08-05 23:22:53 +03:00
|
|
|
|
ln -sf python{{ version.marketing }}-config python-config
|
2022-09-08 23:40:35 +03:00
|
|
|
|
|
2023-03-18 16:12:16 +03:00
|
|
|
|
# we provide the binaries in a separate package
|
|
|
|
|
# but we don’t use --without-ensurepip because stuff expects python to
|
|
|
|
|
# come bundled with setuptools
|
|
|
|
|
rm pip*
|
|
|
|
|
|
2023-03-14 02:58:22 +03:00
|
|
|
|
# older versions use a different config dir
|
|
|
|
|
if semverator satisfies '<3.8' {{ version }}; then
|
|
|
|
|
confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/')
|
|
|
|
|
fi
|
|
|
|
|
|
2022-09-08 23:40:35 +03:00
|
|
|
|
# make relocatable
|
|
|
|
|
cd {{prefix}}
|
|
|
|
|
for binfile in $shebangs $confdir/python-config.py; do
|
2023-03-14 02:58:22 +03:00
|
|
|
|
binfile=$(readlink -f $binfile)
|
2022-09-08 23:40:35 +03:00
|
|
|
|
sed -i.bak -e 's|#!{{ prefix }}/bin/|#!/usr/bin/env |g' $binfile
|
|
|
|
|
rm $binfile.bak
|
|
|
|
|
done
|
|
|
|
|
|
2022-09-25 16:06:15 +03:00
|
|
|
|
sed -i.bak -e 's|{{ prefix }}|\\$(shell tea --prefix)/python.org/v{{version.major}}|g' $confdir/Makefile
|
2022-09-08 23:40:35 +03:00
|
|
|
|
rm $confdir/Makefile.bak
|
2022-08-02 14:03:17 +03:00
|
|
|
|
|
2023-03-20 16:10:55 +03:00
|
|
|
|
# force pip to user-install mode without sudo
|
|
|
|
|
ln -s /dev {{prefix}}/lib/python{{version.marketing}}/site-packages
|
|
|
|
|
# ^^ probs nuts lol, but the below has repurcussions
|
|
|
|
|
# chmod -w {{prefix}}/lib/python{{version.marketing}}
|
|
|
|
|
# ^^ makes rm -rf ~/.tea/python.org on macOS fail
|
|
|
|
|
|
2023-03-23 15:51:59 +03:00
|
|
|
|
# some stuff expects python includes to be accessible without the prefix
|
|
|
|
|
cd include
|
|
|
|
|
mv python{{version.marketing}}/* .
|
|
|
|
|
rmdir python{{version.marketing}}
|
|
|
|
|
ln -s . python{{version.marketing}}
|
|
|
|
|
|
2022-08-02 14:03:17 +03:00
|
|
|
|
env:
|
|
|
|
|
ARGS:
|
|
|
|
|
- --prefix="{{ prefix }}"
|
2023-03-20 16:10:55 +03:00
|
|
|
|
- --with-ensurepip
|
2022-08-02 14:03:17 +03:00
|
|
|
|
- --enable-ipv6
|
|
|
|
|
- --disable-loadable-sqlite-extensions
|
|
|
|
|
- --with-system-expat
|
|
|
|
|
- --with-system-ffi
|
|
|
|
|
- --with-system-libmpdec
|
2023-03-17 15:56:10 +03:00
|
|
|
|
# - --enable-optimizations # fails due to clang/llvm pkging bug on Linux
|
|
|
|
|
# - --with-lto # fails on linux/aarch64
|
2022-08-02 14:03:17 +03:00
|
|
|
|
- --enable-shared
|
2022-09-08 23:40:35 +03:00
|
|
|
|
libdir:
|
|
|
|
|
lib/python{{version.marketing}}
|
|
|
|
|
darwin:
|
|
|
|
|
confdir:
|
|
|
|
|
$libdir/config-{{version.marketing}}-darwin
|
|
|
|
|
linux:
|
2023-03-27 18:57:59 +03:00
|
|
|
|
# ARGS:
|
|
|
|
|
# - --with-dbmliborder=bdb
|
2022-09-08 23:40:35 +03:00
|
|
|
|
ARCH: ${{hw.arch}}
|
|
|
|
|
confdir:
|
|
|
|
|
$libdir/config-{{version.marketing}}-${ARCH/-/_}-linux-gnu
|
|
|
|
|
shebangs:
|
|
|
|
|
- bin/2to3-{{version.marketing}}
|
|
|
|
|
- bin/idle{{version.marketing}}
|
|
|
|
|
- bin/pydoc{{version.marketing}}
|
|
|
|
|
- bin/python{{version.marketing}}-config
|
2022-08-10 21:58:22 +03:00
|
|
|
|
|
2022-09-25 16:06:15 +03:00
|
|
|
|
OPENSSL_INCLUDES: ${{ deps.openssl.org.prefix }}/include
|
|
|
|
|
OPENSSL_LDFLAGS: -L{{ deps.openssl.org.prefix }}/lib
|
2022-08-10 21:58:22 +03:00
|
|
|
|
|
2022-08-02 14:03:17 +03:00
|
|
|
|
test:
|
2023-03-23 15:51:59 +03:00
|
|
|
|
dependencies:
|
|
|
|
|
tea.xyz/gx/cc: c99
|
2022-08-05 23:22:53 +03:00
|
|
|
|
script: |
|
2023-03-18 16:12:16 +03:00
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
# Check if some other modules import. Then the linked libs are working.
|
|
|
|
|
python -c "import _ctypes"
|
|
|
|
|
# python -c "import _decimal" #FIXME
|
|
|
|
|
python -c "import pyexpat"
|
|
|
|
|
python -c "import zlib"
|
|
|
|
|
|
|
|
|
|
# Verify that the selected DBM interface works
|
2023-03-27 18:57:59 +03:00
|
|
|
|
# FIXME: doen't work
|
|
|
|
|
# python $FIXTURE
|
2023-03-18 16:12:16 +03:00
|
|
|
|
|
2023-03-23 23:32:12 +03:00
|
|
|
|
if which -a pip | grep '{{ prefix }}'; then
|
2023-03-18 16:12:16 +03:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2023-03-23 15:51:59 +03:00
|
|
|
|
|
|
|
|
|
echo '#include <Python.h>' > fixture.c
|
|
|
|
|
echo '#include <python{{version.major}}.{{version.minor}}/Python.h>' >> fixture.c
|
|
|
|
|
cc -c fixture.c
|
2023-03-18 16:12:16 +03:00
|
|
|
|
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"
|