Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 151b030

Browse files
committed
try not to leave bytecode droppings behind
1 parent 4fbb3bc commit 151b030

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

runestone/__main__.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ def build(all, wd):
153153
else:
154154
os.chdir(findProjectRoot())
155155
sys.path.insert(0, os.getcwd())
156-
if not pathlib.Path(resource_filename("runestone", "dist/webpack_static_imports.json")).exists():
157-
click.echo("Error -- you are missing webpack_static_imports.json. Please make sure")
156+
if not pathlib.Path(
157+
resource_filename("runestone", "dist/webpack_static_imports.json")
158+
).exists():
159+
click.echo(
160+
"Error -- you are missing webpack_static_imports.json. Please make sure"
161+
)
158162
click.echo("you have Runestone installed correctly.")
159163
click.echo("In a development environment, execute npm run build.")
160164
sys.exit(-1)
@@ -163,6 +167,7 @@ def build(all, wd):
163167
print("Building with Runestone {}".format(version))
164168

165169
import pavement
170+
166171
confpath = pathlib.Path(pavement.options.get("confdir", "."))
167172

168173
with open(confpath / "conf.py", encoding="utf-8") as cf:
@@ -341,16 +346,22 @@ def rs2ptx(course, sourcedir, outdir):
341346
else:
342347
tdict = {"course_id": course}
343348

344-
cmd_start = ["sphinx-build", "-E", "-b", "xml",
345-
"-d", f"./build/{course}/doctrees", "-c", "."]
349+
cmd_start = [
350+
"sphinx-build",
351+
"-E",
352+
"-b",
353+
"xml",
354+
"-d",
355+
f"./build/{course}/doctrees",
356+
"-c",
357+
".",
358+
]
346359
tplate_val = [f"-A{key}={val}" for key, val in tdict.items()]
347360
cmd_end = [f"{sourcedir}", f"./{outdir}/xml"]
348361
cmd = " ".join(cmd_start + tplate_val + cmd_end)
349362
click.echo(cmd)
350363
try:
351-
cp = subprocess.run(
352-
cmd , shell=True, check=True
353-
)
364+
cp = subprocess.run(cmd, shell=True, check=True)
354365
except subprocess.CalledProcessError as e:
355366
click.echo(f"{e.stderr or ''}{e.stdout or ''}")
356367
raise
@@ -424,6 +435,7 @@ def process_manifest(course, manifest):
424435

425436

426437
def main(args=None):
438+
sys.dont_write_bytecode = True
427439
if not args:
428440
args = sys.argv[1:]
429441
if not args:

0 commit comments

Comments
 (0)