mpatch 1.6.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mpatch-1.6.2/.github/workflows/ci.yml +132 -0
- mpatch-1.6.2/.github/workflows/docs.yml +96 -0
- mpatch-1.6.2/.github/workflows/pypi.yml +118 -0
- mpatch-1.6.2/.github/workflows/python-ci.yml +96 -0
- mpatch-1.6.2/.github/workflows/release.yml +433 -0
- mpatch-1.6.2/.github/workflows/test-report.yml +58 -0
- mpatch-1.6.2/.gitignore +4 -0
- mpatch-1.6.2/CHANGELOG.md +280 -0
- mpatch-1.6.2/Cargo.lock +1729 -0
- mpatch-1.6.2/Cargo.toml +87 -0
- mpatch-1.6.2/LICENSE +8 -0
- mpatch-1.6.2/PKG-INFO +261 -0
- mpatch-1.6.2/README.md +316 -0
- mpatch-1.6.2/benches/mpatch_bench.rs +375 -0
- mpatch-1.6.2/bindings/python/.gitignore +19 -0
- mpatch-1.6.2/bindings/python/Cargo.toml +18 -0
- mpatch-1.6.2/bindings/python/README.md +231 -0
- mpatch-1.6.2/bindings/python/mpatch.pyi +554 -0
- mpatch-1.6.2/bindings/python/src/lib.rs +1214 -0
- mpatch-1.6.2/bindings/python/tests/test_mpatch.py +431 -0
- mpatch-1.6.2/pyproject.toml +67 -0
- mpatch-1.6.2/src/lib.rs +6980 -0
- mpatch-1.6.2/src/main.rs +765 -0
- mpatch-1.6.2/tests/patch_apply_tests.rs +6792 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
name: Rust CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pull-requests: read
|
|
12
|
+
checks: write
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
CARGO_TERM_COLOR: always
|
|
16
|
+
RUST_BACKTRACE: 1
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
style:
|
|
20
|
+
name: Check Style
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Install Rust toolchain
|
|
27
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
28
|
+
with:
|
|
29
|
+
toolchain: stable
|
|
30
|
+
components: rustfmt
|
|
31
|
+
cache: false
|
|
32
|
+
|
|
33
|
+
- name: Check Formatting
|
|
34
|
+
run: cargo fmt --all -- --check
|
|
35
|
+
|
|
36
|
+
build_and_test:
|
|
37
|
+
name: Build and Test (${{ matrix.os }})
|
|
38
|
+
runs-on: ${{ matrix.os }}
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
matrix:
|
|
42
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Checkout repository
|
|
46
|
+
uses: actions/checkout@v4
|
|
47
|
+
with: { fetch-depth: 0 }
|
|
48
|
+
|
|
49
|
+
# --- Smart Change Detection ---
|
|
50
|
+
- name: Get branch name
|
|
51
|
+
id: branch-name
|
|
52
|
+
uses: tj-actions/branch-names@v8
|
|
53
|
+
|
|
54
|
+
- name: Get last successful commit
|
|
55
|
+
uses: nrwl/nx-set-shas@v4
|
|
56
|
+
id: last_successful_commit
|
|
57
|
+
with:
|
|
58
|
+
main-branch-name: ${{ steps.branch-name.outputs.current_branch }}
|
|
59
|
+
workflow-id: 'ci.yml'
|
|
60
|
+
|
|
61
|
+
- name: Get changed files
|
|
62
|
+
id: changed_files
|
|
63
|
+
uses: tj-actions/changed-files@v45
|
|
64
|
+
with:
|
|
65
|
+
base_sha: ${{ steps.last_successful_commit.outputs.base }}
|
|
66
|
+
files_yaml: |
|
|
67
|
+
code:
|
|
68
|
+
- src/**/*.rs
|
|
69
|
+
- tests/**/*.rs
|
|
70
|
+
- Cargo.toml
|
|
71
|
+
- Cargo.lock
|
|
72
|
+
- .github/workflows/**
|
|
73
|
+
|
|
74
|
+
# --- Setup ---
|
|
75
|
+
- name: Install Rust toolchain
|
|
76
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
77
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
78
|
+
with:
|
|
79
|
+
toolchain: stable
|
|
80
|
+
cache: true
|
|
81
|
+
components: clippy
|
|
82
|
+
|
|
83
|
+
- name: Install cargo-hack & cargo-nextest
|
|
84
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
85
|
+
uses: taiki-e/install-action@v2
|
|
86
|
+
with:
|
|
87
|
+
tool: cargo-hack, cargo-nextest
|
|
88
|
+
|
|
89
|
+
- name: Configure Nextest
|
|
90
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
91
|
+
shell: bash
|
|
92
|
+
run: |
|
|
93
|
+
mkdir -p .config
|
|
94
|
+
cat <<EOF > .config/nextest.toml
|
|
95
|
+
[profile.ci]
|
|
96
|
+
failure-output = "immediate"
|
|
97
|
+
fail-fast = false
|
|
98
|
+
|
|
99
|
+
[profile.ci.junit]
|
|
100
|
+
path = "junit.xml"
|
|
101
|
+
report-name = "nextest-run"
|
|
102
|
+
EOF
|
|
103
|
+
|
|
104
|
+
# --- Execution ---
|
|
105
|
+
- name: Linting (cargo clippy)
|
|
106
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
107
|
+
# Note: setup-rust-toolchain handles the Problem Matcher for Clippy automatically
|
|
108
|
+
run: cargo hack --each-feature clippy --all-targets -- -D warnings
|
|
109
|
+
|
|
110
|
+
- name: Run Tests (nextest)
|
|
111
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
112
|
+
# We run with --profile ci to ensure XML generation
|
|
113
|
+
run: cargo nextest run --all-features --profile ci
|
|
114
|
+
|
|
115
|
+
- name: Run Doc Tests
|
|
116
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
117
|
+
run: cargo test --doc --all-features
|
|
118
|
+
|
|
119
|
+
- name: Build (Release)
|
|
120
|
+
if: steps.changed_files.outputs.code_any_changed == 'true'
|
|
121
|
+
run: cargo build --release --all-features --verbose
|
|
122
|
+
|
|
123
|
+
# --- Artifact Upload ---
|
|
124
|
+
- name: Upload Test Results
|
|
125
|
+
# Run if code changed, even if previous steps failed (so we see WHY they failed)
|
|
126
|
+
if: steps.changed_files.outputs.code_any_changed == 'true' && !cancelled()
|
|
127
|
+
uses: actions/upload-artifact@v4
|
|
128
|
+
with:
|
|
129
|
+
# Naming convention is critical here for the reporter regex
|
|
130
|
+
name: test-results-${{ matrix.os }}
|
|
131
|
+
path: target/nextest/ci/junit.xml
|
|
132
|
+
if-no-files-found: ignore
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
name: Documentation CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
CARGO_TERM_COLOR: always
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
check_docs:
|
|
17
|
+
name: Check Documentation
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
# Required for tj-actions/changed-files to diff against the correct base.
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- name: Get changed files
|
|
27
|
+
id: changed_files
|
|
28
|
+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
|
|
29
|
+
with:
|
|
30
|
+
files_yaml: |
|
|
31
|
+
docs_relevant:
|
|
32
|
+
- src/**/*.rs
|
|
33
|
+
- Cargo.toml
|
|
34
|
+
- README.md
|
|
35
|
+
- ./**/*.md
|
|
36
|
+
- .github/workflows/docs.yml
|
|
37
|
+
|
|
38
|
+
- name: Install Rust toolchain
|
|
39
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
40
|
+
with:
|
|
41
|
+
toolchain: stable
|
|
42
|
+
cache: 'cargo'
|
|
43
|
+
|
|
44
|
+
- name: Setup sccache
|
|
45
|
+
if: steps.changed_files.outputs.docs_relevant_any_changed == 'true'
|
|
46
|
+
uses: mozilla-actions/sccache-action@v0.0.9
|
|
47
|
+
|
|
48
|
+
- name: Configure Rust to use sccache
|
|
49
|
+
if: steps.changed_files.outputs.docs_relevant_any_changed == 'true'
|
|
50
|
+
run: |
|
|
51
|
+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
|
|
52
|
+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
|
|
53
|
+
|
|
54
|
+
- name: Check Intra-Doc Links
|
|
55
|
+
if: steps.changed_files.outputs.docs_relevant_any_changed == 'true'
|
|
56
|
+
env:
|
|
57
|
+
# Treat all documentation warnings (like broken links) as errors.
|
|
58
|
+
RUSTDOCFLAGS: -D warnings
|
|
59
|
+
run: cargo doc --no-deps --all-features
|
|
60
|
+
|
|
61
|
+
- name: Restore lychee cache
|
|
62
|
+
if: steps.changed_files.outputs.docs_relevant_any_changed == 'true'
|
|
63
|
+
uses: actions/cache@v4
|
|
64
|
+
with:
|
|
65
|
+
path: .lycheecache
|
|
66
|
+
key: lychee-cache-${{ runner.os }}-${{ github.sha }}
|
|
67
|
+
restore-keys: |
|
|
68
|
+
lychee-cache-${{ runner.os }}-
|
|
69
|
+
|
|
70
|
+
- name: Check External Links
|
|
71
|
+
if: steps.changed_files.outputs.docs_relevant_any_changed == 'true'
|
|
72
|
+
# Pin action to a specific commit SHA for security and reproducibility.
|
|
73
|
+
uses: lycheeverse/lychee-action@7da8ec1fc4e01b5a12062ac6c589c10a4ce70d67 # v2.0.0
|
|
74
|
+
with:
|
|
75
|
+
jobSummary: true
|
|
76
|
+
args: >
|
|
77
|
+
--verbose
|
|
78
|
+
--no-progress
|
|
79
|
+
--cache
|
|
80
|
+
--max-cache-age 1d
|
|
81
|
+
--exclude 'docs.rs'
|
|
82
|
+
--exclude 'adobe.com'
|
|
83
|
+
'./target/doc/mpatch/**/*.html'
|
|
84
|
+
'./**/*.md'
|
|
85
|
+
env:
|
|
86
|
+
# Use GitHub token to avoid API rate-limiting when checking github.com links.
|
|
87
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
88
|
+
|
|
89
|
+
- name: Show sccache stats
|
|
90
|
+
if: always() && steps.changed_files.outputs.docs_relevant_any_changed == 'true'
|
|
91
|
+
shell: bash
|
|
92
|
+
run: ${SCCACHE_PATH} --show-stats
|
|
93
|
+
|
|
94
|
+
- name: Indicate checks skipped
|
|
95
|
+
if: steps.changed_files.outputs.docs_relevant_any_changed == 'false'
|
|
96
|
+
run: echo "Documentation checks skipped as no relevant files were changed."
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
name: Publish Python Bindings to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-wheels:
|
|
13
|
+
name: Build wheels on ${{ matrix.os }} (${{ matrix.target }}) ${{ matrix.free-threaded && 'Free-Threaded' || '' }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
free-threaded: [false, true]
|
|
19
|
+
include:
|
|
20
|
+
# --- Linux ---
|
|
21
|
+
- os: ubuntu-latest
|
|
22
|
+
target: x86_64-unknown-linux-gnu
|
|
23
|
+
- os: ubuntu-latest
|
|
24
|
+
target: aarch64-unknown-linux-gnu
|
|
25
|
+
- os: ubuntu-latest
|
|
26
|
+
target: x86_64-unknown-linux-musl
|
|
27
|
+
- os: ubuntu-latest
|
|
28
|
+
target: aarch64-unknown-linux-musl
|
|
29
|
+
# --- macOS ---
|
|
30
|
+
- os: macos-13 # Intel Mac
|
|
31
|
+
target: x86_64-apple-darwin
|
|
32
|
+
- os: macos-14 # Apple Silicon (M1/M2/M3)
|
|
33
|
+
target: aarch64-apple-darwin
|
|
34
|
+
# --- Windows ---
|
|
35
|
+
- os: windows-latest
|
|
36
|
+
target: x86_64-pc-windows-msvc
|
|
37
|
+
- os: windows-latest
|
|
38
|
+
target: aarch64-pc-windows-msvc
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Set up QEMU
|
|
44
|
+
if: runner.os == 'Linux'
|
|
45
|
+
uses: docker/setup-qemu-action@v3
|
|
46
|
+
|
|
47
|
+
- name: Setup Python
|
|
48
|
+
if: matrix.free-threaded
|
|
49
|
+
uses: actions/setup-python@v6
|
|
50
|
+
with:
|
|
51
|
+
python-version: '3.13t'
|
|
52
|
+
|
|
53
|
+
- name: Build wheels
|
|
54
|
+
uses: PyO3/maturin-action@v1
|
|
55
|
+
with:
|
|
56
|
+
target: ${{ matrix.target }}
|
|
57
|
+
manylinux: auto
|
|
58
|
+
working-directory: bindings/python
|
|
59
|
+
# Pass `-i python3.13t` to explicitly tell maturin to build a cp313t wheel alongside abi3
|
|
60
|
+
args: --release --out dist --locked --compatibility pypi ${{ matrix.free-threaded && '-i python3.13t' || '' }}
|
|
61
|
+
sccache: 'true'
|
|
62
|
+
|
|
63
|
+
- name: Upload wheels
|
|
64
|
+
uses: actions/upload-artifact@v4
|
|
65
|
+
with:
|
|
66
|
+
# Use dynamic artifact names to prevent overwriting between parallel free-threaded and standard jobs
|
|
67
|
+
name: wheels-${{ matrix.target }}${{ matrix.free-threaded && '-freethreaded' || '' }}
|
|
68
|
+
path: bindings/python/dist/*.whl
|
|
69
|
+
|
|
70
|
+
build-sdist:
|
|
71
|
+
name: Build source distribution
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
|
|
76
|
+
- name: Build sdist
|
|
77
|
+
uses: PyO3/maturin-action@v1
|
|
78
|
+
with:
|
|
79
|
+
command: sdist
|
|
80
|
+
args: --out dist
|
|
81
|
+
working-directory: bindings/python
|
|
82
|
+
|
|
83
|
+
- name: Upload sdist
|
|
84
|
+
uses: actions/upload-artifact@v4
|
|
85
|
+
with:
|
|
86
|
+
name: sdist
|
|
87
|
+
path: bindings/python/dist/*.tar.gz
|
|
88
|
+
|
|
89
|
+
publish-pypi:
|
|
90
|
+
name: Upload release to PyPI
|
|
91
|
+
needs: [build-wheels, build-sdist]
|
|
92
|
+
runs-on: ubuntu-latest
|
|
93
|
+
|
|
94
|
+
environment:
|
|
95
|
+
name: pypi
|
|
96
|
+
url: https://pypi.org/p/mpatch
|
|
97
|
+
|
|
98
|
+
permissions:
|
|
99
|
+
id-token: write
|
|
100
|
+
contents: read
|
|
101
|
+
|
|
102
|
+
steps:
|
|
103
|
+
- name: Download all artifacts
|
|
104
|
+
uses: actions/download-artifact@v4
|
|
105
|
+
with:
|
|
106
|
+
path: dist
|
|
107
|
+
pattern: wheels-*
|
|
108
|
+
merge-multiple: true
|
|
109
|
+
|
|
110
|
+
- name: Download sdist
|
|
111
|
+
uses: actions/download-artifact@v4
|
|
112
|
+
with:
|
|
113
|
+
path: dist
|
|
114
|
+
pattern: sdist
|
|
115
|
+
merge-multiple: true
|
|
116
|
+
|
|
117
|
+
- name: Publish package distributions to PyPI
|
|
118
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
name: Python CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
paths:
|
|
7
|
+
- 'bindings/python/**'
|
|
8
|
+
- 'src/**'
|
|
9
|
+
- 'Cargo.toml'
|
|
10
|
+
- 'Cargo.lock'
|
|
11
|
+
- '.github/workflows/python-ci.yml'
|
|
12
|
+
pull_request:
|
|
13
|
+
branches: [ main ]
|
|
14
|
+
paths:
|
|
15
|
+
- 'bindings/python/**'
|
|
16
|
+
- 'src/**'
|
|
17
|
+
- 'Cargo.toml'
|
|
18
|
+
- 'Cargo.lock'
|
|
19
|
+
- '.github/workflows/python-ci.yml'
|
|
20
|
+
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
|
|
24
|
+
env:
|
|
25
|
+
CARGO_TERM_COLOR: always
|
|
26
|
+
RUST_BACKTRACE: 1
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
lint:
|
|
30
|
+
name: Code Quality (Ruff)
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- name: Checkout repository
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- name: Setup Python
|
|
37
|
+
uses: actions/setup-python@v6
|
|
38
|
+
with:
|
|
39
|
+
python-version: '3.12'
|
|
40
|
+
|
|
41
|
+
- name: Install Ruff
|
|
42
|
+
run: pip install ruff
|
|
43
|
+
|
|
44
|
+
- name: Check formatting
|
|
45
|
+
working-directory: bindings/python
|
|
46
|
+
run: ruff format --check .
|
|
47
|
+
|
|
48
|
+
- name: Run linter
|
|
49
|
+
working-directory: bindings/python
|
|
50
|
+
run: ruff check .
|
|
51
|
+
|
|
52
|
+
test:
|
|
53
|
+
name: Test (${{ matrix.os }} / Py ${{ matrix.python-version }})
|
|
54
|
+
runs-on: ${{ matrix.os }}
|
|
55
|
+
strategy:
|
|
56
|
+
fail-fast: false
|
|
57
|
+
matrix:
|
|
58
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
59
|
+
python-version: ['3.8', '3.10', '3.12', '3.13', '3.13t']
|
|
60
|
+
exclude:
|
|
61
|
+
- os: macos-latest
|
|
62
|
+
python-version: '3.8'
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
- name: Checkout repository
|
|
66
|
+
uses: actions/checkout@v4
|
|
67
|
+
|
|
68
|
+
- name: Install Rust toolchain
|
|
69
|
+
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
70
|
+
with:
|
|
71
|
+
toolchain: stable
|
|
72
|
+
cache: true
|
|
73
|
+
|
|
74
|
+
- name: Setup Python ${{ matrix.python-version }}
|
|
75
|
+
uses: actions/setup-python@v6
|
|
76
|
+
with:
|
|
77
|
+
python-version: ${{ matrix.python-version }}
|
|
78
|
+
cache: 'pip'
|
|
79
|
+
|
|
80
|
+
- name: Build Extension and Install Dependencies
|
|
81
|
+
working-directory: bindings/python
|
|
82
|
+
shell: bash
|
|
83
|
+
run: pip install -e ".[test]"
|
|
84
|
+
|
|
85
|
+
- name: Run Pytest
|
|
86
|
+
working-directory: bindings/python
|
|
87
|
+
shell: bash
|
|
88
|
+
run: pytest -v --color=yes --junitxml=junit.xml
|
|
89
|
+
|
|
90
|
+
- name: Upload Test Results
|
|
91
|
+
if: always()
|
|
92
|
+
uses: actions/upload-artifact@v4
|
|
93
|
+
with:
|
|
94
|
+
name: test-results-python-${{ matrix.os }}-${{ matrix.python-version }}
|
|
95
|
+
path: bindings/python/junit.xml
|
|
96
|
+
if-no-files-found: ignore
|