forked from iterorganization/imas-data-dictionary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
67 lines (57 loc) · 1.92 KB
/
setup.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from setuptools import setup
from setuptools.command.install import install
from setuptools_scm import get_version
import glob
import os
import pathlib
import sys
sys.path.append(str(pathlib.Path(__file__).parent.resolve()))
current_directory = pathlib.Path(__file__).parent.resolve()
class CustomInstallCommand(install):
description = "DD files generation"
paths = []
def run(self):
from generate import (
generate_dd_data_dictionary,
generate_dd_data_dictionary_validation,
generate_html_documentation,
generate_ids_cocos_transformations_symbolic_table,
generate_idsnames,
)
from install import (
copy_utilities,
create_idsdef_symlink,
install_html_docs,
install_sphinx_docs,
install_dd_files,
install_identifiers_files,
)
# Generate
generate_dd_data_dictionary()
generate_html_documentation()
generate_ids_cocos_transformations_symbolic_table()
generate_idsnames()
generate_dd_data_dictionary_validation()
# install
install_html_docs()
install_sphinx_docs()
install_dd_files()
create_idsdef_symlink()
copy_utilities()
install_identifiers_files()
self.set_data_files()
super().run()
def set_data_files(self):
version = get_version()
if os.path.exists("install"):
for path, directories, filenames in os.walk("install"):
CustomInstallCommand.paths.append((path.replace("install", "dd_" + version), glob.glob(path + "/*.*")))
else:
raise Exception("Couldn't find IDSDef.xml, Can not install data dictionary python package")
if __name__ == "__main__":
setup(
data_files=CustomInstallCommand.paths,
cmdclass={
"install": CustomInstallCommand,
},
)