fix(python) (#2435)

* fix(python)

fixes older versions

* fixes for 3.9

* fixes for 3.8

* fixes for 3.7

* simpler if versions

* fixes 3.6

* fixes 3.5

* fix 3.4

* exclude non-working tests

* stop at 3.2.4 (Apr 6, 2013)
This commit is contained in:
Jacob Heider 2023-07-07 18:37:32 -04:00 committed by GitHub
parent b6361963ec
commit 43fe64cfe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 10 deletions

View file

@ -4,6 +4,11 @@ distributable:
versions:
github: python/cpython/tags
# FIXME maybe? This is pretty good, and darwin+aarch64 support could be
# suspect even further back.
ignore:
- 3.2.[0-3]
- 3.[0-1].x
companions:
pip.pypa.io: '*'
@ -77,6 +82,43 @@ build:
ARGS=${ARGS/--with-ensurepip/--without-ensurepip}
if: '>=3<3.8'
# 3.5 and older don't append the platform to confdir on darwin
- run: confdir="${confdir%-{{hw.platform}}}"
if: '>=3<3.6'
# Older patches have configure issues that aren't present in newer patches
- run: |
if test "{{hw.platform}}" = "darwin"; then
sed -i.bak \
-e 's/ppc)/arm64)/g' \
-e 's/MACOSX_DEFAULT_ARCH="ppc.*$/MACOSX_DEFAULT_ARCH="arm64"/g' \
configure
rm configure.bak
fi
if: '>=3<3.9.1'
- run: |
if test "{{hw.platform}}" = "darwin"; then
sed -i.bak -e 's/^MULTIARCH=.*$/MULTIARCH=""/' configure
rm configure.bak
fi
if: '>=3<3.10.1'
# Some old versions don't support macOS 11 and greater in their configures
- run: |
if test "{{hw.platform}}" = "darwin"; then
curl -L https://github.com/python/cpython/commit/8ea6353.patch | patch -p1
fi
if: '>=3.8<3.8.4 || >=3<3.7.8'
# Versions older than 3.5.3 have an include issue on darwin
- run: patch -p1 < props/patch3.5.diff
if: '>=3.5<3.5.3'
# Whitespace difference in 3.4...
- run: patch -p1 < props/patch3.4.diff
if: '~3.4.1'
- ./configure $ARGS
- make --jobs {{ hw.concurrency }}
- make install
@ -196,13 +238,12 @@ 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.
- run: python -c "import sqlite3"
# FIXME: v2
if: ^3
# FIXME: v2, <v3.7
if: ^3.7
# check to see if we can create a venv
# we can't ensurepip on 3.7 so, this won't work
@ -214,8 +255,8 @@ test:
python -v -c "import _ctypes"
# python -c "import _decimal" #FIXME
python -c "import zlib"
# FIXME: v2
if: ^3
# FIXME: v2, <=3.6.4
if: ^3.6.4
- python -c "import pyexpat"
@ -244,11 +285,10 @@ test:
#include <Python.h>
#include <python{{version.major}}.{{version.minor}}/Python.h>
- run: |
if semverator satisfies '>=3<3.8' {{ version }}; then
SUFFIX=m
fi
test $(python $FIXTURE) = {{prefix}}/include/python{{version.marketing}}$SUFFIX
- run: SUFFIX=m
if: '>=3<3.8'
- run: test $(python $FIXTURE) = {{prefix}}/include/python{{version.marketing}}$SUFFIX
fixture: |
import sysconfig
include_path = sysconfig.get_paths()['include']

View file

@ -0,0 +1,14 @@
diff --git a/Python/random.c b/Python/random.c
index 93d300d..396041d 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -3,6 +3,9 @@
#include <windows.h>
#else
#include <fcntl.h>
+#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)
+#include <sys/random.h>
+#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif

View file

@ -0,0 +1,14 @@
diff --git a/Python/random.c b/Python/random.c
index 93d300d..396041d 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -3,6 +3,9 @@
# include <windows.h>
#else
# include <fcntl.h>
+# if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)
+# include <sys/random.h>
+# endif
# ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
# endif