Skip to content

Commit c7c9c7f

Browse files
committed
Modify noxfile to use build instead of running setup.py
1 parent 624f5db commit c7c9c7f

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

noxfile.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import tarfile
3+
from inspect import cleandoc as heredoc
34
from glob import glob
45
from pathlib import Path
56
from unittest.mock import patch
@@ -15,10 +16,22 @@ def test_examples(session: nox.Session):
1516

1617
@nox.session(name="test-sdist-vendor")
1718
def test_sdist_vendor(session: nox.Session):
18-
session.install(".")
19+
session.install(".", "build", "wheel")
1920
namespace_package = Path(__file__).parent / "examples" / "namespace_package"
2021
os.chdir(namespace_package)
21-
session.run("python", "setup.py", "sdist", "--vendor-crates", external=True)
22+
tmp = session.create_tmp()
23+
24+
build_config = """
25+
[sdist]
26+
vendor_crates = True
27+
"""
28+
Path(tmp, "setup.cfg").write_text(heredoc(build_config), encoding="utf-8")
29+
30+
env = os.environ.copy()
31+
env.update(DIST_EXTRA_CONFIG=str(Path(tmp, "setup.cfg")))
32+
cmd = ["python", "-m", "build", "--sdist", "--no-isolation"]
33+
session.run(*cmd, env=env, external=True)
34+
2235
dist = namespace_package / "dist"
2336
with tarfile.open(str(dist / "namespace_package-0.1.0.tar.gz")) as tf:
2437
tf.extractall(str(dist))
@@ -77,7 +90,7 @@ def chdir(path: Path):
7790

7891
@nox.session(name="test-examples-emscripten")
7992
def test_examples_emscripten(session: nox.Session):
80-
session.install(".")
93+
session.install(".", "build")
8194
emscripten_dir = Path("./emscripten").resolve()
8295

8396
session.run(
@@ -108,7 +121,8 @@ def test_examples_emscripten(session: nox.Session):
108121
PYO3_CONFIG_FILE=str(emscripten_dir / "pyo3_config.ini"),
109122
)
110123
with session.chdir(example):
111-
session.run("python", "setup.py", "bdist_wheel", env=env, external=True)
124+
cmd = ["python", "-m", "build", "--wheel", "--no-isolation"]
125+
session.run(*cmd, env=env, external=True)
112126

113127
with session.chdir(emscripten_dir):
114128
session.run("node", "runner.js", str(example), external=True)

0 commit comments

Comments
 (0)