Skip to content

Commit

Permalink
Add Python 3.12 to build workflow of GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jun66j5 committed May 5, 2024
1 parent 7d21fb1 commit 6d17c14
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .github/posix-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
77 changes: 77 additions & 0 deletions .github/svn-py312.patch
Original file line number Diff line number Diff line change
@@ -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()
29 changes: 29 additions & 0 deletions .github/svn-swig41.patch
Original file line number Diff line number Diff line change
@@ -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,
6 changes: 3 additions & 3 deletions .github/windows-prepare.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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" `
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -146,15 +147,16 @@ 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'}
- {os: ubuntu-22.04, python-version: '3.8'}
- {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 }}
Expand Down Expand Up @@ -209,7 +211,7 @@ jobs:
matrix:
os: [windows-2022]
architecture: [x64]
python-version: ['3.11']
python-version: ['3.12']
tests: [functional]

env:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit 6d17c14

Please sign in to comment.