From af87cfab2d06fb034a90412a87e0d4e660e214ee Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Wed, 25 Jun 2025 00:40:47 +0530 Subject: [PATCH 1/9] Update CI runners and scripts Signed-off-by: Ayan Sinha Mahapatra --- .github/workflows/docs-ci.yml | 2 +- .github/workflows/pypi-release.yml | 4 +- azure-pipelines.yml | 24 ++++-------- configure | 2 +- configure.bat | 4 +- etc/ci/azure-container-deb.yml | 2 +- etc/ci/azure-container-rpm.yml | 2 +- etc/scripts/utils_thirdparty.py | 61 +++++++++++++++--------------- 8 files changed, 46 insertions(+), 55 deletions(-) diff --git a/.github/workflows/docs-ci.yml b/.github/workflows/docs-ci.yml index 10ba5fa..8d8aa55 100644 --- a/.github/workflows/docs-ci.yml +++ b/.github/workflows/docs-ci.yml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.12] + python-version: [3.13] steps: - name: Checkout code diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index cf0579a..7f81361 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -31,10 +31,10 @@ jobs: python-version: 3.12 - name: Install pypa/build and twine - run: python -m pip install --user build twine + run: python -m pip install --user --upgrade build twine pkginfo - name: Build a binary wheel and a source tarball - run: python -m build --sdist --wheel --outdir dist/ + run: python -m build --sdist --outdir dist/ - name: Validate wheel and sdis for Pypi run: python -m twine check dist/* diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7a2d4d9..4d347b7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,7 +11,7 @@ jobs: parameters: job_name: run_code_checks image_name: ubuntu-24.04 - python_versions: ['3.12'] + python_versions: ['3.13'] test_suites: all: make check @@ -19,7 +19,7 @@ jobs: parameters: job_name: ubuntu22_cpython image_name: ubuntu-22.04 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -27,7 +27,7 @@ jobs: parameters: job_name: ubuntu24_cpython image_name: ubuntu-24.04 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -35,7 +35,7 @@ jobs: parameters: job_name: macos13_cpython image_name: macOS-13 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -43,7 +43,7 @@ jobs: parameters: job_name: macos14_cpython image_name: macOS-14 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -51,23 +51,15 @@ jobs: parameters: job_name: macos15_cpython image_name: macOS-15 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv/bin/pytest -n 2 -vvs - - template: etc/ci/azure-win.yml - parameters: - job_name: win2019_cpython - image_name: windows-2019 - python_versions: ['3.9', '3.10', '3.11', '3.12'] - test_suites: - all: venv\Scripts\pytest -n 2 -vvs - - template: etc/ci/azure-win.yml parameters: job_name: win2022_cpython image_name: windows-2022 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv\Scripts\pytest -n 2 -vvs @@ -75,6 +67,6 @@ jobs: parameters: job_name: win2025_cpython image_name: windows-2025 - python_versions: ['3.9', '3.10', '3.11', '3.12'] + python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] test_suites: all: venv\Scripts\pytest -n 2 -vvs diff --git a/configure b/configure index 5ef0e06..6d317d4 100755 --- a/configure +++ b/configure @@ -110,7 +110,7 @@ create_virtualenv() { fi $PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \ - --wheel embed --pip embed --setuptools embed \ + --pip embed --setuptools embed \ --seeder pip \ --never-download \ --no-periodic-update \ diff --git a/configure.bat b/configure.bat index 3e9881f..15ab701 100644 --- a/configure.bat +++ b/configure.bat @@ -110,7 +110,7 @@ if not exist "%CFG_BIN_DIR%\python.exe" ( if exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ( %PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^ - --wheel embed --pip embed --setuptools embed ^ + --pip embed --setuptools embed ^ --seeder pip ^ --never-download ^ --no-periodic-update ^ @@ -126,7 +126,7 @@ if not exist "%CFG_BIN_DIR%\python.exe" ( ) ) %PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" ^ - --wheel embed --pip embed --setuptools embed ^ + --pip embed --setuptools embed ^ --seeder pip ^ --never-download ^ --no-periodic-update ^ diff --git a/etc/ci/azure-container-deb.yml b/etc/ci/azure-container-deb.yml index 85b611d..d80e8df 100644 --- a/etc/ci/azure-container-deb.yml +++ b/etc/ci/azure-container-deb.yml @@ -21,7 +21,7 @@ jobs: - job: ${{ parameters.job_name }} pool: - vmImage: 'ubuntu-16.04' + vmImage: 'ubuntu-22.04' container: image: ${{ parameters.container }} diff --git a/etc/ci/azure-container-rpm.yml b/etc/ci/azure-container-rpm.yml index 1e6657d..a64138c 100644 --- a/etc/ci/azure-container-rpm.yml +++ b/etc/ci/azure-container-rpm.yml @@ -1,6 +1,6 @@ parameters: job_name: '' - image_name: 'ubuntu-16.04' + image_name: 'ubuntu-22.04' container: '' python_path: '' python_version: '' diff --git a/etc/scripts/utils_thirdparty.py b/etc/scripts/utils_thirdparty.py index aafc1d6..6f812f0 100644 --- a/etc/scripts/utils_thirdparty.py +++ b/etc/scripts/utils_thirdparty.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # # Copyright (c) nexB Inc. and others. All rights reserved. # ScanCode is a trademark of nexB Inc. @@ -24,13 +25,14 @@ import packageurl import requests import saneyaml -import utils_pip_compatibility_tags from commoncode import fileutils from commoncode.hash import multi_checksums from commoncode.text import python_safe_name from packvers import tags as packaging_tags from packvers import version as packaging_version +import utils_pip_compatibility_tags + """ Utilities to manage Python thirparty libraries source, binaries and metadata in local directories and remote repositories. @@ -91,8 +93,7 @@ - parse requirement file - create a TODO queue of requirements to process -- done: create an empty map of processed binary requirements as - {package name: (list of versions/tags} +- done: create an empty map of processed binary requirements as {package name: (list of versions/tags} - while we have package reqs in TODO queue, process one requirement: @@ -114,13 +115,14 @@ TRACE_ULTRA_DEEP = False # Supported environments -PYTHON_VERSIONS = "37", "38", "39", "310" +PYTHON_VERSIONS = "39", "310", "311", "312", "313" PYTHON_DOT_VERSIONS_BY_VER = { - "37": "3.7", - "38": "3.8", "39": "3.9", "310": "3.10", + "311": "3.11", + "312": "3.12", + "313": "3.13", } @@ -132,10 +134,11 @@ def get_python_dot_version(version): ABIS_BY_PYTHON_VERSION = { - "37": ["cp37", "cp37m", "abi3"], - "38": ["cp38", "cp38m", "abi3"], "39": ["cp39", "cp39m", "abi3"], "310": ["cp310", "cp310m", "abi3"], + "311": ["cp311", "cp311m", "abi3"], + "312": ["cp312", "cp312m", "abi3"], + "313": ["cp313", "cp313m", "abi3"], } PLATFORMS_BY_OS = { @@ -553,8 +556,7 @@ def download(self, dest_dir=THIRDPARTY_DIR): Download this distribution into `dest_dir` directory. Return the fetched filename. """ - if not self.filename: - raise ValueError(f"self.filename has no value but is required: {self.filename!r}") + assert self.filename if TRACE_DEEP: print( f"Fetching distribution of {self.name}=={self.version}:", @@ -822,9 +824,9 @@ def fetch_license_files(self, dest_dir=THIRDPARTY_DIR, use_cached_index=False): """ urls = LinksRepository.from_url(use_cached_index=use_cached_index).links errors = [] - extra_lic_names = [lic.get("file") for lic in self.extra_data.get("licenses", {})] + extra_lic_names = [l.get("file") for l in self.extra_data.get("licenses", {})] extra_lic_names += [self.extra_data.get("license_file")] - extra_lic_names = [eln for eln in extra_lic_names if eln] + extra_lic_names = [ln for ln in extra_lic_names if ln] lic_names = [f"{key}.LICENSE" for key in self.get_license_keys()] for filename in lic_names + extra_lic_names: floc = os.path.join(dest_dir, filename) @@ -844,7 +846,7 @@ def fetch_license_files(self, dest_dir=THIRDPARTY_DIR, use_cached_index=False): if TRACE: print(f"Fetched license from remote: {lic_url}") - except Exception: + except: try: # try licensedb second lic_url = f"{LICENSEDB_API_URL}/{filename}" @@ -857,9 +859,8 @@ def fetch_license_files(self, dest_dir=THIRDPARTY_DIR, use_cached_index=False): if TRACE: print(f"Fetched license from licensedb: {lic_url}") - except Exception: - msg = f"No text for license {filename} in expression " - f"{self.license_expression!r} from {self}" + except: + msg = f'No text for license {filename} in expression "{self.license_expression}" from {self}' print(msg) errors.append(msg) @@ -999,7 +1000,7 @@ def get_license_link_for_filename(filename, urls): exception if no link is found or if there are more than one link for that file name. """ - path_or_url = [url for url in urls if url.endswith(f"/{filename}")] + path_or_url = [l for l in urls if l.endswith(f"/{filename}")] if not path_or_url: raise Exception(f"Missing link to file: {filename}") if not len(path_or_url) == 1: @@ -1288,7 +1289,7 @@ def is_pure(self): def is_pure_wheel(filename): try: return Wheel.from_filename(filename).is_pure() - except Exception: + except: return False @@ -1484,7 +1485,8 @@ def get_distributions(self): """ if self.sdist: yield self.sdist - yield from self.wheels + for wheel in self.wheels: + yield wheel def get_url_for_filename(self, filename): """ @@ -1613,8 +1615,7 @@ class PypiSimpleRepository: type=dict, default=attr.Factory(lambda: defaultdict(dict)), metadata=dict( - help="Mapping of {name: {version: PypiPackage, version: PypiPackage, etc} " - "available in this repo" + help="Mapping of {name: {version: PypiPackage, version: PypiPackage, etc} available in this repo" ), ) @@ -1628,8 +1629,7 @@ class PypiSimpleRepository: type=bool, default=False, metadata=dict( - help="If True, use any existing on-disk cached PyPI index files. " - "Otherwise, fetch and cache." + help="If True, use any existing on-disk cached PyPI index files. Otherwise, fetch and cache." ), ) @@ -1638,8 +1638,7 @@ def _get_package_versions_map(self, name): Return a mapping of all available PypiPackage version for this package name. The mapping may be empty. It is ordered by version from oldest to newest """ - if not name: - raise ValueError(f"name is required: {name!r}") + assert name normalized_name = NameVer.normalize_name(name) versions = self.packages[normalized_name] if not versions and normalized_name not in self.fetched_package_normalized_names: @@ -1694,7 +1693,7 @@ def fetch_links(self, normalized_name): ) links = collect_urls(text) # TODO: keep sha256 - links = [link.partition("#sha256=") for link in links] + links = [l.partition("#sha256=") for l in links] links = [url for url, _, _sha256 in links] return links @@ -1915,7 +1914,7 @@ def get_remote_file_content( # several redirects and that we can ignore content there. A HEAD request may # not get us this last header print(f" DOWNLOADING: {url}") - with requests.get(url, allow_redirects=True, stream=True, headers=headers) as response: # noqa: S113 + with requests.get(url, allow_redirects=True, stream=True, headers=headers) as response: status = response.status_code if status != requests.codes.ok: # NOQA if status == 429 and _delay < 20: @@ -2134,7 +2133,7 @@ def call(args, verbose=TRACE): """ if TRACE_DEEP: print("Calling:", " ".join(args)) - with subprocess.Popen( # noqa: S603 + with subprocess.Popen( args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8" ) as process: stdouts = [] @@ -2199,7 +2198,7 @@ def download_wheels_with_pip( cli_args.extend(["--requirement", req_file]) if TRACE: - print("Downloading wheels using command:", " ".join(cli_args)) + print(f"Downloading wheels using command:", " ".join(cli_args)) existing = set(os.listdir(dest_dir)) error = False @@ -2232,7 +2231,7 @@ def download_wheels_with_pip( def check_about(dest_dir=THIRDPARTY_DIR): try: - subprocess.check_output(f"venv/bin/about check {dest_dir}".split()) # noqa: S603 + subprocess.check_output(f"venv/bin/about check {dest_dir}".split()) except subprocess.CalledProcessError as cpe: print() print("Invalid ABOUT files:") @@ -2283,5 +2282,5 @@ def get_license_expression(declared_licenses): return get_only_expression_from_extracted_license(declared_licenses) except ImportError: # Scancode is not installed, clean and join all the licenses - lics = [python_safe_name(lic).lower() for lic in declared_licenses] + lics = [python_safe_name(l).lower() for l in declared_licenses] return " AND ".join(lics).lower() From 72c7d266275a472073d2829a25d730ada9436ab3 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Wed, 25 Jun 2025 18:16:30 +0530 Subject: [PATCH 2/9] Add missing wheel builds on release CI Signed-off-by: Ayan Sinha Mahapatra --- .github/workflows/pypi-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 7f81361..d41fbf2 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -34,7 +34,7 @@ jobs: run: python -m pip install --user --upgrade build twine pkginfo - name: Build a binary wheel and a source tarball - run: python -m build --sdist --outdir dist/ + run: python -m build --wheel --sdist --outdir dist/ - name: Validate wheel and sdis for Pypi run: python -m twine check dist/* From 265e6121c9bf0eb331e8465a08efb2cc9a169500 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Tue, 21 Oct 2025 20:07:02 +0530 Subject: [PATCH 3/9] Drop python3.9 support and add python 3.14 Signed-off-by: Ayan Sinha Mahapatra --- azure-pipelines.yml | 14 +++++++------- etc/scripts/utils_thirdparty.py | 6 +++--- setup.cfg | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4d347b7..7230c41 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ jobs: parameters: job_name: ubuntu22_cpython image_name: ubuntu-22.04 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -27,7 +27,7 @@ jobs: parameters: job_name: ubuntu24_cpython image_name: ubuntu-24.04 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -35,7 +35,7 @@ jobs: parameters: job_name: macos13_cpython image_name: macOS-13 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -43,7 +43,7 @@ jobs: parameters: job_name: macos14_cpython image_name: macOS-14 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -51,7 +51,7 @@ jobs: parameters: job_name: macos15_cpython image_name: macOS-15 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv/bin/pytest -n 2 -vvs @@ -59,7 +59,7 @@ jobs: parameters: job_name: win2022_cpython image_name: windows-2022 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv\Scripts\pytest -n 2 -vvs @@ -67,6 +67,6 @@ jobs: parameters: job_name: win2025_cpython image_name: windows-2025 - python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python_versions: ['3.10', '3.11', '3.12', '3.13', '3.14'] test_suites: all: venv\Scripts\pytest -n 2 -vvs diff --git a/etc/scripts/utils_thirdparty.py b/etc/scripts/utils_thirdparty.py index 6f812f0..bc68ac7 100644 --- a/etc/scripts/utils_thirdparty.py +++ b/etc/scripts/utils_thirdparty.py @@ -115,14 +115,14 @@ TRACE_ULTRA_DEEP = False # Supported environments -PYTHON_VERSIONS = "39", "310", "311", "312", "313" +PYTHON_VERSIONS = "310", "311", "312", "313", "314" PYTHON_DOT_VERSIONS_BY_VER = { - "39": "3.9", "310": "3.10", "311": "3.11", "312": "3.12", "313": "3.13", + "314": "3.14", } @@ -134,11 +134,11 @@ def get_python_dot_version(version): ABIS_BY_PYTHON_VERSION = { - "39": ["cp39", "cp39m", "abi3"], "310": ["cp310", "cp310m", "abi3"], "311": ["cp311", "cp311m", "abi3"], "312": ["cp312", "cp312m", "abi3"], "313": ["cp313", "cp313m", "abi3"], + "314": ["cp314", "cp314m", "abi3"], } PLATFORMS_BY_OS = { diff --git a/setup.cfg b/setup.cfg index 69f850c..fa111c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ license_files = README.rst [options] -python_requires = >=3.9 +python_requires = >=3.10 package_dir = =src From fc4fe3addd98f64684d146926d7f318a9fd469c4 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Wed, 22 Oct 2025 18:44:23 +0530 Subject: [PATCH 4/9] Support trusted-publishing for package releases Signed-off-by: Ayan Sinha Mahapatra --- .github/workflows/pypi-release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index d41fbf2..7da0a40 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -71,6 +71,9 @@ jobs: needs: - create-gh-release runs-on: ubuntu-24.04 + environment: pypi-publish + permissions: + id-token: write steps: - name: Download built archives @@ -81,6 +84,4 @@ jobs: - name: Publish to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From e81ff6d37248d93689f9947581a7a2148c96785d Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Fri, 24 Oct 2025 16:43:15 +0530 Subject: [PATCH 5/9] Update RTD build python version Signed-off-by: Ayan Sinha Mahapatra --- .readthedocs.yml | 2 +- pyproject.toml | 2 +- setup.cfg | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 683f3a8..27c1595 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.13" # Build PDF & ePub formats: diff --git a/pyproject.toml b/pyproject.toml index d79574e..f106e69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 50", "wheel", "setuptools_scm[toml] >= 6"] +requires = ["setuptools >= 50", "wheel"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] diff --git a/setup.cfg b/setup.cfg index fa111c2..a0f2985 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,9 +39,6 @@ packages = find: include_package_data = true zip_safe = false -setup_requires = setuptools_scm[toml] >= 4 - - install_requires = From cf04877d745eef6a279323dabe8a937a509926ef Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Mon, 15 Dec 2025 16:17:29 +0530 Subject: [PATCH 6/9] Deprecate MacOS-13 CI runners Reference: https://github.com/actions/runner-images/issues/13046 Signed-off-by: Ayan Sinha Mahapatra --- azure-pipelines.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7230c41..3b17abc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,14 +31,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 From ffbc2d8038bff56b48c778e79cfb229a7932f7c9 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Mon, 29 Dec 2025 15:38:16 +0530 Subject: [PATCH 7/9] Update depedencies to fix conflicts Reference: https://github.com/aboutcode-org/binary-inspector/issues/13 Signed-off-by: Ayan Sinha Mahapatra --- requirements-dev.txt | 2 +- requirements.txt | 7 +++---- setup.cfg | 7 +++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index b159643..a5eb35b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1 +1 @@ -scancode-toolkit==32.3.3 \ No newline at end of file +scancode-toolkit==32.4.1 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 43a053f..6859828 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ # from blint v2.3.2 # https://github.com/owasp-dep-scan/blint/blob/1e1250a4bf6c25eccba8970bd877901ee56070c7/poetry.lock -lief==0.15.1 +lief==0.17.0 symbolic==10.2.1 -click==8.2.1;python_version>='3.10' -click==8.1.7;python_version<'3.10' -commoncode==32.3.0 \ No newline at end of file +click==8.3.0 +commoncode==32.4.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index d758725..cbccb3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,15 +39,14 @@ zip_safe = false setup_requires = setuptools_scm[toml] >= 4 -python_requires = >=3.9 +python_requires = >=3.10 install_requires = - click >= 6.7, !=7.0;python_version<'3.10' - click >= 8.2.0;python_version>='3.10' + click >= 8.2.0 commoncode plugincode typecode - lief==0.15.1 + lief==0.17.0 symbolic==10.2.1 [options.entry_points] From 6bc5150b00d56f5ef819ed09a20c2a72bc1d4f18 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Mon, 29 Dec 2025 15:56:06 +0530 Subject: [PATCH 8/9] Fix test failures from lief update Signed-off-by: Ayan Sinha Mahapatra --- src/binary_inspector/blint_binary.py | 16 +++-- tests/data/macho/Lumen-symbols-plugin.json | 68 +++++++++++++++++++++- tests/test_binary.py | 2 +- tests/test_plugin.py | 4 +- 4 files changed, 81 insertions(+), 9 deletions(-) diff --git a/src/binary_inspector/blint_binary.py b/src/binary_inspector/blint_binary.py index 510b495..325129a 100644 --- a/src/binary_inspector/blint_binary.py +++ b/src/binary_inspector/blint_binary.py @@ -326,12 +326,18 @@ def process_pe_resources(parsed_obj): return {} resources = {} version_metadata = {} - version_info: lief.PE.ResourceVersion = rm.version if rm.has_version else None - if version_info and version_info.has_string_file_info: + + version_info = rm.version if rm.has_version else None + if isinstance(version_info, list) and len(version_info): + if not isinstance(version_info[0], lief.lief_errors): + version_info = version_info[0] + if version_info and hasattr(version_info, "string_file_info"): string_file_info: lief.PE.ResourceStringFileInfo = version_info.string_file_info - for lc_item in string_file_info.langcode_items: - if lc_item.items: - version_metadata.update(lc_item.items) + for lc_item in string_file_info.children: + if lc_item.entries: + for e in lc_item.entries: + version_metadata[e.key] = e.value + try: resources = { "has_accelerator": rm.has_accelerator, diff --git a/tests/data/macho/Lumen-symbols-plugin.json b/tests/data/macho/Lumen-symbols-plugin.json index 0c418f2..33fec4d 100644 --- a/tests/data/macho/Lumen-symbols-plugin.json +++ b/tests/data/macho/Lumen-symbols-plugin.json @@ -9,12 +9,14 @@ "CFConstantStringClassReference", "CFDataGetBytePtr", "CFRelease", + "CFStringGetCStringPtr", "CGDataProviderCopyData", "CGDisplayCreateImage", "CGImageGetDataProvider", "CGImageGetHeight", "CGImageGetWidth", "CGMainDisplayID", + "DefaultRuneLocale", "IODisplayGetFloatParameter", "IODisplaySetFloatParameter", "IOIteratorNext", @@ -54,36 +56,100 @@ "NSUserDefaults", "NSWindowController", "NSWorkspace", + "abort", + "add", + "addMethod", + "addProperty", + "addProtocol", + "allocateClassPair", + "asprintf", "assign", + "autoreleasePoolPush", "autoreleaseReturnValue", "binder", + "bzero", + "calloc", + "class", + "constructInstance", + "copy", + "copyAttributeList", + "copyClassNamesForImage", + "create", "destroyWeak", "dispatch", "dispose", "dyld", "enumerationMutation", "fail", + "for", + "free", + "func", + "getClass", + "getIndexedIvars", + "getInstanceMethod", + "getInstanceSize", + "getInstanceVariable", + "getIvar", + "getIvarLayout", + "getMetaClass", + "getMethodDescription", + "getName", + "getOffset", + "getProtocol", + "getRequiredClass", + "getSuperclass", + "getUid", "guard", + "hash", "header", + "image", + "initializeClassPair", + "isMetaClass", + "ivar", "kCFAllocatorDefault", + "kCFCoreFoundationVersionNumber", "kIOMasterPortDefault", + "loadClassref", "loadWeakRetained", + "lock", + "lookUpClass", "main", + "malloc", + "memcpy", + "method", "mh", "msgSend", "msgSendSuper2", + "mutex", "object", "pow", + "property", + "protocol", + "pthread", + "readClassPair", + "register", + "registerClassPair", "release", + "replaceMethod", + "respondsToSelector", "retain", "retainAutorelease", "retainAutoreleaseReturnValue", "retainAutoreleasedReturnValue", + "search", + "sel", + "setImplementation", + "setIvar", "sleep", "stack", "storeStrong", "storeWeak", - "stub" + "strcmp", + "strlen", + "strncmp", + "stub", + "unlock", + "vtable" ], "scan_errors": [] } diff --git a/tests/test_binary.py b/tests/test_binary.py index 25846e2..b9ee08d 100644 --- a/tests/test_binary.py +++ b/tests/test_binary.py @@ -64,4 +64,4 @@ def test_can_parse_and_demangle_macho_binary_symbols(): winpe_binary = test_env.get_test_loc("winpe/TranslucentTB-setup.exe") winpe_symbols = binary.collect_and_parse_winpe_symbols(winpe_binary) expected = test_env.get_test_loc("winpe/TranslucentTB-symbols.json") - check_json(expected, winpe_symbols, regen=True) + check_json(expected, winpe_symbols, regen=REGEN_TEST_FIXTURES) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 534afed..6b7be3c 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -25,7 +25,7 @@ def test_scancode_plugin_with_winpe_symbol_option(): args = ["--winpe-symbol", test_file, "--json", result_file] run_scan_click(args) expected = test_env.get_test_loc("winpe/TranslucentTB-symbols-plugin.json") - check_json_scan(expected, result_file, regen=True) + check_json_scan(expected, result_file, regen=REGEN_TEST_FIXTURES) def test_scancode_plugin_with_macho_symbol_option(): @@ -34,4 +34,4 @@ def test_scancode_plugin_with_macho_symbol_option(): args = ["--macho-symbol", test_file, "--json", result_file] run_scan_click(args) expected = test_env.get_test_loc("macho/Lumen-symbols-plugin.json") - check_json_scan(expected, result_file, regen=True) + check_json_scan(expected, result_file, regen=REGEN_TEST_FIXTURES) From 0c9e0124f0fe0211181ce6399f5f80a166ab9417 Mon Sep 17 00:00:00 2001 From: Ayan Sinha Mahapatra Date: Mon, 29 Dec 2025 16:00:31 +0530 Subject: [PATCH 9/9] Update version and CHANGELOG for release Signed-off-by: Ayan Sinha Mahapatra --- CHANGELOG.rst | 5 +++++ README.rst | 4 ++-- setup.cfg | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6b5e050..fee2fbf 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +v0.2.0 +------ + +Minor release with updated dependencies and python support. + v0.1.2 ------ diff --git a/README.rst b/README.rst index 70166a4..e190efd 100644 --- a/README.rst +++ b/README.rst @@ -103,8 +103,8 @@ Communications Networks, Content and Technology under grant agreement No 1010695 :height: 30 :alt: AboutCode logo -.. |swiss| image:: https://www.sbfi.admin.ch/sbfi/en/_jcr_content/logo/image.imagespooler.png/1493119032540/logo.png - :target: https://www.sbfi.admin.ch/sbfi/en/home/seri/seri.html +.. |swiss| image:: https://www.sbfi.admin.ch/images/swiss-logo-flag.svg + :target: https://www.sbfi.admin.ch/de :height: 40 :alt: Swiss logo diff --git a/setup.cfg b/setup.cfg index cbccb3f..aa31318 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,7 @@ [metadata] name = binary-inspector license = Apache-2.0 AND MIT +version = 0.2.0 # description must be on ONE line https://github.com/pypa/setuptools/issues/1390 description = binary-inspector is a library and tools to inspect binaries (elf, winpe, mach0) for symbols and other information, and models to store this.