From f814427db11267599b3e3a36ace318afe5b8e9b4 Mon Sep 17 00:00:00 2001 From: jomae Date: Sun, 5 May 2024 02:33:49 +0000 Subject: [PATCH] 1.6.1dev: add Python 3.12 to build workflow of GitHub Actions git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17792 af82e41b-90c4-0310-8c96-b1721e28e2e2 --- .github/posix-prepare.sh | 7 ++++ .github/svn-py312.patch | 77 +++++++++++++++++++++++++++++++++++++ .github/svn-swig41.patch | 29 ++++++++++++++ .github/windows-prepare.ps1 | 6 +-- .github/workflows/build.yml | 32 +++++++-------- 5 files changed, 133 insertions(+), 18 deletions(-) create mode 100644 .github/svn-py312.patch create mode 100644 .github/svn-swig41.patch diff --git a/.github/posix-prepare.sh b/.github/posix-prepare.sh index a2bbd0b515..81c0fafb1e 100755 --- a/.github/posix-prepare.sh +++ b/.github/posix-prepare.sh @@ -31,6 +31,13 @@ build_svnpy() { curl -s -o "$svntarball" "$svnurl" tar xjf "$svntarball" -C "$GITHUB_WORKSPACE" cd "$GITHUB_WORKSPACE/subversion-$svnver" + case "$svnver" in + 1.14.[012]) + git apply -v -p0 --whitespace=fix \ + "$GITHUB_WORKSPACE/.github/svn-swig41.patch" \ + "$GITHUB_WORKSPACE/.github/svn-py312.patch" + ;; + esac "$python" gen-make.py --release --installed-libs "$installed_libs" ./configure --prefix="$venvdir" \ --with-apr="$with_apr" \ diff --git a/.github/svn-py312.patch b/.github/svn-py312.patch new file mode 100644 index 0000000000..a3a31cf619 --- /dev/null +++ b/.github/svn-py312.patch @@ -0,0 +1,77 @@ +Index: build/generator/gen_base.py +=================================================================== +--- build/generator/gen_base.py (revision 1900881) ++++ build/generator/gen_base.py (revision 1900882) +@@ -76,7 +76,7 @@ + + # Now read and parse build.conf + parser = configparser.ConfigParser() +- parser.readfp(open(fname)) ++ parser.read_file(open(fname)) + + self.conf = build_path(os.path.abspath(fname)) + +Index: build/generator/gen_win_dependencies.py +=================================================================== +--- build/generator/gen_win_dependencies.py (revision 1910097) ++++ build/generator/gen_win_dependencies.py (revision 1910098) +@@ -1045,12 +1045,13 @@ + "Find the appropriate options for creating SWIG-based Python modules" + + try: +- from distutils import sysconfig +- +- inc_dir = sysconfig.get_python_inc() +- lib_dir = os.path.join(sysconfig.PREFIX, "libs") ++ import sysconfig + except ImportError: + return ++ config_vars = sysconfig.get_config_vars() ++ inc_dir = config_vars['INCLUDEPY'] ++ base_dir = config_vars.get('installed_base') or config_vars.get('base') ++ lib_dir = os.path.join(base_dir, 'libs') + + if sys.version_info[0] >= 3: + if self.swig_version < (3, 0, 10): +Index: build/get-py-info.py +=================================================================== +--- build/get-py-info.py (revision 1910097) ++++ build/get-py-info.py (revision 1910098) +@@ -44,7 +44,16 @@ + usage() + + try: +- from distutils import sysconfig ++ if sys.version_info[0] == 2: ++ from distutils import sysconfig ++ get_include = lambda: sysconfig.get_python_inc() ++ get_platinclude = lambda: sysconfig.get_python_inc(plat_specific=1) ++ get_purelib = lambda: sysconfig.get_python_lib() ++ else: ++ import sysconfig ++ get_include = lambda: sysconfig.get_path('include') ++ get_platinclude = lambda: sysconfig.get_path('platinclude') ++ get_purelib = lambda: sysconfig.get_path('purelib') + except ImportError: + # No information available + print("none") +@@ -51,8 +60,8 @@ + sys.exit(1) + + if sys.argv[1] == '--includes': +- inc = sysconfig.get_python_inc() +- plat = sysconfig.get_python_inc(plat_specific=1) ++ inc = get_include() ++ plat = get_platinclude() + if inc == plat: + print("-I" + inc) + else: +@@ -140,7 +149,7 @@ + sys.exit(0) + + if sys.argv[1] == '--site': +- print(sysconfig.get_python_lib()) ++ print(get_purelib()) + sys.exit(0) + + usage() diff --git a/.github/svn-swig41.patch b/.github/svn-swig41.patch new file mode 100644 index 0000000000..b0832321b0 --- /dev/null +++ b/.github/svn-swig41.patch @@ -0,0 +1,29 @@ +Index: subversion/bindings/swig/include/proxy.swg +=================================================================== +--- subversion/bindings/swig/include/proxy.swg (revision 1905172) ++++ subversion/bindings/swig/include/proxy.swg (revision 1905173) +@@ -66,7 +66,6 @@ + fn() + + %} +-#if defined(SWIGPYTHON_PY3) + #if SWIG_VERSION >= 0x040000 + %pythoncode %{ + # -classic and -modern options have been dropped and this variable +@@ -76,7 +75,7 @@ + _set_instance_attr = _swig_setattr_nondynamic_instance_variable(object.__setattr__) + + %} +-#else ++#elif defined(SWIGPYTHON_PY3) + %pythoncode %{ + # SWIG classes generated with -modern do not define this variable + try: +@@ -90,7 +89,6 @@ + _set_instance_attr = _swig_setattr_nondynamic_method(object.__setattr__) + + %} +-#endif + #else + %pythoncode %{ + # SWIG classes generated with -classic do not define this variable, diff --git a/.github/windows-prepare.ps1 b/.github/windows-prepare.ps1 index a943fa063b..ab5ae6e293 100644 --- a/.github/windows-prepare.ps1 +++ b/.github/windows-prepare.ps1 @@ -75,9 +75,9 @@ if (-not (Verify-Binary)) { Expand-Archive -LiteralPath $svnarc -DestinationPath "$workspace" Expand-Archive -LiteralPath $sqlite_arc -DestinationPath "$workspace" Set-Location -LiteralPath "$workspace\subversion-$svnver" - # for Subversion 1.14.2 with SWIG 4.1 - & svn diff -c1905173 https://svn.apache.org/repos/asf/subversion/branches/1.14.x/subversion/ ` - | & "C:\Program Files\Git\usr\bin\patch.exe" -d subversion -p0 + & git apply -v -p0 --whitespace=fix ` + "$workspace\.github\svn-swig41.patch" ` + "$workspace\.github\svn-py312.patch" & $python gen-make.py --release ` --vsnet-version=2019 ` "--with-apr=$vcpkg_dir" ` diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2c579feae..ab4933288b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-22.04, macos-12] - python-version: ['3.11'] + python-version: ['3.12'] tests: [functional] env: @@ -74,21 +74,22 @@ jobs: fail-fast: false matrix: include: - - {os: ubuntu-22.04, python-version: '3.11', tracdb: '', tests: functional} - - {os: ubuntu-22.04, python-version: '3.11', tracdb: sqlite, tests: functional} - - {os: ubuntu-22.04, python-version: '3.11', tracdb: postgresql, tests: functional} - - {os: ubuntu-22.04, python-version: '3.11', tracdb: mysql, tests: functional} + - {os: ubuntu-22.04, python-version: '3.12', tracdb: sqlite, tests: functional} + - {os: ubuntu-22.04, python-version: '3.12', tracdb: postgresql, tests: functional} + - {os: ubuntu-22.04, python-version: '3.12', tracdb: mysql, tests: functional} + - {os: ubuntu-22.04, python-version: '3.12', tracdb: ''} + - {os: ubuntu-22.04, python-version: '3.11', tracdb: ''} - {os: ubuntu-22.04, python-version: '3.10', tracdb: ''} - {os: ubuntu-22.04, python-version: '3.9', tracdb: ''} - {os: ubuntu-22.04, python-version: '3.8', tracdb: ''} - {os: ubuntu-22.04, python-version: '3.7', tracdb: ''} - {os: ubuntu-20.04, python-version: '3.6', tracdb: ''} - {os: ubuntu-20.04, python-version: '3.5', tracdb: ''} - - {os: macos-12, python-version: '3.11', tracdb: '', tests: functional} - - {os: macos-12, python-version: '3.11', tracdb: sqlite} - - {os: macos-12, python-version: '3.11', tracdb: postgresql} - - {os: macos-12, python-version: '3.11', tracdb: mysql} - - {os: macos-12, python-version: '3.10', tracdb: ''} + - {os: macos-12, python-version: '3.12', tracdb: sqlite, tests: functional} + - {os: macos-12, python-version: '3.12', tracdb: postgresql} + - {os: macos-12, python-version: '3.12', tracdb: mysql} + - {os: macos-12, python-version: '3.12', tracdb: ''} + - {os: macos-12, python-version: '3.11', tracdb: ''} env: MATRIX_OS: ${{ matrix.os }} @@ -146,6 +147,7 @@ jobs: fail-fast: false matrix: include: + - {os: ubuntu-22.04, python-version: '3.12'} - {os: ubuntu-22.04, python-version: '3.11'} - {os: ubuntu-22.04, python-version: '3.10'} - {os: ubuntu-22.04, python-version: '3.9'} @@ -153,8 +155,8 @@ jobs: - {os: ubuntu-22.04, python-version: '3.7'} - {os: ubuntu-20.04, python-version: '3.6'} - {os: ubuntu-20.04, python-version: '3.5'} + - {os: macos-12, python-version: '3.12'} - {os: macos-12, python-version: '3.11'} - - {os: macos-12, python-version: '3.10'} env: MATRIX_OS: ${{ matrix.os }} @@ -209,7 +211,7 @@ jobs: matrix: os: [windows-2022] architecture: [x64] - python-version: ['3.11'] + python-version: ['3.12'] tests: [functional] env: @@ -262,7 +264,7 @@ jobs: matrix: os: [windows-2022] architecture: [x64] - python-version: ['3.11'] + python-version: ['3.12'] subversion-version: ['1.14.3'] tracdb: ['', sqlite, postgresql, mysql] include: @@ -328,7 +330,7 @@ jobs: matrix: os: [windows-2022] architecture: [x64] - python-version: ['3.11'] + python-version: ['3.12'] subversion-version: ['1.14.3'] env: @@ -410,7 +412,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04] - python-version: ['3.11'] + python-version: ['3.12'] needs: [posix-test-minimum, posix-test, windows-test-minimum, windows-test]