|
1 | 1 | from pathlib import Path
|
| 2 | +from tempfile import TemporaryDirectory |
2 | 3 | import os
|
3 | 4 |
|
4 | 5 | import nox
|
@@ -106,18 +107,11 @@ def audit(session, installable):
|
106 | 107 |
|
107 | 108 | @session(tags=["build"])
|
108 | 109 | def build(session):
|
109 |
| - session.install("build") |
110 |
| - tmpdir = session.create_tmp() |
111 |
| - session.run("python", "-m", "build", ROOT, "--outdir", tmpdir) |
112 |
| - |
113 |
| - |
114 |
| -@session(tags=["style"]) |
115 |
| -def readme(session): |
116 | 110 | session.install("build", "docutils", "twine")
|
117 |
| - tmpdir = session.create_tmp() |
118 |
| - session.run("python", "-m", "build", ROOT, "--outdir", tmpdir) |
119 |
| - session.run("python", "-m", "twine", "check", "--strict", tmpdir + "/*") |
120 |
| - session.run("rst2html5.py", "--halt=warning", CHANGELOG, "/dev/null") |
| 111 | + with TemporaryDirectory() as tmpdir: |
| 112 | + session.run("python", "-m", "build", ROOT, "--outdir", tmpdir) |
| 113 | + session.run("twine", "check", "--strict", tmpdir + "/*") |
| 114 | + session.run("rst2html5.py", "--halt=warning", CHANGELOG, "/dev/null") |
121 | 115 |
|
122 | 116 |
|
123 | 117 | @session()
|
@@ -154,20 +148,21 @@ def typing(session):
|
154 | 148 | )
|
155 | 149 | def docs(session, builder):
|
156 | 150 | session.install("-r", DOCS / "requirements.txt")
|
157 |
| - tmpdir = Path(session.create_tmp()) |
158 |
| - argv = ["-n", "-T", "-W"] |
159 |
| - if builder != "spelling": |
160 |
| - argv += ["-q"] |
161 |
| - session.run( |
162 |
| - "python", |
163 |
| - "-m", |
164 |
| - "sphinx", |
165 |
| - "-b", |
166 |
| - builder, |
167 |
| - DOCS, |
168 |
| - tmpdir / builder, |
169 |
| - *argv, |
170 |
| - ) |
| 151 | + with TemporaryDirectory() as tmpdir_str: |
| 152 | + tmpdir = Path(tmpdir_str) |
| 153 | + argv = ["-n", "-T", "-W"] |
| 154 | + if builder != "spelling": |
| 155 | + argv += ["-q"] |
| 156 | + session.run( |
| 157 | + "python", |
| 158 | + "-m", |
| 159 | + "sphinx", |
| 160 | + "-b", |
| 161 | + builder, |
| 162 | + DOCS, |
| 163 | + tmpdir / builder, |
| 164 | + *argv, |
| 165 | + ) |
171 | 166 |
|
172 | 167 |
|
173 | 168 | @session(tags=["docs", "style"], name="docs(style)")
|
|
0 commit comments