From 58d57c724f2844daaa68f3392d12208da76e1ccc Mon Sep 17 00:00:00 2001 From: dumol <1620933+dumol@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:30:36 +0300 Subject: [PATCH] Python 3.10 update. (#39) * Only build generic Linux packages. * Only build x64 Windows packages. * Try with cryptography 39.0.2 wheels. * Retry Windows matrix. * Use linux instead of lnx for Linux packages. * Use latest OpenSSL 1.1.1 sources for Python's ssl module. * Check for cryptography's OpenSSL version everywhere. * Fixed cryptography's OpenSSL version to check for. * Try fixing Safety errors. * Updated all Python modules to latest version. * Try building on CentOS 6.10. * Disable OpenSSL tests for now. * Updated macOS deps. * Try CentOS 7. * Revert "Try CentOS 7." This reverts commit 861817cc8edd808362329312e9c319f6e868b837. * Revert "Try building on CentOS 6.10." This reverts commit 9d2551e2590f3f3db22454650cf460af80b10681. * Use a get-pip.py that still works on CentOS 5. * Build the generic Linux version on Ubuntu 18.04. * Forward port the latest cleanups from python-package. * Also clean up on Windows. * Put include/ back after packing the distributable. * Also remove ssl/ if found, e.g. on macOS. * Re-enabled OpenSSL 1.1.x self tests. * Re-enabled x86 Windows build. * Run the macOS build from the beginning. * Changes after own review. * Removed subprocess32. * Python 3.10. * Updated libffi to version 3.4.4. * Run the checks in all PRs. * Updated Python version patching. * Disabled readline for macOS too. * Updated xz and SQLite to latest versions. * Changes after own review. * One small correction in a comment. * Updated cryptography to newly-released 40.0.1. * Updated OpenSSL version to check for. * Check for cffi module too. * Build and check for PyNaCl module. * Syntax fix for cffi check. * Collect PyNaCl when building. * Added charset-normalizer, markupsafe, pywin32. * Update src/chevah-python-test/test_python_binary_dist.py * Enable debug * Apply suggestions from code review * Update src/Python-Windows/chevahbs * Update src/Python-Windows/chevahbs * fix 3.10 path * Update src/Python-Windows/chevahbs * enable debug * Update src/Python-Windows/chevahbs * Update test_python_binary_dist.py * Apply suggestions from code review * Apply suggestions from code review * Update .github/workflows/bare.yaml * Update src/Python-Windows/chevahbs * The -3 check is no longer needed. * Removed Windows matrix from bare workflow. * Renamed docker workflow job. * Updated Python to version 3.10.11. * Updated Python to version 3.10.11 (bis). * Actually remove the build path for 32bit Windows packages. * Document why MarkupSafe is pinned to an older version. * Try -latest in the bare workflow. * Better document supported Linux distributions. * Build generic Linux on Amazon 2 with glibc 2.26. * Lower case yum parameter. * Use gcc 10.4 instead of 7.2 for building the generic Linux package. * Link gcc 10.4 in the default path. * Back to using gcc 7.2 on Amazon Linux 2. * Try building an ARM64 package. * Try building an ARM64 package, take 2. * Removed ARM64 job. * Try building on Apple Silicon. * Removed third-party action from the macos-m1 job. * Replaced third-party action with out fork for the other jobs. * Changes after own review. --------- Co-authored-by: Adi Roiban --- .github/workflows/bare.yaml | 43 +- .github/workflows/docker.yaml | 15 +- README.rst | 9 +- build.conf | 29 +- functions_build.sh | 2 +- os_quirks.sh | 5 +- pythia.sh | 30 +- src/Python-Windows/chevahbs | 8 +- src/Python-Windows/sha512.sum | 3 +- src/Python/chevahbs | 2 +- src/Python/disabled_modules.patch | 15 +- src/Python/readline_libedit.patch | 985 ------------------ src/Python/sha512.sum | 2 +- .../test_python_binary_dist.py | 63 +- src/libffi/sha512.sum | 2 +- src/sqlite-autoconf/chevahbs | 2 +- src/sqlite-autoconf/sha512.sum | 2 +- src/xz/sha512.sum | 2 +- 18 files changed, 151 insertions(+), 1068 deletions(-) delete mode 100644 src/Python/readline_libedit.patch diff --git a/.github/workflows/bare.yaml b/.github/workflows/bare.yaml index 57505ccf..784bcb5f 100644 --- a/.github/workflows/bare.yaml +++ b/.github/workflows/bare.yaml @@ -2,18 +2,13 @@ # GitHub actions for building and testing on bare hardware. # Typically, Windows and macOS builds are done this way. # Look for the Linux builds in the "docker" workflow. -# -# Don't use `-latest` for runners, pin specific OS versions instead. More at -# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners. name: Bare on: push: branches: [ main ] - pull_request: - branches: [ main ] concurrency: group: bare-${{ github.ref }} @@ -30,13 +25,7 @@ env: jobs: windows: # The type of runner that the job will run on - runs-on: ${{ matrix.runs-on }} - if: github.event.inputs.job == '' || github.event.inputs.job == 'windows' - strategy: - # Workflow won't be cancelled at the first failed job. - fail-fast: false - matrix: - runs-on: [ windows-2022, windows-2019 ] + runs-on: windows-latest timeout-minutes: 15 # Steps represent a sequence of tasks that will be executed as part of the job @@ -74,7 +63,7 @@ jobs: # Command line debugging through Tmate. v3 works on Windows too. - name: Tmate debug on failure if: failure() && env.TMATE_DEBUG == 'yes' - uses: mxschmitt/action-tmate@v3 + uses: chevah/action-tmate@v3 with: limit-access-to-actor: true @@ -97,7 +86,7 @@ jobs: macos: - runs-on: macos-10.15 + runs-on: macos-latest timeout-minutes: 30 steps: - uses: actions/checkout@v2 @@ -137,6 +126,30 @@ jobs: - name: Tmate debug on failure if: failure() && env.TMATE_DEBUG == 'yes' - uses: mxschmitt/action-tmate@v3 + uses: chevah/action-tmate@v3 with: limit-access-to-actor: true + + + macos-m1: + runs-on: m1 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Build Pythia + run: ./build.sh build + + - name: Test Pythia + run: ./build.sh test + + - name: Upload testing package + run: | + mkdir -pv ~/.ssh/ + touch priv_key + chmod 600 priv_key + echo "${{ secrets.SFTPPLUS_BIN_PRIV_KEY }}" > priv_key + echo "${{ secrets.SFTPPLUS_BIN_HOST_KEY }}" > ~/.ssh/known_hosts + ./publish_dist.sh ; rm priv_key diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 2c961e47..35df6323 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -10,7 +10,6 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] concurrency: group: docker-${{ github.ref }} @@ -24,14 +23,14 @@ env: # Using a job name that doesn't contain the OS name, to minimize the risk of # confusion with the OS names of the containers, which are the relevant ones. jobs: - latest: + linux: runs-on: ubuntu-latest container: ${{ matrix.container }} strategy: fail-fast: false matrix: - # Alpine 3.12 has musl 1.1.24, Ubuntu 18.04 has glibc 2.27. - container: [ 'alpine:3.12', 'ubuntu:18.04' ] + # Alpine 3.12 has musl 1.1.24, Amazon 2 has glibc 2.26. + container: [ 'alpine:3.12', 'amazonlinux:2' ] timeout-minutes: 30 steps: @@ -45,6 +44,12 @@ jobs: curl --output /usr/local/bin/paxctl https://bin.chevah.com:20443/third-party-stuff/alpine/paxctl-3.12 chmod +x /usr/local/bin/paxctl + - name: Amazon setup + if: startsWith(matrix.container, 'amazonlinux') + run: | + yum -y upgrade + yum -y install git-core gcc make m4 patch tar unzip perl perl-Test-Simple + - name: Ubuntu setup if: startsWith(matrix.container, 'ubuntu') run: | @@ -84,7 +89,7 @@ jobs: # Not working on Alpine (not supported) and CentOS 5 (glibc too old). - name: Tmate debug on failure if: failure() && env.TMATE_DEBUG == 'yes' - uses: mxschmitt/action-tmate@v3 + uses: chevah/action-tmate@v3 with: sudo: false limit-access-to-actor: true diff --git a/README.rst b/README.rst index a227cb17..f55ff796 100644 --- a/README.rst +++ b/README.rst @@ -21,13 +21,16 @@ Note that compat tests are currently only working on the ``python2.7`` branch. Supported platforms ------------------- -* Windows Server 2012 R2 and newer (x86 and x64) -* macOS 10.13 and newer (Intel Macs only) -* all glibc-based Linux distributions (glibc 2.17+) +* Windows Server 2012 R2 and newer +* macOS 10.13 and newer (both Intel and Apple Silicon) +* Red Hat Enterprise Linux 8 and newer (including clones) +* Ubuntu 18.04 LTS and newer +* Amazon Linux 2 and newer * Alpine Linux 3.12 and newer. Platforms that should work, but are not regularly tested: +* all glibc-based Linux distributions (glibc 2.26+) * all musl-based Linux distributions (musl 1.1.24+) * FreeBSD 12 and newer * OpenBSD 6.7 and newer diff --git a/build.conf b/build.conf index 99bf583e..42266944 100644 --- a/build.conf +++ b/build.conf @@ -5,30 +5,40 @@ BUILD_DIR="build" DIST_DIR="dist" # Python and lib versions. -PYTHON_BUILD_VERSION="3.8.6" -LIBFFI_VERSION="3.4.2" +PYTHON_BUILD_VERSION="3.10.11" +LIBFFI_VERSION="3.4.4" ZLIB_VERSION="1.2.13" BZIP2_VERSION="1.0.8" -XZ_VERSION="5.2.5" +XZ_VERSION="5.4.1" # Statically build the BSD libedit on selected platforms to get the # readline module available without linking to the GPL-only readline libs. +# If there's a need to reenable this, our libedit patch for Python 3.9 was +# https://github.com/chevah/pythia/pull/5/commits/09c128154d23feb6b1a7cb5a8d79. +# A newer patch is available at https://github.com/python/cpython/issues/57710. LIBEDIT_VERSION="20170329-3.1" OPENSSL_VERSION="1.1.1t" # To match the unusual naming scheme for SQLite downloads, eliminate dots from -# the regular SQLite version, then add 3 zeros. E.g. "3.33.0" -> "3330000". +# the regular version, then add zeros where missing. E.g. "3.41.1" -> "3410100". # When updating this, also update the year in src/sqlite/chevahbs, if needed. -SQLITE_VERSION="3380300" +# To check for a SHA3-256 signature: openssl dgst -sha3-256 file.tar.gz. +SQLITE_VERSION="3410100" # These are used by get-pip.py. PIP_VERSION="23.0.1" -SETUPTOOLS_VERSION="67.6.0" +SETUPTOOLS_VERSION="67.6.1" # Python modules versions to be used everywhere possible. # Latest cryptography/bcrypt require Rust, use only wheels for them. CFFI_VERSION="1.15.1" -CRYPTOGRAPHY_VERSION="39.0.2" +CRYPTOGRAPHY_VERSION="40.0.1" +PYNACL_VERSION="1.5.0" BCRYPT_VERSION="4.0.1" PSUTIL_VERSION="5.9.4" SETPROCTITLE_VERSION="1.3.2" +# Version 1.1.1 pinned since it works on both py2 and py3. +MARKUPSAFE_VERSION="1.1.1" +# Version 2.0.11 pinned since it works on both py2 and py3. +CHARSETNORMALIZER_VERSION="2.0.11" +PYWIN32_VERSION="306" # pycparser is explicitly installed to work around setuptools auto dependencies. PYCPARSER_VERSION="2.21" @@ -41,7 +51,7 @@ BUILD_LIBFFI="no" BUILD_ZLIB="no" BUILD_BZIP2="yes" BUILD_XZ="no" -BUILD_LIBEDIT="yes" +BUILD_LIBEDIT="no" BUILD_OPENSSL="no" BUILD_SQLITE="yes" @@ -49,9 +59,12 @@ BUILD_SQLITE="yes" PIP_LIBRARIES="\ cffi==${CFFI_VERSION} \ cryptography==${CRYPTOGRAPHY_VERSION} \ + PyNaCl==${PYNACL_VERSION} \ bcrypt==${BCRYPT_VERSION} \ psutil==${PSUTIL_VERSION} \ setproctitle==${SETPROCTITLE_VERSION} + MarkupSafe==${MARKUPSAFE_VERSION} \ + charset-normalizer==${CHARSETNORMALIZER_VERSION} \ " PIP_ARGS="\ --index-url=${PIP_INDEX_URL} \ diff --git a/functions_build.sh b/functions_build.sh index 5951eb9d..7aa37128 100644 --- a/functions_build.sh +++ b/functions_build.sh @@ -66,7 +66,7 @@ download_sources(){ echo "## Unpacking archive ${archive_filename}... ##" execute $ZIP_CMD "$archive_filename" -d ../../build/ ;; - exe|amd64*|win32*) + exe|amd64*) # No need to use ../../build/"$project_name"-"$project_ver"/ here. echo " Nothing to unpack in build/ for ${archive_filename}." ;; diff --git a/os_quirks.sh b/os_quirks.sh index f8aba3f1..9299848b 100644 --- a/os_quirks.sh +++ b/os_quirks.sh @@ -13,8 +13,10 @@ case $OS in # But not all are from pypi.org. Wheels copied from other places: # * "setproctitle" from https://www.lfd.uci.edu/~gohlke/pythonlibs/ export BUILD_BZIP2="no" - export BUILD_LIBEDIT="no" export BUILD_SQLITE="no" + PIP_LIBRARIES="$PIP_LIBRARIES \ + pywin32==${PYWIN32_VERSION} \ + " # On Windows, only one of the installers is downloaded. export SHA_CMD="$SHA_CMD --ignore-missing" ;; @@ -32,7 +34,6 @@ case $OS in export BUILD_LIBFFI="yes" export BUILD_ZLIB="yes" export BUILD_XZ="yes" - export BUILD_LIBEDIT="no" export BUILD_OPENSSL="yes" ;; macos) diff --git a/pythia.sh b/pythia.sh index f38635c9..25f96ba4 100755 --- a/pythia.sh +++ b/pythia.sh @@ -86,7 +86,7 @@ ARCH='not-detected-yet' PYTHON_CONFIGURATION='NOT-YET-DEFINED' PYTHON_VERSION='not.defined.yet' PYTHON_PLATFORM='unknown-os-and-arch' -PYTHON_NAME='python3.8' +PYTHON_NAME='python3.10' BINARY_DIST_URI='https://github.com/chevah/pythia/releases/download' PIP_INDEX_URL='https://pypi.org/simple' BASE_REQUIREMENTS='' @@ -106,7 +106,7 @@ check_source_folder() { # Called to trigger the entry point in the virtual environment. # Can be overwritten in pythia.conf execute_venv() { - ${PYTHON_BIN} $PYTHON3_CHECK -c 'from paver.tasks import main; main()' "$@" + ${PYTHON_BIN} -c 'from paver.tasks import main; main()' "$@" } @@ -626,12 +626,12 @@ check_glibc_version(){ local supported_glibc2_version # Supported minimum minor glibc 2.X versions for various arches. - # For x64, we build on Ubuntu 18.04 with glibc 2.27. - # For arm64, we build on Ubuntu 16.04 with glibc 2.23. + # For x64, we build on Amazon 2 with glibc 2.26. + # For arm64, we used to build on Ubuntu 16.04 with glibc 2.23. # Beware we haven't normalized arch names yet. case "$ARCH" in "amd64"|"x86_64"|"x64") - supported_glibc2_version=27 + supported_glibc2_version=26 ;; "aarch64"|"arm64") supported_glibc2_version=23 @@ -782,17 +782,6 @@ detect_os() { ;; "amd64"|"x86_64") ARCH="x64" - case "$OS" in - win) - # 32bit build on Windows 2019, 64bit otherwise. - # Should work with a l10n pack too (tested with French). - win_ver=$(systeminfo.exe | head -n 3 | tail -n 1 \ - | cut -d ":" -f 2) - if [[ "$win_ver" =~ "Microsoft Windows Server 2019" ]]; then - ARCH="x86" - fi - ;; - esac ;; "aarch64") ARCH="arm64" @@ -839,15 +828,6 @@ if [ "$COMMAND" == "deps" ] ; then install_base_deps fi -case $COMMAND in - test_ci|test_py3) - PYTHON3_CHECK='-3' - ;; - *) - PYTHON3_CHECK='' - ;; -esac - set +e execute_venv "$@" exit_code=$? diff --git a/src/Python-Windows/chevahbs b/src/Python-Windows/chevahbs index 06b35acc..d75a8db1 100755 --- a/src/Python-Windows/chevahbs +++ b/src/Python-Windows/chevahbs @@ -18,13 +18,10 @@ INSTALL_DIR=$3/lib # Construct the relevant download link for the Windows version. EXT="amd64.zip" -if [ "$ARCH" = "x86" ]; then - EXT="win32.zip" -fi ARCHIVE="python-${VER}.${EXT}" LINK="https://www.python.org/ftp/python/${VER}/python-${VER}-embed-${EXT}" -# Download without unpacking (amd64.zip/win32.zip EXTs are treated specially). +# Download without unpacking (amd64.zip extension is treated specially). download_sources $NAME $VER $LINK $EXT # Installation consists of unpacking the ZIP'ed embeddable distribution. @@ -32,4 +29,5 @@ echo "## Extracting ZIP archive to ${INSTALL_DIR}... ##" execute unzip -q "$ARCHIVE" -d "${INSTALL_DIR}" echo "## Adding site-packages to python*._pth file... ##" -echo "lib\\site-packages" >> ${INSTALL_DIR}/python38._pth +echo "import site" >> ${INSTALL_DIR}/python310._pth +echo "site.main()" >> ${INSTALL_DIR}/python310._pth diff --git a/src/Python-Windows/sha512.sum b/src/Python-Windows/sha512.sum index 7a9cb9c9..031eaf75 100644 --- a/src/Python-Windows/sha512.sum +++ b/src/Python-Windows/sha512.sum @@ -1,2 +1 @@ -3b463ef64397326ffd5f20009be6c1304a3bd8646e5bf05c0a8be5ed4aabe7b0a5a6133e962f538292e6290a04fbe07b1caa6c09c54d012b0d07b7f025772921 *Python-3.8.6.amd64.zip -fb270ce1f1d0bcb95e6c192a35dda276005f74e3c9d89a3a8f799296e9a1db925155437be977a3f3181c25eb522025895563d2333bc6606353bc024b51379107 *Python-3.8.6.win32.zip +40cbc98137cc7768e3ea498920ddffd0b3b30308bfd7bbab2ed19d93d2e89db6b4430c7b54a0f17a594e8e10599537a643072e08cfd1a38c284f8703879dcc17 *Python-3.10.11.amd64.zip diff --git a/src/Python/chevahbs b/src/Python/chevahbs index 374eeffb..eda3e5fc 100755 --- a/src/Python/chevahbs +++ b/src/Python/chevahbs @@ -69,7 +69,7 @@ chevahbs_configure() { execute cp Modules/getbuildinfo.c Modules/getbuildinfo.c.orig # Don't use 'sed -i' here, it's not supported on macOS 10.13. execute sed -e \ - s/gitid\ =\ \"default\"/gitid\ =\ \"$PYTHIA_VERSION\"/g \ + s/gitid\ =\ \"main\"/gitid\ =\ \"$PYTHIA_VERSION\"/g \ Modules/getbuildinfo.c.orig > Modules/getbuildinfo.c execute ./configure --prefix="" $CONFIG_ARGS } diff --git a/src/Python/disabled_modules.patch b/src/Python/disabled_modules.patch index 33afa959..840b8e8f 100644 --- a/src/Python/disabled_modules.patch +++ b/src/Python/disabled_modules.patch @@ -1,12 +1,11 @@ -diff -ur Python-3.8.6.orig/setup.py Python-3.8.6.disabled_modules/setup.py ---- Python-3.8.6.orig/setup.py 2020-09-23 12:36:32.000000000 +0000 -+++ Python-3.8.6.disabled_modules/setup.py 2020-10-30 11:48:50.512622149 +0000 -@@ -24,8 +24,16 @@ - TEST_EXTENSIONS = True +diff -ur Python-3.10.10/setup.py Python-3.10.10-disabled-modules/setup.py +--- Python-3.10.10/setup.py 2023-02-07 14:05:45.000000000 +0200 ++++ Python-3.10.10-disabled-modules/setup.py 2023-03-17 12:41:45.252791918 +0200 +@@ -58,7 +58,16 @@ + TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes') # This global variable is used to hold the list of modules to be disabled. -DISABLED_MODULE_LIST = [] -- +DISABLED_MODULE_LIST = [ + '_curses', + '_curses_panel', @@ -18,5 +17,5 @@ diff -ur Python-3.8.6.orig/setup.py Python-3.8.6.disabled_modules/setup.py + 'readline', + ] - def get_platform(): - # Cross compiling + # --list-module-names option used by Tools/scripts/generate_module_names.py + LIST_MODULE_NAMES = False diff --git a/src/Python/readline_libedit.patch b/src/Python/readline_libedit.patch deleted file mode 100644 index 29577c62..00000000 --- a/src/Python/readline_libedit.patch +++ /dev/null @@ -1,985 +0,0 @@ -diff -ur Python-3.8.6.disabled_modules/Modules/readline.c Python-3.8.6.readline_libedit/Modules/readline.c ---- Python-3.8.6.disabled_modules/Modules/readline.c 2020-10-30 11:46:41.383354897 +0000 -+++ Python-3.8.6.readline_libedit/Modules/readline.c 2020-10-30 11:45:38.462738019 +0000 -@@ -26,23 +26,20 @@ - # define RESTORE_LOCALE(sl) - #endif - -+#ifdef WITH_EDITLINE -+# include -+#else - /* GNU readline definitions */ --#undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */ --#include --#include -+# undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */ -+# include -+# include -+#endif - -+/* Readline 4.2 deprecated completion_matches() in favour of -++rl_completion_matches() */ - #ifdef HAVE_RL_COMPLETION_MATCHES - #define completion_matches(x, y) \ - rl_completion_matches((x), ((rl_compentry_func_t *)(y))) --#else --#if defined(_RL_FUNCTION_TYPEDEF) --extern char **completion_matches(char *, rl_compentry_func_t *); --#else -- --#if !defined(__APPLE__) --extern char **completion_matches(char *, CPFunction *); --#endif --#endif - #endif - - /* -@@ -50,20 +47,26 @@ - * emulation library of editline/libedit. - * - * This emulation library is not 100% API compatible with the "real" readline -- * and cannot be detected at compile-time, -+ * and if WITH_EDITLINE was not specified, cannot be detected at compile-time, - * hence we use a runtime check to detect if the Python readlinke module is - * linked to libedit. -- * -- * Currently there is one known API incompatibility: -+ */ -+#if !defined(WITH_EDITLINE) -+# define DETECT_EDITLINE -+static int using_libedit_emulation = 0; -+static const char libedit_version_tag[] = "EditLine wrapper"; -+#endif -+ -+#if defined(WITH_EDITLINE) -+# define SUPPORT_EDITLINE -+/* One incompatibility of Editline: - * - 'get_history' has a 1-based index with GNU readline, and a 0-based - * index with older versions of libedit's emulation. - * - Note that replace_history and remove_history use a 0-based index - * with both implementations. - */ --static int using_libedit_emulation = 0; --static const char libedit_version_tag[] = "EditLine wrapper"; -- - static int libedit_history_start = 0; -+#endif - - #ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK - static void -@@ -663,25 +666,6 @@ - \n\ - Returns current completer function."); - --/* Private function to get current length of history. XXX It may be -- * possible to replace this with a direct use of history_length instead, -- * but it's not clear whether BSD's libedit keeps history_length up to date. -- * See issue #8065.*/ -- --static int --_py_get_history_length(void) --{ -- HISTORY_STATE *hist_st = history_get_history_state(); -- int length = hist_st->length; -- /* the history docs don't say so, but the address of hist_st changes each -- time history_get_history_state is called which makes me think it's -- freshly malloc'd memory... on the other hand, the address of the last -- line stays the same as long as history isn't extended, so it appears to -- be malloc'd but managed by the history package... */ -- free(hist_st); -- return length; --} -- - /* Exported function to get any element of history */ - - static PyObject * -@@ -692,25 +676,24 @@ - - if (!PyArg_ParseTuple(args, "i:get_history_item", &idx)) - return NULL; -- if (using_libedit_emulation) { -- /* Older versions of libedit's readline emulation -- * use 0-based indexes, while readline and newer -- * versions of libedit use 1-based indexes. -- */ -- int length = _py_get_history_length(); -- -- idx = idx - 1 + libedit_history_start; -- -- /* -- * Apple's readline emulation crashes when -- * the index is out of range, therefore -- * test for that and fail gracefully. -- */ -- if (idx < (0 + libedit_history_start) -- || idx >= (length + libedit_history_start)) { -- Py_RETURN_NONE; -- } -+#ifdef SUPPORT_EDITLINE -+ idx = idx - 1 + libedit_history_start; -+ -+ /* -+ * Apple's readline emulation crashes when -+ * the index is out of range, therefore -+ * test for that and fail gracefully. -+ */ -+ /* KELLIN NOTE: -+ * The initial patch removed the 0 for some unknown to me reason -+ * -+ * if (idx < (0 + libedit_history_start) -+ */ -+ if (idx < libedit_history_start -+ || idx >= (history_length + libedit_history_start)) { -+ Py_RETURN_NONE; - } -+#endif /* SUPPORT_EDITLINE */ - if ((hist_ent = history_get(idx))) - return decode(hist_ent->line); - else { -@@ -728,7 +711,7 @@ - static PyObject * - get_current_history_length(PyObject *self, PyObject *noarg) - { -- return PyLong_FromLong((long)_py_get_history_length()); -+ return PyLong_FromLong(history_length); - } - - PyDoc_STRVAR(doc_get_current_history_length, -@@ -1077,13 +1060,15 @@ - /* The name must be defined before initialization */ - rl_readline_name = "python"; - -+#ifdef SUPPORT_EDITLINE - /* the libedit readline emulation resets key bindings etc -- * when calling rl_initialize. So call it upfront -+ * when calling rl_initialize. So call it before making those settings. - */ -+# ifdef DETECT_EDITLINE - if (using_libedit_emulation) -+# endif - rl_initialize(); -- -- /* Detect if libedit's readline emulation uses 0-based -+ /* Detect if the backend library uses 0-based - * indexing or 1-based indexing. - */ - add_history("1"); -@@ -1093,6 +1078,7 @@ - libedit_history_start = 1; - } - clear_history(); -+#endif /* SUPPORT_EDITLINE */ - - using_history(); - -@@ -1121,7 +1107,9 @@ - mod_state->begidx = PyLong_FromLong(0L); - mod_state->endidx = PyLong_FromLong(0L); - -+#ifdef DETECT_EDITLINE - if (!using_libedit_emulation) -+#endif - { - if (!isatty(STDOUT_FILENO)) { - /* Issue #19884: stdout is not a terminal. Disable meta modifier -@@ -1140,11 +1128,20 @@ - * - * XXX: A bug in the readline-2.2 library causes a memory leak - * inside this function. Nothing we can do about it. -+ * -+ * For Editline, just invoke the user configuration; initialization was -+ * already done above. - */ -+#ifdef DETECT_EDITLINE - if (using_libedit_emulation) - rl_read_init_file(NULL); - else - rl_initialize(); -+#elif defined(WITH_EDITLINE) -+ rl_read_init_file(NULL); -+#else -+ rl_initialize(); -+#endif - - RESTORE_LOCALE(saved_locale) - } -@@ -1269,14 +1266,13 @@ - n = strlen(p); - if (should_auto_add_history && n > 0) { - const char *line; -- int length = _py_get_history_length(); -- if (length > 0) { -+ if (history_length > 0) { - HIST_ENTRY *hist_ent; -- if (using_libedit_emulation) { -- /* handle older 0-based or newer 1-based indexing */ -- hist_ent = history_get(length + libedit_history_start - 1); -- } else -- hist_ent = history_get(length); -+#ifdef SUPPORT_EDITLINE -+ hist_ent = history_get(history_length + libedit_history_start - 1); -+#else -+ hist_ent = history_get(history_length); -+#endif - line = hist_ent ? hist_ent->line : ""; - } else - line = ""; -@@ -1301,10 +1297,15 @@ - /* Initialize the module */ - - PyDoc_STRVAR(doc_module, -+#ifndef WITH_EDITLINE - "Importing this module enables command line editing using GNU readline."); -- -+#endif -+#ifdef DETECT_EDITLINE - PyDoc_STRVAR(doc_module_le, -+#endif -+#ifdef SUPPORT_EDITLINE - "Importing this module enables command line editing using libedit readline."); -+#endif - - static struct PyModuleDef readlinemodule = { - PyModuleDef_HEAD_INIT, -@@ -1325,13 +1326,14 @@ - PyObject *m; - readlinestate *mod_state; - -+#ifdef DETECT_EDITLINE - if (strncmp(rl_library_version, libedit_version_tag, strlen(libedit_version_tag)) == 0) { - using_libedit_emulation = 1; - } - - if (using_libedit_emulation) - readlinemodule.m_doc = doc_module_le; -- -+#endif /* DETECT_EDITLINE */ - - m = PyModule_Create(&readlinemodule); - -Only in Python-3.8.6.readline_libedit/: chevahbs -diff -ur Python-3.8.6.disabled_modules/configure Python-3.8.6.readline_libedit/configure ---- Python-3.8.6.disabled_modules/configure 2020-10-30 11:46:41.411355171 +0000 -+++ Python-3.8.6.readline_libedit/configure 2020-10-30 11:51:32.378212607 +0000 -@@ -840,6 +840,7 @@ - with_libm - with_libc - enable_big_digits -+with_readline - with_computed_gotos - with_ensurepip - with_openssl -@@ -1550,6 +1551,8 @@ - --with(out)-dtrace disable/enable DTrace support - --with-libm=STRING math library - --with-libc=STRING C library -+ --with(out)-readline[=editline] -+ use Editline for backend or disable readline module - --with(out)-computed-gotos - Use computed gotos in evaluation loop (enabled by - default on supported compilers) -@@ -15301,24 +15304,49 @@ - - fi - -+ -+# Check whether --with-readline was given. -+if test "${with_readline+set}" = set; then : -+ withval=$with_readline; -+else -+ with_readline=yes -+fi -+ -+ - # check where readline lives -+py_cv_lib_readline=no - # save the value of LIBS so we don't actually link Python with readline - LIBS_no_readline=$LIBS - --# On some systems we need to link readline to a termcap compatible --# library. NOTE: Keep the precedence of listed libraries synchronised --# with setup.py. --py_cv_lib_readline=no --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5 -+if test "$with_readline" != no; then -+ case "$with_readline" in -+ editline|edit) -+ LIBREADLINE=edit -+ -+$as_echo "#define WITH_EDITLINE 1" >>confdefs.h -+ -+ ;; -+ yes|readline) -+ LIBREADLINE=readline -+ ;; -+ *) -+ as_fn_error $? "proper usage is --with(out)-readline[=editline]" "$LINENO" 5 -+ ;; -+ esac -+ -+ # On some systems we need to link readline to a termcap compatible -+ # library. NOTE: Keep the precedence of listed libraries synchronised -+ # with setup.py. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5 - $as_echo_n "checking how to link readline libs... " >&6; } --for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do -- if test -z "$py_libtermcap"; then -- READLINE_LIBS="-lreadline" -- else -- READLINE_LIBS="-lreadline -l$py_libtermcap" -- fi -- LIBS="$READLINE_LIBS $LIBS_no_readline" -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+ for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do -+ if test -z "$py_libtermcap"; then -+ READLINE_LIBS="-l$LIBREADLINE" -+ else -+ READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap" -+ fi -+ LIBS="$READLINE_LIBS $LIBS_no_readline" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - - /* Override any GCC internal prototype to avoid an error. -@@ -15341,73 +15369,67 @@ - fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -- if test $py_cv_lib_readline = yes; then -- break -- fi --done --# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts --#AC_SUBST([READLINE_LIBS]) --if test $py_cv_lib_readline = no; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -+ if test $py_cv_lib_readline = yes; then -+ break -+ fi -+ done -+ -+ # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts -+ #AC_SUBST([READLINE_LIBS]) -+ if test $py_cv_lib_readline = no; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 - $as_echo "none" >&6; } --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5 -+ else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5 - $as_echo "$READLINE_LIBS" >&6; } - - $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h - -+ fi - fi - --# check for readline 2.2 --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include --_ACEOF --if ac_fn_c_try_cpp "$LINENO"; then : -- have_readline=yes --else -- have_readline=no -- --fi --rm -f conftest.err conftest.i conftest.$ac_ext --if test $have_readline = yes --then -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include -+if test "$py_cv_lib_readline" = yes; then -+ # check for readline 2.2 -+ ac_fn_c_check_decl "$LINENO" "rl_completion_append_character" "ac_cv_have_decl_rl_completion_append_character" " -+#include /* Must be first for Gnu Readline */ -+#ifdef WITH_EDITLINE -+# include -+#else -+# include -+#endif - --_ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "extern int rl_completion_append_character;" >/dev/null 2>&1; then : -+" -+if test "x$ac_cv_have_decl_rl_completion_append_character" = xyes; then : - --$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h -+ $as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h - - fi --rm -f conftest* - -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include -+ ac_fn_c_check_decl "$LINENO" "rl_completion_suppress_append" "ac_cv_have_decl_rl_completion_suppress_append" " -+#include /* Must be first for Gnu Readline */ -+#ifdef WITH_EDITLINE -+# include -+#else -+# include -+#endif - --_ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "extern int rl_completion_suppress_append;" >/dev/null 2>&1; then : -+" -+if test "x$ac_cv_have_decl_rl_completion_suppress_append" = xyes; then : - - $as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h - - fi --rm -f conftest* - --fi - --# check for readline 4.0 --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 --$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } --if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : -+ # check for readline 4.0 -+ as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_pre_input_hook" | $as_tr_sh` -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l$LIBREADLINE" >&5 -+$as_echo_n "checking for rl_pre_input_hook in -l$LIBREADLINE... " >&6; } -+if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $READLINE_LIBS $LIBS" -+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -15427,31 +15449,34 @@ - } - _ACEOF - if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_readline_rl_pre_input_hook=yes -+ eval "$as_ac_Lib=yes" - else -- ac_cv_lib_readline_rl_pre_input_hook=no -+ eval "$as_ac_Lib=no" - fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 --$as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } --if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : -+eval ac_res=\$$as_ac_Lib -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -+$as_echo "$ac_res" >&6; } -+ -+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - - $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h - - fi - - --# also in 4.0 --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 --$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } --if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : -+ # also in 4.0 -+ as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_display_matches_hook" | $as_tr_sh` -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l$LIBREADLINE" >&5 -+$as_echo_n "checking for rl_completion_display_matches_hook in -l$LIBREADLINE... " >&6; } -+if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $READLINE_LIBS $LIBS" -+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -15471,31 +15496,34 @@ - } - _ACEOF - if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_readline_rl_completion_display_matches_hook=yes -+ eval "$as_ac_Lib=yes" - else -- ac_cv_lib_readline_rl_completion_display_matches_hook=no -+ eval "$as_ac_Lib=no" - fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 --$as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } --if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : -+eval ac_res=\$$as_ac_Lib -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -+$as_echo "$ac_res" >&6; } -+ -+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - - $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h - - fi - - --# also in 4.0, but not in editline --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -lreadline" >&5 --$as_echo_n "checking for rl_resize_terminal in -lreadline... " >&6; } --if ${ac_cv_lib_readline_rl_resize_terminal+:} false; then : -+ # also in 4.0, but not in editline -+ as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_resize_terminal" | $as_tr_sh` -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -l$LIBREADLINE" >&5 -+$as_echo_n "checking for rl_resize_terminal in -l$LIBREADLINE... " >&6; } -+if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $READLINE_LIBS $LIBS" -+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -15515,31 +15543,33 @@ - } - _ACEOF - if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_readline_rl_resize_terminal=yes -+ eval "$as_ac_Lib=yes" - else -- ac_cv_lib_readline_rl_resize_terminal=no -+ eval "$as_ac_Lib=no" - fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_resize_terminal" >&5 --$as_echo "$ac_cv_lib_readline_rl_resize_terminal" >&6; } --if test "x$ac_cv_lib_readline_rl_resize_terminal" = xyes; then : -+eval ac_res=\$$as_ac_Lib -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -+$as_echo "$ac_res" >&6; } -+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - - $as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h - - fi - - --# check for readline 4.2 --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 --$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } --if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : -+ # check for readline 4.2 -+ as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_matches" | $as_tr_sh` -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l$LIBREADLINE" >&5 -+$as_echo_n "checking for rl_completion_matches in -l$LIBREADLINE... " >&6; } -+if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $READLINE_LIBS $LIBS" -+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -15559,59 +15589,49 @@ - } - _ACEOF - if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_readline_rl_completion_matches=yes -+ eval "$as_ac_Lib=yes" - else -- ac_cv_lib_readline_rl_completion_matches=no -+ eval "$as_ac_Lib=no" - fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 --$as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } --if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : -+eval ac_res=\$$as_ac_Lib -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -+$as_echo "$ac_res" >&6; } -+ -+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - - $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h - - fi - - --# also in readline 4.2 --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include --_ACEOF --if ac_fn_c_try_cpp "$LINENO"; then : -- have_readline=yes --else -- have_readline=no -- --fi --rm -f conftest.err conftest.i conftest.$ac_ext --if test $have_readline = yes --then -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include -+ # also in readline 4.2 -+ ac_fn_c_check_decl "$LINENO" "rl_catch_signals" "ac_cv_have_decl_rl_catch_signals" " -+#include /* Must be first for Gnu Readline */ -+#ifdef WITH_EDITLINE -+# include -+#else -+# include -+#endif - --_ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- $EGREP "extern int rl_catch_signals;" >/dev/null 2>&1; then : -+" -+if test "x$ac_cv_have_decl_rl_catch_signals" = xyes; then : - - $as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h - - fi --rm -f conftest* -- --fi - --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lreadline" >&5 --$as_echo_n "checking for append_history in -lreadline... " >&6; } --if ${ac_cv_lib_readline_append_history+:} false; then : -+ as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_append_history" | $as_tr_sh` -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -l$LIBREADLINE" >&5 -+$as_echo_n "checking for append_history in -l$LIBREADLINE... " >&6; } -+if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lreadline $READLINE_LIBS $LIBS" -+LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -@@ -15631,22 +15651,24 @@ - } - _ACEOF - if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_readline_append_history=yes -+ eval "$as_ac_Lib=yes" - else -- ac_cv_lib_readline_append_history=no -+ eval "$as_ac_Lib=no" - fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_append_history" >&5 --$as_echo "$ac_cv_lib_readline_append_history" >&6; } --if test "x$ac_cv_lib_readline_append_history" = xyes; then : -+eval ac_res=\$$as_ac_Lib -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -+$as_echo "$ac_res" >&6; } -+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - - $as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h - - fi - -+fi - - # End of readline checks: restore LIBS - LIBS=$LIBS_no_readline -diff -ur Python-3.8.6.disabled_modules/configure.ac Python-3.8.6.readline_libedit/configure.ac ---- Python-3.8.6.disabled_modules/configure.ac 2020-10-30 11:46:41.479355837 +0000 -+++ Python-3.8.6.readline_libedit/configure.ac 2020-10-30 11:45:38.470738098 +0000 -@@ -4732,93 +4732,125 @@ - [Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) - fi - -+AC_ARG_WITH([readline], -+ [AS_HELP_STRING([--with(out)-readline@<:@=editline@:>@], -+ [use Editline for backend or disable readline module])], -+ [], -+ [with_readline=yes]) -+ - # check where readline lives -+py_cv_lib_readline=no - # save the value of LIBS so we don't actually link Python with readline - LIBS_no_readline=$LIBS - --# On some systems we need to link readline to a termcap compatible --# library. NOTE: Keep the precedence of listed libraries synchronised --# with setup.py. --py_cv_lib_readline=no --AC_MSG_CHECKING([how to link readline libs]) --for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do -- if test -z "$py_libtermcap"; then -- READLINE_LIBS="-lreadline" -+if test "$with_readline" != no; then -+ case "$with_readline" in -+ editline|edit) -+ LIBREADLINE=edit -+ AC_DEFINE(WITH_EDITLINE, 1, -+ [Define to build the readline module against Editline.]) -+ ;; -+ yes|readline) -+ LIBREADLINE=readline -+ ;; -+ *) -+ AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline@:>@]) -+ ;; -+ esac -+ -+ # On some systems we need to link readline to a termcap compatible -+ # library. NOTE: Keep the precedence of listed libraries synchronised -+ # with setup.py. -+ AC_MSG_CHECKING([how to link readline libs]) -+ for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do -+ if test -z "$py_libtermcap"; then -+ READLINE_LIBS="-l$LIBREADLINE" -+ else -+ READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap" -+ fi -+ LIBS="$READLINE_LIBS $LIBS_no_readline" -+ AC_LINK_IFELSE( -+ [AC_LANG_CALL([],[readline])], -+ [py_cv_lib_readline=yes]) -+ if test $py_cv_lib_readline = yes; then -+ break -+ fi -+ done -+ -+ # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts -+ #AC_SUBST([READLINE_LIBS]) -+ if test $py_cv_lib_readline = no; then -+ AC_MSG_RESULT([none]) - else -- READLINE_LIBS="-lreadline -l$py_libtermcap" -- fi -- LIBS="$READLINE_LIBS $LIBS_no_readline" -- AC_LINK_IFELSE( -- [AC_LANG_CALL([],[readline])], -- [py_cv_lib_readline=yes]) -- if test $py_cv_lib_readline = yes; then -- break -+ AC_MSG_RESULT([$READLINE_LIBS]) -+ AC_DEFINE(HAVE_LIBREADLINE, 1, -+ [Define to build the readline module.]) - fi --done --# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts --#AC_SUBST([READLINE_LIBS]) --if test $py_cv_lib_readline = no; then -- AC_MSG_RESULT([none]) --else -- AC_MSG_RESULT([$READLINE_LIBS]) -- AC_DEFINE(HAVE_LIBREADLINE, 1, -- [Define if you have the readline library (-lreadline).]) - fi - --# check for readline 2.2 --AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])], -- [have_readline=yes], -- [have_readline=no] --) --if test $have_readline = yes --then -- AC_EGREP_HEADER([extern int rl_completion_append_character;], -- [readline/readline.h], -- AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, -- [Define if you have readline 2.2]), ) -- AC_EGREP_HEADER([extern int rl_completion_suppress_append;], -- [readline/readline.h], -- AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, -- [Define if you have rl_completion_suppress_append]), ) -+if test "$py_cv_lib_readline" = yes; then -+ # check for readline 2.2 -+ AC_CHECK_DECL(rl_completion_append_character, -+ AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, -+ [Define if you have readline 2.2]),, -+ [ -+#include /* Must be first for Gnu Readline */ -+#ifdef WITH_EDITLINE -+# include -+#else -+# include -+#endif -+ ]) -+ AC_CHECK_DECL(rl_completion_suppress_append, -+ AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, -+ [Define if you have rl_completion_suppress_append]),, -+ [ -+#include /* Must be first for Gnu Readline */ -+#ifdef WITH_EDITLINE -+# include -+#else -+# include -+#endif -+ ]) -+ -+ # check for readline 4.0 -+ AC_CHECK_LIB($LIBREADLINE, rl_pre_input_hook, -+ AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, -+ [Define if you have readline 4.0]),,$READLINE_LIBS) -+ -+ # also in 4.0 -+ AC_CHECK_LIB($LIBREADLINE, rl_completion_display_matches_hook, -+ AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, -+ [Define if you have readline 4.0]),,$READLINE_LIBS) -+ -+ # also in 4.0, but not in editline -+ AC_CHECK_LIB($LIBREADLINE, rl_resize_terminal, -+ AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, -+ [Define if you have readline 4.0]),,$READLINE_LIBS) -+ -+ # check for readline 4.2 -+ AC_CHECK_LIB($LIBREADLINE, rl_completion_matches, -+ AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, -+ [Define if you have readline 4.2]),,$READLINE_LIBS) -+ -+ # also in readline 4.2 -+ AC_CHECK_DECL(rl_catch_signals, -+ AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, -+ [Define if you can turn off readline's signal handling.]),, -+ [ -+#include /* Must be first for Gnu Readline */ -+#ifdef WITH_EDITLINE -+# include -+#else -+# include -+#endif -+ ]) -+ -+ AC_CHECK_LIB($LIBREADLINE, append_history, -+ AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1, -+ [Define if readline supports append_history]),,$READLINE_LIBS) - fi - --# check for readline 4.0 --AC_CHECK_LIB(readline, rl_pre_input_hook, -- AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, -- [Define if you have readline 4.0]), ,$READLINE_LIBS) -- --# also in 4.0 --AC_CHECK_LIB(readline, rl_completion_display_matches_hook, -- AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, -- [Define if you have readline 4.0]), ,$READLINE_LIBS) -- --# also in 4.0, but not in editline --AC_CHECK_LIB(readline, rl_resize_terminal, -- AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, -- [Define if you have readline 4.0]), ,$READLINE_LIBS) -- --# check for readline 4.2 --AC_CHECK_LIB(readline, rl_completion_matches, -- AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, -- [Define if you have readline 4.2]), ,$READLINE_LIBS) -- --# also in readline 4.2 --AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])], -- [have_readline=yes], -- [have_readline=no] --) --if test $have_readline = yes --then -- AC_EGREP_HEADER([extern int rl_catch_signals;], -- [readline/readline.h], -- AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, -- [Define if you can turn off readline's signal handling.]), ) --fi -- --AC_CHECK_LIB(readline, append_history, -- AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1, -- [Define if readline supports append_history]), ,$READLINE_LIBS) -- - # End of readline checks: restore LIBS - LIBS=$LIBS_no_readline - -Only in Python-3.8.6.readline_libedit/: disabled_modules.patch -diff -ur Python-3.8.6.disabled_modules/pyconfig.h.in Python-3.8.6.readline_libedit/pyconfig.h.in ---- Python-3.8.6.disabled_modules/pyconfig.h.in 2020-10-30 11:46:41.443355485 +0000 -+++ Python-3.8.6.readline_libedit/pyconfig.h.in 2020-10-30 11:45:38.474738137 +0000 -@@ -601,7 +601,7 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_LIBINTL_H - --/* Define if you have the readline library (-lreadline). */ -+/* Define to build the readline module. */ - #undef HAVE_LIBREADLINE - - /* Define to 1 if you have the `resolv' library (-lresolv). */ -@@ -1533,6 +1533,9 @@ - Dyld is necessary to support frameworks. */ - #undef WITH_DYLD - -+/* Define to build the readline module against Editline. */ -+#undef WITH_EDITLINE -+ - /* Define to 1 if libintl is needed for locale functions. */ - #undef WITH_LIBINTL - -Only in Python-3.8.6.readline_libedit/: readline_libedit.patch -diff -ur Python-3.8.6.disabled_modules/setup.py Python-3.8.6.readline_libedit/setup.py ---- Python-3.8.6.disabled_modules/setup.py 2020-10-30 11:48:50.512622149 +0000 -+++ Python-3.8.6.readline_libedit/setup.py 2020-10-30 11:45:38.474738137 +0000 -@@ -33,7 +33,7 @@ - '_lzma', - '_tkinter', - 'nis', -- 'readline', -+ 'ossaudiodev', - ] - - def get_platform(): -@@ -886,7 +886,6 @@ - - def detect_readline_curses(self): - # readline -- do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline') - readline_termcap_library = "" - curses_library = "" - # Cannot use os.popen here in py3k. -@@ -894,7 +893,13 @@ - if not os.path.exists(self.build_temp): - os.makedirs(self.build_temp) - # Determine if readline is already linked against curses or tinfo. -- if do_readline: -+ if sysconfig.get_config_var('HAVE_LIBREADLINE'): -+ if sysconfig.get_config_var('WITH_EDITLINE'): -+ readline_lib = 'edit' -+ else: -+ readline_lib = 'readline' -+ do_readline = self.compiler.find_library_file(self.lib_dirs, -+ readline_lib) - if CROSS_COMPILING: - ret = os.system("%s -d %s | grep '(NEEDED)' > %s" \ - % (sysconfig.get_config_var('READELF'), -@@ -917,6 +922,8 @@ - break - if os.path.exists(tmpfile): - os.unlink(tmpfile) -+ else: -+ do_readline = False - # Issue 7384: If readline is already linked against curses, - # use the same library for the readline and curses modules. - if 'curses' in readline_termcap_library: -@@ -956,7 +963,7 @@ - else: - readline_extra_link_args = () - -- readline_libs = ['readline'] -+ readline_libs = [readline_lib] - if readline_termcap_library: - pass # Issue 7384: Already linked against curses or tinfo. - elif curses_library: diff --git a/src/Python/sha512.sum b/src/Python/sha512.sum index 9a35875e..b147e6a1 100644 --- a/src/Python/sha512.sum +++ b/src/Python/sha512.sum @@ -1 +1 @@ -9479a1bed110e4caab0496832c2c40574306c961059de96a54dc93911791b52d949fbdb0b3d0d0a13ab7025e1d823b40ff208a259c310e7013fad1ebfab00f6e Python-3.8.6.tgz +4d087277896696a7a5c10dbe74a00f0ebb5bbd086903597a49d63b03bf322c1fe159710f9ed43c6f7a0da125e2b81aa0847337dc305ed4f2a6b7cbe48f398326 Python-3.10.11.tgz diff --git a/src/chevah-python-test/test_python_binary_dist.py b/src/chevah-python-test/test_python_binary_dist.py index 15eea856..128c4646 100644 --- a/src/chevah-python-test/test_python_binary_dist.py +++ b/src/chevah-python-test/test_python_binary_dist.py @@ -34,7 +34,7 @@ def get_allowed_deps(): elif 'linux' in CHEVAH_OS: # Deps without paths for generic glibc Linux builds. # Only glibc 2.x libs are allowed. - # Tested on Ubuntu 16.04/18.04 with glibc 2.23/2.26. + # Tested on Amazon 2 & Ubuntu 16.04/18.04 with glibc 2.26/2.23/2.27. allowed_deps=[ 'libc.so.6', 'libcrypt.so.1', @@ -351,7 +351,7 @@ def main(): import cryptography openssl_version = backend.openssl_version_text() # OpenSSL version embedded with the cryptography wheels. - expecting = u'OpenSSL 3.0.8 7 Feb 2023' + expecting = u'OpenSSL 3.1.0 14 Mar 2023' if openssl_version != expecting: sys.stderr.write('Expecting %s, got %s.\n' % ( expecting, openssl_version)) @@ -387,6 +387,38 @@ def main(): sys.stderr.write('"multiprocessing" is missing or broken.\n') exit_code = 140 + try: + import cffi + ffibuilder = cffi.FFI() + except: + sys.stderr.write('"cffi" is missing or broken.\n') + exit_code = 141 + else: + print ('cffi %s' % (cffi.__version__,)) + + try: + import nacl.utils + from nacl.public import PrivateKey, Box + skbob = PrivateKey.generate() + pkbob = skbob.public_key + skalice = PrivateKey.generate() + pkalice = skalice.public_key + bob_box = Box(skbob, pkalice) + message = b"Some secret message" + encrypted = bob_box.encrypt(message) + nonce = nacl.utils.random(Box.NONCE_SIZE) + encrypted = bob_box.encrypt(message, nonce) + alice_box = Box(skalice, pkbob) + plaintext = alice_box.decrypt(encrypted) + if plaintext.decode('utf-8') == message.decode('utf-8'): + print('PyNaCl %s' % (nacl.__version__,)) + else: + sys.stderr.write('"PyNaCl" is present, but broken.\n') + exit_code = 144 + except: + sys.stderr.write('"PyNaCl" is missing.\n') + exit_code = 143 + try: import bcrypt password = b"super secret password" @@ -464,6 +496,24 @@ def main(): else: print('"uuid" module is present.') + try: + from charset_normalizer import from_path + tmp_results = from_path('../README.rst') + except: + sys.stderr.write('"charset-normalizer" is missing or broken.\n') + exit_code = 164 + else: + print('"charset-normalizer" module is present.') + + try: + from markupsafe import escape + tmp_text = escape('') + except: + sys.stderr.write('"markupsafe" is missing or broken.\n') + exit_code = 165 + else: + print('"markupsafe" module is present.') + if os.name == 'nt': # Windows specific modules. try: @@ -471,10 +521,17 @@ def main(): windll except: sys.stderr.write('"ctypes - windll" is missing.\n') - exit_code = 152 + exit_code = 171 else: print('ctypes %s' % (ctypes.__version__,)) + try: + import win32api + win32api.GetCurrentThread() + except Exception as error: + sys.stderr.write('"pywin32" missing or broken.\n {}'.format(error)) + exit_code = 172 + else: # Linux / Unix stuff. try: diff --git a/src/libffi/sha512.sum b/src/libffi/sha512.sum index 344aeb00..20393528 100644 --- a/src/libffi/sha512.sum +++ b/src/libffi/sha512.sum @@ -1 +1 @@ -31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1 libffi-3.4.2.tar.gz +88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889 libffi-3.4.4.tar.gz diff --git a/src/sqlite-autoconf/chevahbs b/src/sqlite-autoconf/chevahbs index 5412fdbe..cfb2c30c 100755 --- a/src/sqlite-autoconf/chevahbs +++ b/src/sqlite-autoconf/chevahbs @@ -14,7 +14,7 @@ chevahbs_getsources() { local name=$1 local ver=$2 local ext="tar.gz" - local link=https://sqlite.org/2022/"$name"-"$ver"."$ext" + local link=https://sqlite.org/2023/"$name"-"$ver"."$ext" download_sources $name $ver $link $ext } diff --git a/src/sqlite-autoconf/sha512.sum b/src/sqlite-autoconf/sha512.sum index 34e9f13e..19417995 100644 --- a/src/sqlite-autoconf/sha512.sum +++ b/src/sqlite-autoconf/sha512.sum @@ -1 +1 @@ -02bec3bd0d89f53c81c34a16d9105e157e3cfc9bb9c62900f65fde019a211b4d1b28017affd1785b344d85f742a0c6893b9c5b2702312c3e7ddb78ae8a4c152f sqlite-autoconf-3380300.tar.gz +6e6dafc35b8b11df3cd3bea48aaf84a102893242cffbe18eb7b111791563095111a2a8a5632636b8f46523d98d16e2b48dab79ee6707a141b22c2e6fde3002a2 sqlite-autoconf-3410100.tar.gz diff --git a/src/xz/sha512.sum b/src/xz/sha512.sum index e72a0025..f7fcab4e 100644 --- a/src/xz/sha512.sum +++ b/src/xz/sha512.sum @@ -1 +1 @@ -7443674247deda2935220fbc4dfc7665e5bb5a260be8ad858c8bd7d7b9f0f868f04ea45e62eb17c0a5e6a2de7c7500ad2d201e2d668c48ca29bd9eea5a73a3ce xz-5.2.5.tar.gz +5cff8383a68fb88ecbb3770ec48af0ad5582e08de9dccd339e0b685aaa53447e59d6425caa3f63b54a674e5d78c20520876db547d156e6658ad4841660cba85b xz-5.4.1.tar.gz