Skip to content

Commit

Permalink
move pyo3-ffi-check into its own workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jul 3, 2023
1 parent 32587ec commit cd33b1c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ jobs:
- '.github/workflows/build.yml'
- name: Run pyo3-ffi-check
run: nox -s ffi-check
# pypy 3.7 and 3.8 are not PEP 3123 compliant so fail checks here, nor
# is pypy 3.9 on windows
if: ${{ steps.ffi-changes.outputs.changed == 'true' && inputs.rust == 'stable' && inputs.python-version != 'pypy3.7' && inputs.python-version != 'pypy3.8' && !(inputs.python-version == 'pypy3.9' && contains(inputs.os, 'windows')) }}
run: nox -s ffi-check


- name: Test cross compilation
Expand Down
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ harness = false
[workspace]
members = [
"pyo3-ffi",
"pyo3-ffi-check",
"pyo3-ffi-check/macro",
"pyo3-build-config",
"pyo3-macros",
"pyo3-macros-backend",
Expand Down
23 changes: 12 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def fmt(session: nox.Session):

@nox.session(name="fmt-rust", venv_backend="none")
def fmt_rust(session: nox.Session):
_run(session, "cargo", "fmt", "--all", "--check", external=True)
_run_cargo(session, "fmt", "--all", "--check")
_run_cargo(session, "fmt", *_FFI_CHECK, "--all", "--check")


@nox.session(name="fmt-py")
Expand All @@ -103,9 +104,6 @@ def _clippy(session: nox.Session, *, env: Dict[str, str] = None) -> bool:
*feature_set,
"--all-targets",
"--workspace",
# linting pyo3-ffi-check requires docs to have been built or
# the macros will error; doesn't seem worth it on CI
"--exclude=pyo3-ffi-check",
"--",
"--deny=warnings",
external=True,
Expand Down Expand Up @@ -146,9 +144,6 @@ def _check(env: Dict[str, str]) -> None:
*feature_set,
"--all-targets",
"--workspace",
# linting pyo3-ffi-check requires docs to have been built or
# the macros will error; doesn't seem worth it on CI
"--exclude=pyo3-ffi-check",
external=True,
env=env,
)
Expand Down Expand Up @@ -338,8 +333,6 @@ def format_guide(session: nox.Session):

for path in Path("guide").glob("**/*.md"):
session.log("Working on %s", path)
path.read_text()

lines = iter(path.read_text().splitlines(True))
new_lines = []

Expand Down Expand Up @@ -533,8 +526,9 @@ def load_pkg_versions():

@nox.session(name="ffi-check")
def ffi_check(session: nox.Session):
session.run("cargo", "doc", "-p", "pyo3-ffi", "--no-deps", external=True)
_run(session, "cargo", "run", "-p", "pyo3-ffi-check", external=True)
_run_cargo(session, "doc", *_FFI_CHECK, "-p", "pyo3-ffi", "--no-deps")
_run_cargo(session, "clippy", "--workspace", "--all-targets", *_FFI_CHECK)
_run_cargo(session, "run", *_FFI_CHECK)


@lru_cache()
Expand Down Expand Up @@ -616,6 +610,10 @@ def _run(session: nox.Session, *args: str, **kwargs: Any) -> None:
print("::endgroup::", file=sys.stderr)


def _run_cargo(session: nox.Session, *args: str, **kwargs: Any) -> None:
_run(session, "cargo", *args, **kwargs, external=True)


def _run_cargo_test(
session: nox.Session,
*,
Expand Down Expand Up @@ -685,3 +683,6 @@ def _job_with_config(implementation, version) -> bool:

for version in PYPY_VERSIONS:
_job_with_config("PyPy", version)


_FFI_CHECK = ("--manifest-path", "pyo3-ffi-check/Cargo.toml")
7 changes: 6 additions & 1 deletion pyo3-ffi-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ path = "../pyo3-ffi"
features = ["extension-module"] # A lazy way of skipping linking in most cases (as we don't use any runtime symbols)

[build-dependencies]
bindgen = "0.65.1"
bindgen = "0.66.1"
pyo3-build-config = { path = "../pyo3-build-config" }

[workspace]
members = [
"macro"
]
2 changes: 1 addition & 1 deletion pyo3-ffi-check/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ proc-macro = true
glob = "0.3"
quote = "1"
proc-macro2 = "1"
scraper = "0.12"
scraper = "0.17"
3 changes: 2 additions & 1 deletion pyo3-ffi-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ fn main() {
non_camel_case_types,
non_upper_case_globals,
dead_code,
improper_ctypes
improper_ctypes,
clippy::all
)]
mod bindings {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
Expand Down

0 comments on commit cd33b1c

Please sign in to comment.