Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# chore: run ruff on all files
d48354b3b86ddf160e8d3359b33f32a02c565cad
11 changes: 5 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy
name: Deploy

on:
release:
Expand All @@ -15,6 +15,7 @@ concurrency:

jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -26,10 +27,9 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0

- name: Install requirements and build wheel
shell: bash -l {0}
run: |
python -m pip install build
python -m build .
python -m build

- name: Store the distribution packages
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand All @@ -39,7 +39,7 @@ jobs:
if-no-files-found: error

publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
name: Publish Python 🐍 distributions 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -48,9 +48,8 @@ jobs:
name: pypi
url: https://pypi.org/p/auditwheel-emscripten
permissions:
contents: write
id-token: write # IMPORTANT: mandatory for trusted publishing
attestations: write
attestations: write # For generating artifact attestations
steps:
- name: Download all the dists
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Test

on:
push:
Expand Down
31 changes: 13 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,56 @@ default_language_version:
python: "3.13"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
exclude: .clang-format
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: "v3.19.1"
rev: "75992aaa40730136014f34227e0135f63fc951b4" # frozen: v3.21.2
hooks:
- id: pyupgrade
args: ["--py312-plus"]

- repo: https://github.com/hadialqattan/pycln
rev: "v2.5.0"
rev: "c722dfaa45d90314cd1ad726bb561894321b278d" # frozen: v2.6.0
hooks:
- id: pycln
args: [--config=pyproject.toml]
stages: [manual]

- repo: https://github.com/psf/black
rev: "25.1.0"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "0671d8ab202c4ac093b78433ae5baf74f3fc7246" # frozen: v0.15.15
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: "7.2.0"
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.15.0"
hooks:
- id: mypy
exclude: auditwheel_emscripten/emscripten_tools

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
- repo: https://github.com/koalaman/shellcheck-precommit
rev: 99470f5e12208ff0fb17ab81c3c494f7620a1d8d # frozen: v0.11.0
hooks:
- id: shellcheck

- repo: https://github.com/codespell-project/codespell
rev: "v2.4.1"
rev: "2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a" # frozen: v2.4.2
hooks:
- id: codespell
args: ["-L", "te,slowy,aray,ba,nd,classs,crate,feld,lits"]

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: "v1.5.2"
rev: "9257c6050c0261b8c57e712f632dc4a8010109a9" # frozen: v1.25.2
hooks:
- id: zizmor
args: ["--pedantic"]
args: ["--pedantic", "--fix=safe"]
4 changes: 3 additions & 1 deletion auditwheel_emscripten/repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from .wheel_utils import WHEEL_INFO_RE, is_emscripten_wheel, pack, unpack


def resolve_sharedlib(wheel_file: str | Path, libdir: str | Path | list[str | Path]) -> dict[str, Path]:
def resolve_sharedlib(
wheel_file: str | Path, libdir: str | Path | list[str | Path]
) -> dict[str, Path]:
"""
Resolve the full path of shared libraries inside the wheel file
"""
Expand Down
6 changes: 3 additions & 3 deletions test/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def test_exports(shared_lib, expected):
export_list.append(field)

for expected_export in expected:
assert (
expected_export in export_list
), f"expected import {expected_export} not found"
assert expected_export in export_list, (
f"expected import {expected_export} not found"
)
12 changes: 6 additions & 6 deletions test/test_function_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def test_get_function_type_by_idx(shared_lib, expected):
if func_name in expected:
function_type = get_function_type_by_idx(wasmfile, export.index)
formatted = format_function_type(function_type)
assert (
formatted == expected[func_name]
), f"expected {expected[func_name]} but got {formatted}"
assert formatted == expected[func_name], (
f"expected {expected[func_name]} but got {formatted}"
)


@pytest.mark.parametrize(
Expand All @@ -55,6 +55,6 @@ def test_get_function_type_by_typeval(shared_lib, expected):
if func_name in expected:
function_type = get_function_type_by_typeval(wasmfile, _import.type)
formatted = format_function_type(function_type)
assert (
formatted == expected[func_name]
), f"expected {expected[func_name]} but got {formatted}"
assert formatted == expected[func_name], (
f"expected {expected[func_name]} but got {formatted}"
)
6 changes: 3 additions & 3 deletions test/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def test_imports(shared_lib, expected):
import_list.append((module, field))

for expected_import in expected:
assert (
expected_import in import_list
), f"expected import {expected_import} not found"
assert expected_import in import_list, (
f"expected import {expected_import} not found"
)
18 changes: 9 additions & 9 deletions test/test_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def test_copylib(tmp_path, wheel_file, expected):
copylib(extract_dir, dep_map, lib_sdir)

for expected_lib in expected:
assert (
extract_dir / lib_sdir / expected_lib
).is_file(), f"expected lib {expected_lib} not found"
assert (extract_dir / lib_sdir / expected_lib).is_file(), (
f"expected lib {expected_lib} not found"
)


@pytest.mark.parametrize(
Expand All @@ -78,9 +78,9 @@ def test_repair(tmp_path, wheel_file, expected):
libs = show(repaired_wheel)
libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()]))
for expected_lib in expected:
assert (
expected_lib in libs_dependencies
), f"expected lib {expected_lib} not found in dependencies"
assert expected_lib in libs_dependencies, (
f"expected lib {expected_lib} not found in dependencies"
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -116,6 +116,6 @@ def test_repair_rpath(tmp_path, wheel_file, libname, expected):
for lib in shared_libs:
lib_dylink = parse_dylink_section(lib)
libname_index = libname.index(lib.name)
assert (
expected[libname_index] in lib_dylink.runtime_paths
), f"expected runtime path {expected[libname_index]} not found in {lib.name}"
assert expected[libname_index] in lib_dylink.runtime_paths, (
f"expected runtime path {expected[libname_index]} not found in {lib.name}"
)
18 changes: 9 additions & 9 deletions test/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def test_show(wheel_file, expected):
libs_inside_wheel = libs.keys()

assert libs_inside_wheel, "no libs found inside wheel"
assert all(
[lib.endswith(".so") for lib in libs_inside_wheel]
), "not all libs are .so files"
assert all([lib.endswith(".so") for lib in libs_inside_wheel]), (
"not all libs are .so files"
)
for expected_lib in expected:
assert (
expected_lib in libs_inside_wheel
), f"expected lib {expected_lib} not found"
assert expected_lib in libs_inside_wheel, (
f"expected lib {expected_lib} not found"
)


@pytest.mark.parametrize(
Expand All @@ -61,9 +61,9 @@ def test_show_dependencies(wheel_file, expected):

libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()]))
for expected_lib in expected:
assert (
expected_lib in libs_dependencies
), f"expected lib {expected_lib} not found in dependencies"
assert expected_lib in libs_dependencies, (
f"expected lib {expected_lib} not found in dependencies"
)


def test_locate_dependency():
Expand Down