Skip to content

Commit c4cfb51

Browse files
Rewrite ./start script to Python (Qiskit#555)
In Qiskit#541, we're going to need to add semi-complex logic to our `./start` script to dynamically discover every subfolder we have in `translations/`, then tell Docker to mount the folder as a volume. I'd much rather write that logic in Python than Bash. This PR is prework so that Qiskit#541 is a smaller PR. It makes no logic changes and should be a 1:1 mapping.
1 parent 066a396 commit c4cfb51

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

start

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env python3
22
# This code is a Qiskit project.
33
#
44
# (C) Copyright IBM 2023.
@@ -11,10 +11,34 @@
1111
# copyright notice, and modified files need to carry a notice indicating
1212
# that they have been altered from the originals.
1313

14-
# Keep this aligned with the Dockerfile at the root of the repository.
15-
docker run \
16-
-v "$(pwd)"/docs:/home/node/app/docs \
17-
-v "$(pwd)"/public/images:/home/node/app/packages/preview/public/images \
18-
-p 3000:3000 \
19-
-p 5001:5001 \
20-
qiskit/documentation
14+
import subprocess
15+
from pathlib import Path
16+
17+
PWD = Path(__file__).parent
18+
19+
20+
def main() -> None:
21+
subprocess.run(
22+
# Keep this aligned with the Dockerfile at the root of the repository.
23+
[
24+
"docker",
25+
"run",
26+
"-v",
27+
f"{PWD}/docs:/home/node/app/docs",
28+
"-v",
29+
f"{PWD}/public/images:/home/node/app/packages/preview/public/images",
30+
"-p",
31+
"3000:3000",
32+
"-p",
33+
"5001:5001",
34+
"qiskit/documentation",
35+
],
36+
check=True,
37+
)
38+
39+
40+
if __name__ == "__main__":
41+
try:
42+
main()
43+
except KeyboardInterrupt:
44+
pass

0 commit comments

Comments
 (0)