From 446534afbeba84ad45c04502de9786ab8b86aa68 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Fri, 16 Jun 2023 15:51:31 -0400 Subject: [PATCH] +python2 (#2126) * +python2 * at least a few tests working * clean up semverator dep --- projects/python.org/package.yml | 65 ++++++++++++++++++++-------- projects/python.org/sitecustomize.py | 6 +-- 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/projects/python.org/package.yml b/projects/python.org/package.yml index 541c9ab6..cfb4c3e1 100644 --- a/projects/python.org/package.yml +++ b/projects/python.org/package.yml @@ -43,18 +43,31 @@ build: tea.xyz/gx/cc: c99 tea.xyz/gx/make: '*' freedesktop.org/pkg-config: ^0.29 - crates.io/semverator: '*' - + gnu.org/patch: '*' + curl.se: '*' script: + # MacPorts has a series of patches to keep python2 working + - run: | + for PATCH in $PYTHON2PATCHES; do + curl -sSL $PATCH | patch -p0 + done + if: ^2 + # 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 # older versions use a different config dir - - | - if semverator satisfies '<3.8' {{ version }}; then - # older versions use a different config dir + - run: | + confdir="$libdir/config" + + # aarch64 not happy with this + ARGS=${ARGS/--with-ensurepip/--without-ensurepip} + if: ^2 + + # 3.7 and older use `3.7m` for config dir + - run: | confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/') # 3.7 and older use `python3.7m` for include dir @@ -62,7 +75,7 @@ build: # 3.7 aborts on linux+aarch64 with this ARGS=${ARGS/--with-ensurepip/--without-ensurepip} - fi + if: '>=3<3.8' - ./configure $ARGS - make --jobs {{ hw.concurrency }} @@ -150,6 +163,8 @@ build: darwin: confdir: $libdir/config-{{version.marketing}}-darwin + PYTHON2PATCHES: + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-getpath.diff linux: # ARGS: # - --with-dbmliborder=bdb @@ -164,6 +179,19 @@ build: OPENSSL_INCLUDES: ${{ deps.openssl.org.prefix }}/include OPENSSL_LDFLAGS: -L{{ deps.openssl.org.prefix }}/lib + PYTHON2PATCHES: + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-Makefile.pre.in.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-setup.py.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-Lib-cgi.py.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-Lib-ctypes-macholib-dyld.py.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-configure.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-libedit.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/enable-loadable-sqlite-extensions.patch + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/patch-_osx_support.py.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/darwin20.diff + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/arm.patch + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/implicit.patch + - https://raw.githubusercontent.com/macports/macports-ports/master/lang/python27/files/openssl_ver.patch test: dependencies: @@ -172,21 +200,24 @@ test: 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" + - run: python -c "import sqlite3" + # FIXME: v2 + if: ^3 # check to see if we can create a venv # we can't ensurepip on 3.7 so, this won't work - - | - if semverator satisfies '^3.8' {{ version }}; then - python -m venv myvenv - fi + - run: python -m venv myvenv + if: ^3.8 # 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" + - run: | + python -v -c "import _ctypes" + # python -c "import _decimal" #FIXME + python -c "import zlib" + # FIXME: v2 + if: ^3 + + - python -c "import pyexpat" # Verify that the selected DBM interface works # FIXME: doen't work @@ -214,7 +245,7 @@ test: #include - run: | - if semverator satisfies '<3.8' {{ version }}; then + if semverator satisfies '>=3<3.8' {{ version }}; then SUFFIX=m fi test $(python $FIXTURE) = {{prefix}}/include/python{{version.marketing}}$SUFFIX diff --git a/projects/python.org/sitecustomize.py b/projects/python.org/sitecustomize.py index cbceeaec..f122b345 100644 --- a/projects/python.org/sitecustomize.py +++ b/projects/python.org/sitecustomize.py @@ -1,13 +1,13 @@ import site import sys -# tea considers /usr/local the “global install” location +# tea considers /usr/local the "global install" location # setting `sys.prefix` is kinda nuts but brew does the same -# so we’re assuming they vetted all options +# so we're assuming they vetted all options # sys.prefix = "/usr/local" # ^^ undid this because it broke `python -m venv` installing pip for some reason # enable automatic user installs if pip makes the decision -# that this is good idea. eg. if /usr/local isn’t writable +# that this is good idea. eg. if /usr/local isn't writable # this is what it will do site.ENABLE_USER_SITE = True