Skip to content

Commit

Permalink
Fix check-cfg, pin static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Jun 10, 2024
1 parent 3c1f2a4 commit 0020647
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ no-panic = [
# to build and on failure fall back to another backend.
yyjson = []

# Features detected by build.rs. Do not specify.
intrinsics = []
optimize = []
strict_provenance = []

[dependencies]
ahash = { version = "^0.8.9", default-features = false, features = ["compile-time-rng"] }
arrayvec = { version = "0.7", default-features = false, features = ["std", "serde"] }
Expand Down
10 changes: 9 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ fn main() {
println!("cargo:rerun-if-env-changed=CC");
println!("cargo:rerun-if-env-changed=CFLAGS");
println!("cargo:rerun-if-env-changed=LDFLAGS");
println!("cargo:rerun-if-env-changed=RUSTFLAGS");
println!("cargo:rerun-if-env-changed=ORJSON_DISABLE_SIMD");
println!("cargo:rerun-if-env-changed=ORJSON_DISABLE_YYJSON");
println!("cargo:rerun-if-env-changed=RUSTFLAGS");
println!("cargo:rustc-check-cfg=cfg(intrinsics)");
println!("cargo:rustc-check-cfg=cfg(optimize)");
println!("cargo:rustc-check-cfg=cfg(Py_3_10)");
println!("cargo:rustc-check-cfg=cfg(Py_3_11)");
println!("cargo:rustc-check-cfg=cfg(Py_3_12)");
println!("cargo:rustc-check-cfg=cfg(Py_3_13)");
println!("cargo:rustc-check-cfg=cfg(Py_3_8)");
println!("cargo:rustc-check-cfg=cfg(Py_3_9)");

for cfg in pyo3_build_config::get().build_script_outputs() {
println!("{cfg}");
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-r integration/requirements.txt
-r test/requirements.txt
maturin
mypy
ruff
mypy==1.10.0
ruff==0.4.8
types-python-dateutil
types-pytz
types-simplejson
Expand Down
6 changes: 4 additions & 2 deletions script/develop
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ export UNSAFE_PYO3_SKIP_VERSION_CHECK=1

export CC="${CC:-clang}"
export LD="${LD:-lld}"
export TARGET="${TARGET:-x86_64-unknown-linux-gnu}"
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-target}"

echo "CC: ${CC}, LD: ${LD}, LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"

export CFLAGS="-Os -fstrict-aliasing -fno-plt -flto=full -emit-llvm"
export LDFLAGS="-fuse-ld=${LD} -Wl,-plugin-opt=also-emit-llvm -Wl,--as-needed -Wl,-zrelro,-znow"
export RUSTFLAGS="-C linker=${CC} -C link-arg=-fuse-ld=${LD} -C linker-plugin-lto -C lto=fat -C link-arg=-Wl,-zrelro,-znow -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=8"

maturin build "$@"
maturin build --target="${TARGET}" "$@"

uv pip install target/wheels/*.whl
uv pip install ${CARGO_TARGET_DIR}/wheels/*.whl
2 changes: 1 addition & 1 deletion test/test_fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestFaker:
@pytest.mark.skipif(Faker is None, reason="faker not available")
def test_faker(self):
fake = Faker(FAKER_LOCALES)
profile_keys = tuple(
profile_keys = list(
set(fake.profile().keys()) - {"birthdate", "current_location"}
)
for _ in range(0, NUM_LOOPS):
Expand Down

0 comments on commit 0020647

Please sign in to comment.