From efe5f211aa520cac8495cec650168e41178d4710 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Wed, 7 Jan 2026 14:37:15 +0530 Subject: [PATCH 1/2] Update system.py for py314 Signed-off-by: Ayan Sinha Mahapatra --- CHANGELOG.rst | 5 +++++ azure-pipelines.yml | 18 +++++++++--------- src/commoncode/system.py | 8 ++++---- tests/test_command.py | 2 -- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4550c80e..25495220 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Release notes ============= +Version 32.4.1 - (2025-01-07) +----------------------------- + +- Update system.py for python3.14 + Version 32.4.0 - (2025-10-22) ----------------------------- diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1946a604..df185c43 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,14 +25,6 @@ jobs: test_suites: all: venv/bin/pytest -n 2 -vvs - - template: etc/ci/azure-posix.yml - parameters: - job_name: macos13_cpython - image_name: macOS-13 - python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"] - test_suites: - all: venv/bin/pytest -n 2 -vvs - - template: etc/ci/azure-posix.yml parameters: job_name: macos14_cpython @@ -41,6 +33,14 @@ jobs: test_suites: all: venv/bin/pytest -n 2 -vvs + - template: etc/ci/azure-posix.yml + parameters: + job_name: macos15_cpython + image_name: macOS-15 + python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"] + test_suites: + all: venv/bin/pytest -n 2 -vvs + - template: etc/ci/azure-win.yml parameters: job_name: win2025_cpython @@ -68,7 +68,7 @@ jobs: python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"] test_suites: click_versions: | - for clk_ver in 8.3.0 8.2.0 8.2.1 8.1.8 8.1.7 8.1.6 8.1.5 8.1.4 8.1.3 8.1.2 8.1.1 8.1.0 8.0.4 8.0.2 8.0.3 8.0.1 7.1.2 7.1.1 7.1 6.7; + for clk_ver in 8.3.1 8.3.0 8.2.0 8.2.1 8.1.8 8.1.7 8.1.6 8.1.5 8.1.4 8.1.3 8.1.2 8.1.1 8.1.0 8.0.4 8.0.2 8.0.3 8.0.1 7.1.2 7.1.1 7.1 6.7; do venv/bin/pip install click==$clk_ver; venv/bin/pytest -vvs tests/test_cliutils_progressbar.py; diff --git a/src/commoncode/system.py b/src/commoncode/system.py index ea6f7d36..3c5a6744 100644 --- a/src/commoncode/system.py +++ b/src/commoncode/system.py @@ -144,11 +144,11 @@ def has_case_sensitive_fs(): py3 = _sys_v0 == 3 _sys_v1 = sys.version_info[1] -py36 = py3 and _sys_v1 == 6 -py37 = py3 and _sys_v1 == 7 -py38 = py3 and _sys_v1 == 8 -py39 = py3 and _sys_v1 == 9 py310 = py3 and _sys_v1 == 10 +py311 = py3 and _sys_v1 == 11 +py312 = py3 and _sys_v1 == 12 +py313 = py3 and _sys_v1 == 13 +py314 = py3 and _sys_v1 == 14 # Do not let Windows error pop up messages with default SetErrorMode # See http://msdn.microsoft.com/en-us/library/ms680621(VS100).aspx diff --git a/tests/test_command.py b/tests/test_command.py index 173b6c61..d0f735f1 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -15,14 +15,12 @@ from commoncode.system import on_linux from commoncode.system import on_mac from commoncode.system import on_windows -from commoncode.system import py36 from commoncode.testcase import FileBasedTesting class TestCommand(FileBasedTesting): test_data_dir = os.path.join(os.path.dirname(__file__), "data") - @skipIf(py36, "This fails on Python 3.6 https://bugs.python.org/issue26919") def test_execute_can_handle_non_ascii_output(self): # Popen returns a *binary* string with non-ascii chars: skips these python = sys.executable From c284fa431aef8b20dc18acb5a390345aa3e554c9 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Thu, 8 Jan 2026 13:08:50 +0530 Subject: [PATCH 2/2] Support setting the tarfile extract filter This is needed for python 3.14 support. Reference: https://github.com/aboutcode-org/commoncode/issues/88 Signed-off-by: Ayan Sinha Mahapatra --- CHANGELOG.rst | 6 ++++++ src/commoncode/archive.py | 8 ++++++-- src/commoncode/testcase.py | 8 ++++---- tests/data/filetype/types.tar | Bin 112640 -> 109056 bytes tests/test_filetype.py | 5 ++++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 25495220..dc638663 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Release notes ============= +Version 32.4.2 - (2025-01-08) +----------------------------- + +- Support setting the tar archive filter in python3.14 + https://github.com/aboutcode-org/commoncode/issues/88 + Version 32.4.1 - (2025-01-07) ----------------------------- diff --git a/src/commoncode/archive.py b/src/commoncode/archive.py index 3c0c7583..1d3e42cc 100644 --- a/src/commoncode/archive.py +++ b/src/commoncode/archive.py @@ -14,6 +14,7 @@ from os import path from commoncode.system import on_windows +from commoncode.system import py314 """ Mimimal tar and zip file handling, primarily for testing. @@ -39,7 +40,7 @@ def _extract_tar_raw(test_path, target_dir, to_bytes, *args, **kwargs): extract_tar_uni = partial(_extract_tar_raw, to_bytes=False) -def extract_tar(location, target_dir, verbatim=False, *args, **kwargs): +def extract_tar(location, target_dir, verbatim=False, filter=None, *args, **kwargs): """ Extract a tar archive at location in the target_dir directory. If `verbatim` is True preserve the permissions. @@ -58,7 +59,10 @@ def extract_tar(location, target_dir, verbatim=False, *args, **kwargs): if not verbatim: tarinfo.mode = 0o755 to_extract.append(tarinfo) - tar.extractall(target_dir, members=to_extract) + if py314 and filter: + tar.extractall(target_dir, members=to_extract, filter=filter) + else: + tar.extractall(target_dir, members=to_extract) finally: if tar: tar.close() diff --git a/src/commoncode/testcase.py b/src/commoncode/testcase.py index 525bf666..2a7b37a9 100644 --- a/src/commoncode/testcase.py +++ b/src/commoncode/testcase.py @@ -194,7 +194,7 @@ def remove_vcs(self, test_dir): for tf in tilde_files: os.remove(tf) - def __extract(self, test_path, extract_func=None, verbatim=False): + def __extract(self, test_path, extract_func=None, verbatim=False, filter=None): """ Given an archive file identified by test_path relative to a test files directory, return a new temp directory where the @@ -206,7 +206,7 @@ def __extract(self, test_path, extract_func=None, verbatim=False): target_path = path.basename(test_path) target_dir = self.get_temp_dir(target_path) original_archive = self.get_test_loc(test_path) - extract_func(original_archive, target_dir, verbatim=verbatim) + extract_func(original_archive, target_dir, verbatim=verbatim, filter=filter) return target_dir def extract_test_zip(self, test_path, *args, **kwargs): @@ -215,8 +215,8 @@ def extract_test_zip(self, test_path, *args, **kwargs): def extract_test_zip_raw(self, test_path, *args, **kwargs): return self.__extract(test_path, extract_zip_raw) - def extract_test_tar(self, test_path, verbatim=False): - return self.__extract(test_path, extract_tar, verbatim) + def extract_test_tar(self, test_path, verbatim=False, filter=None): + return self.__extract(test_path, extract_tar, verbatim, filter) def extract_test_tar_raw(self, test_path, *args, **kwargs): return self.__extract(test_path, extract_tar_raw) diff --git a/tests/data/filetype/types.tar b/tests/data/filetype/types.tar index 24fc04c44da43ac26ebb53a04feca6c8d1a04342..458dc4476efa3cb3b3507135af450adc925a1bfa 100644 GIT binary patch delta 1169 zcmZqpz}9eujnhCk$kjb0GQf4>!f0^=ATTpAVE|Hw=B8lUz|h2Wa`hbAM@K!$(-P{)czX9W1*7U_n#MubdU7>3)n z57O)=hGyhjx9Jm;-(;p^E#f8&h6V=a<|byQCI*HK28M=4<|YgZJ|Iu9Lp?E3&=H%9 zH#431$H>IMFq!E@3T}sWbiIafemMbq#<)tQ!Iwd zu$h<`Gbosnmxj2^blp7N{2_jb!W}0^fYz8BFesRjXAMWNZg7BOP%tn*#Ne`IdbI6vn5dshGF`G?Hi+a{_sf&Yw#d&tOSobOQ!3LCT^r#5HYqZcJEs062jc zaHB_ny(civYeYb8QfD)1lli^xd*2tmInldQI%%Z7)k^McskLMPfLh|_ZGL5kp#-f^ zASjOkqV}4MOY=CW-t_u@mviRd`t9CT`_hlA_1*7}^ttk4#v}`xvaf{Lq|>xCT)2)z zU>pkI=Kk`r67$A%%%2Xe36Vz`S<7Gg({SWEP4tQjO)8oh8GKvB#n?QL4B5OR>Wx;S(llqQHGn_B}XdAu|n zxMiV`am>aRjJB4~s~zunSyhTEoE?