-
-
Notifications
You must be signed in to change notification settings - Fork 606
/
Copy pathwrite_manifest.py
29 lines (26 loc) · 971 Bytes
/
write_manifest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import pathlib
import glob
pybamm_data = []
for file_ext in ["*.csv", "*.py", "*.md"]:
# Get all the files ending in file_ext in pybamm/input dir.
# list_of_files = [
# 'pybamm/input/drive_cycles/car_current.csv',
# 'pybamm/input/drive_cycles/US06.csv',
# ...
list_of_files = glob.glob("pybamm/input/**/" + file_ext, recursive=True)
# Add these files to pybamm_data.
# The path must be relative to the package dir (pybamm/), so
# must process the content of list_of_files to take out the top
# pybamm/ dir, i.e.:
# ['input/drive_cycles/car_current.csv',
# 'input/drive_cycles/US06.csv',
# ...
pybamm_data.extend(
[os.path.join(*pathlib.Path(filename).parts[1:]) for filename in list_of_files]
)
pybamm_data.append("./version")
pybamm_data.append("./CITATIONS.txt")
with open("MANIFEST.in", "w") as manifest:
for data_file in pybamm_data:
manifest.write(data_file + "\n")