Skip to content

Commit

Permalink
[#7] Support Python 3.12 (and Python3.11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mi-La committed Feb 13, 2024
1 parent c5c5155 commit 108b4d0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-20.04", "ubuntu-22.04"]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,6 +37,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install virtualenv
python -m pip install setuptools # necessary for pkg_resources on Python 3.12
- name: Build Zserio PyPi
run: scripts/build.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: ["windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,6 +37,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install virtualenv
python -m pip install setuptools # necessary for pkg_resources on Python 3.12
- name: Build Zserio PyPi
run: scripts/build.sh
Expand Down
2 changes: 2 additions & 0 deletions scripts/common_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ check_python_version()
}

# Check python requirements.
#
# Note: From Python 3.12, setuptools must be installed.
check_python_requirements()
{
exit_if_argc_ne $# 2
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test()
local PYPI_DISTR_DIR="$1"; shift
local TEST_PACKAGE_EXTENSION="$1"; shift

local TEST_PYTHON_REQUIREMENTS=("coverage==6.5.0" "pylint==2.12.2" "mypy==0.931")
local TEST_PYTHON_REQUIREMENTS=("coverage==6.5.0" "pylint==3.0.3" "mypy==0.931")
activate_python_virtualenv "${TEST_BUILD_DIR}" TEST_PYTHON_REQUIREMENTS[@]
if [ $? -ne 0 ] ; then
return 1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _download_latest_zserio_release() -> str:
print("extracting the latest zserio binaries")
zserio_bin_zip_file = zipfile.ZipFile(io.BytesIO(zserio_bin_zip.read()), 'r')
zserio_bin_zip_file.extractall(DOWNLOAD_DIR)

print("downloading the latest zserio runtime")
zserio_runtime_libs_zip = urllib.request.urlopen(zserio_runtime_libs_zip_url)
print("extracting the latest zserio runtime")
Expand Down
8 changes: 4 additions & 4 deletions test/test_compiler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
import os
import distutils.dir_util
import shutil
import importlib
import subprocess

Expand Down Expand Up @@ -48,7 +48,7 @@ def test_generate_default_package(self):
zs_dir = os.path.join(self._get_test_zs_dir(), "default_package")
build_dir = os.path.join(self._get_build_test_dir(), "generate_default_package")
test_zs_dir = os.path.join(build_dir, "zs")
distutils.dir_util.copy_tree(zs_dir, test_zs_dir)
shutil.copytree(zs_dir, test_zs_dir, dirs_exist_ok = True)
gen_dir = os.path.join(build_dir, "gen")
main_zs_file = "structure_default.zs"
current_dir = os.getcwd()
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_generate_without_gen_dir(self):
zs_dir = os.path.join(self._get_test_zs_dir(), "main_zs_without_path")
build_dir = os.path.join(self._get_build_test_dir(), "generate_without_gen_dir")
test_zs_dir = os.path.join(build_dir, "zs")
distutils.dir_util.copy_tree(zs_dir, test_zs_dir)
shutil.copytree(zs_dir, test_zs_dir, dirs_exist_ok = True)
main_zs_file = "structure_without_path.zs"
current_dir = os.getcwd()
os.chdir(test_zs_dir)
Expand All @@ -131,7 +131,7 @@ def test_generate_without_gen_dir_with_zs_dir(self):
zs_dir = os.path.join(self._get_test_zs_dir(), "main_zs_without_path")
build_dir = os.path.join(self._get_build_test_dir(), "generate_without_gen_dir_with_zs_dir")
test_zs_dir = os.path.join(build_dir, "zs")
distutils.dir_util.copy_tree(zs_dir, test_zs_dir)
shutil.copytree(zs_dir, test_zs_dir, dirs_exist_ok = True)
main_zs_file = "structure_without_path.zs"
api = generate(main_zs_file, zs_dir=test_zs_dir)

Expand Down

0 comments on commit 108b4d0

Please sign in to comment.