Skip to content

Commit 1d0d958

Browse files
committed
fix mypy
1 parent f59a691 commit 1d0d958

File tree

4 files changed

+21
-26
lines changed

4 files changed

+21
-26
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
with:
3535
python-version: "3.x"
3636

37-
- run: pip install tox
37+
- run: pip install nox
3838

39-
- run: tox -e mypy
39+
- run: nox -s mypy
4040

4141
pytest:
4242
runs-on: "ubuntu-latest"
@@ -48,9 +48,9 @@ jobs:
4848
with:
4949
python-version: "3.x"
5050

51-
- run: pip install tox
51+
- run: pip install nox
5252

53-
- run: tox -e pytest
53+
- run: nox -s test
5454

5555
build:
5656
name: ${{ matrix.python-version }} ${{ matrix.platform.os }}-${{ matrix.platform.python-architecture }}

noxfile.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,15 @@ def test_sdist_vendor(session: nox.Session):
2323
tf.extractall(str(dist))
2424
os.chdir(dist / "namespace_package-0.1.0")
2525
session.run("cargo", "build", "--offline", external=True)
26+
27+
28+
@nox.session()
29+
def mypy(session: nox.Session):
30+
session.install("mypy", "fat_macho", "types-setuptools", ".")
31+
session.run("mypy", "setuptools_rust", *session.posargs)
32+
33+
34+
@nox.session()
35+
def test(session: nox.Session):
36+
session.install("pytest", ".")
37+
session.run("pytest", "setuptools_rust", *session.posargs)

setuptools_rust/setuptools_ext.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def make_distribution(self) -> None:
6969
# set --manifest-path before vendor_path and after --sync to workaround that
7070
# See https://docs.rs/clap/latest/clap/struct.Arg.html#method.multiple for detail
7171
command.extend(["--manifest-path", manifest_paths[0], vendor_path])
72-
cargo_config = subprocess.run(command, check=True)
72+
subprocess.run(command, check=True)
73+
74+
cargo_config = _CARGO_VENDOR_CONFIG
7375

7476
# Check whether `.cargo/config`/`.cargo/config.toml` already exists
7577
existing_cargo_config = None
@@ -80,15 +82,14 @@ def make_distribution(self) -> None:
8082
if filename in self.filelist.files:
8183
existing_cargo_config = filename
8284
break
85+
8386
if existing_cargo_config:
8487
cargo_config_path = os.path.join(
8588
base_dir, existing_cargo_config
8689
)
8790
# Append vendor config to original cargo config
8891
with open(existing_cargo_config, "rb") as f:
89-
cargo_config = f.read() + b"\n" + cargo_config
90-
else:
91-
cargo_config = _CARGO_VENDOR_CONFIG
92+
cargo_config += f.read() + b"\n"
9293

9394
with open(cargo_config_path, "wb") as f:
9495
f.write(cargo_config)

tox.ini

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)