pantry/projects/python.org/package.yml

136 lines
4 KiB
YAML
Raw Normal View History

2022-08-02 14:03:17 +03:00
distributable:
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: '*'
unpackaged:
- version: ^2
platform: darwin
arch: aarc64
reason: help-wanted
2022-09-08 23:40:35 +03:00
provides:
- bin/python
- bin/python{{version.major}}
- bin/python{{version.marketing}}
2022-09-08 23:40:35 +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)
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
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
#TODO use the diff
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: |
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-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
ln -sf python{{ version.marketing }}-config python-config
2022-09-08 23:40:35 +03:00
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
env:
ARGS:
- --prefix="{{ prefix }}"
# its 202x
- --enable-ipv6
# prevent auto updates -> we control that
2022-10-27 07:36:26 +03:00
- --without-ensurepip
2022-08-02 14:03:17 +03:00
- --disable-loadable-sqlite-extensions
# use our libraries not the bundled ones
- --with-system-expat
- --with-system-ffi
- --with-system-libmpdec
# these two make our binary not portable
#- --enable-optimizations
#- --with-lto
2022-08-31 21:05:21 +03:00
# on macOS we want an option that is instead --enable-framework
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:
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
# required for `setup.py` which is used to detect the libs for pythons modules
2022-08-05 04:19:01 +03:00
diff: |
diff --git a/setup.py b/setup.py
index 85a2b26..4f2f742 100644
--- a/setup.py
+++ b/setup.py
@@ -847,8 +847,8 @@ class PyBuildExt(build_ext):
add_dir_to_list(self.compiler.include_dirs,
sysconfig.get_config_var("INCLUDEDIR"))
- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib']
- system_include_dirs = ['/usr/include']
+ system_lib_dirs = os.getenv("LIBRARY_PATH").split(":")
+ system_include_dirs = os.getenv("CPATH").split(":")
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
2022-08-02 14:03:17 +03:00
test:
#TODO test all modules eg zlib module
script: |
2022-08-02 14:03:17 +03:00
python --version