Skip to content

Commit

Permalink
Remove pyo3 hard requirement (#19)
Browse files Browse the repository at this point in the history
* Separate Python methods for Symbol

* finish Symbol

* ifdefing in MapFile

* Segment

* MapsComparisonInfo and SymbolComparisonInfo

* FoundSymbolInfo

* FoundSymbolInfo

* Finally yeet pyo3

* update ci

* fmt

* fix python clippy

* typo
  • Loading branch information
AngheloAlf authored Dec 23, 2023
1 parent 1fe2467 commit b916941
Show file tree
Hide file tree
Showing 14 changed files with 1,111 additions and 413 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/maturin_upload_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ name: Upload to PyPI

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -102,11 +97,31 @@ jobs:
name: wheels
path: dist

check_clippy_python_bindings:
name: Check clippy for Python bindings
runs-on: ubuntu-latest

steps:
- name: Checkout reposistory
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Setup clippy
run: rustup component add clippy

- name: Run clippy
run: cargo clippy --all-targets --features python_bindings -- -D warnings

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
needs: [linux, windows, macos, sdist, check_clippy_python_bindings]
steps:
- uses: actions/download-artifact@v3
with:
Expand Down
54 changes: 48 additions & 6 deletions .github/workflows/publish_crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name: Build and upload Rust crate
on: [push, pull_request]

jobs:
build_rust:
name: Build Rust stuff and run Rust tests
check_fmt:
name: Check format
runs-on: ubuntu-latest

steps:
Expand All @@ -21,18 +21,60 @@ jobs:
- name: Check format
run: cargo fmt --check

check_clippy:
name: Check clippy
runs-on: ubuntu-latest

steps:
- name: Checkout reposistory
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Setup clippy
run: rustup component add clippy

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets -- -D warnings

- name: Build Rust package
run: cargo build --release --workspace
run_tests:
name: Run tests
runs-on: ubuntu-latest

steps:
- name: Checkout reposistory
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust tests
- name: Run tests
run: cargo test --workspace

publish:
name: Publish
runs-on: ubuntu-latest

steps:
- name: Checkout reposistory
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust package
run: cargo build --release --workspace

- name: Publish dry run
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
run: cargo publish --dry-run
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- `pyo3` is no longer needed to use this crate as Rust-only library.

## [2.3.0] - 2023-11-05

### Added
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ crate-type = ["cdylib", "staticlib", "rlib"]

[dependencies]
regex = "1.9.5"
# pyo3 = { version = "0.19.0", optional = true }
pyo3 = { version = "0.19.0", optional = false }
pyo3 = { version = "0.19.0", optional = true }
lazy_static = "1.4.0"

[features]
python_bindings = []
# python_bindings = ["dep:pyo3"]
python_bindings = ["dep:pyo3"]
4 changes: 2 additions & 2 deletions src/mapfile_parser/frontends/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def processArguments(args: argparse.Namespace):
asmPath: Path = args.asmpath
nonmatchingsPath: Path = args.nonmatchingspath
pathIndex: int = args.path_index
debugging: bool = args.debugging
debugging: bool = args.debugging #! @deprecated

exit(doProgress(mapPath, asmPath, nonmatchingsPath, pathIndex=pathIndex, debugging=debugging))

Expand All @@ -43,6 +43,6 @@ def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser])
parser.add_argument("asmpath", help="Path to asm folder", type=Path)
parser.add_argument("nonmatchingspath", help="Path to nonmatchings folder", type=Path)
parser.add_argument("-i", "--path-index", help="Specify the index to start reading the file paths. Defaults to 2", type=int, default=2)
parser.add_argument("-d", "--debugging", help="Enable debugging prints", action="store_true")
parser.add_argument("-d", "--debugging", help="Enable debugging prints. This option is deprecated", action="store_true")

parser.set_defaults(func=processArguments)
Loading

0 comments on commit b916941

Please sign in to comment.