Skip to content

Commit 0d4f553

Browse files
committed
review fixes
1 parent 0f2d1d8 commit 0d4f553

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

source/conf.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
import sys
1010
import shutil
1111
import datetime
12+
import zipfile
13+
from importlib import metadata
1214
from urllib.parse import urljoin
15+
from urllib.request import urlretrieve
1316
from pathlib import Path
1417
# -- Project information -----------------------------------------------------
1518
# Add any Sphinx extension module names here, as strings. They can be
@@ -47,18 +50,20 @@
4750
templates_path = ['_templates']
4851

4952
# -- Setup example files -----------------------------------------------------
50-
PYTHON_RAT_RELEASE = "0.0.0.dev4"
53+
PYTHON_RAT_RELEASE = metadata.version("RATapi")
5154

5255
if not os.path.isdir("./python_examples/data"):
53-
os.system(f'git clone --depth 1 --branch {PYTHON_RAT_RELEASE} https://github.com/RascalSoftware/python-RAT')
56+
zip_dir, headers = urlretrieve("https://github.com/RascalSoftware/python-RAT/archive/refs/tags/0.0.0.dev4.zip")
57+
with zipfile.ZipFile(zip_dir) as zf:
58+
zf.extractall()
5459
print("Copying Jupyter notebooks...")
5560
for directory in ['normal_reflectivity', 'domains', 'absorption']:
56-
for file in Path(f"./python-RAT/RATapi/examples/{directory}/").glob('*'):
61+
for file in Path(f"./python-RAT-{PYTHON_RAT_RELEASE}/RATapi/examples/{directory}/").glob('*'):
5762
shutil.copy(file, "./python_examples/notebooks/")
5863

59-
shutil.copytree("./python-RAT/RATapi/examples/data", "./python_examples/data", dirs_exist_ok=True)
64+
shutil.copytree(f"./python-RAT-{PYTHON_RAT_RELEASE}/RATapi/examples/data", "./python_examples/data", dirs_exist_ok=True)
6065

61-
shutil.rmtree("./python-RAT")
66+
shutil.rmtree(f"./python-RAT-{PYTHON_RAT_RELEASE}")
6267

6368
if not os.path.isfile("./matlab_examples/standardLayersDSPCSheet.html"):
6469
try:
@@ -134,7 +139,7 @@
134139
135140
<div class="admonition note">
136141
This page was generated from the notebook {{ env.docname.split('/')|last|e + '.ipynb' }} found in
137-
<a class="reference external" href="https://github.com/RascalSoftware/python-RAT/blob/"""+PYTHON_RAT_RELEASE+r"""/RATapi/examples/">the Python-RAT repository. </a>
142+
<a class="reference external" href="https://github.com/RascalSoftware/python-RAT/blob/"""+PYTHON_RAT_RELEASE+r"""/RATapi/examples/">the Python-RAT repository</a>.
138143
<a href="{{ env.docname.split('/')|last|e + '.ipynb' }}" class="reference download internal" download>Download notebook</a>.
139144
</div>
140145

0 commit comments

Comments
 (0)