-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.py
81 lines (63 loc) · 2.18 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os
from pathlib import Path
from subprocess import check_call
import setuptools
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.sdist import sdist
HERE = Path(__file__).parent
def gitcmd_update_submodules():
"""
Check if the package is being deployed as a git repository. If so, recursively
update all dependencies.
Returns:
True if the package is a git repository and the modules were updated. False otherwise.
"""
if os.path.exists(os.path.join(HERE, '.git')):
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
return True
return False
class gitcmd_develop(develop):
"""
Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure.
"""
def run(self):
gitcmd_update_submodules()
develop.run(self)
class gitcmd_install(install):
"""
Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure.
"""
def run(self):
gitcmd_update_submodules()
install.run(self)
class gitcmd_sdist(sdist):
"""
Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure;.
"""
def run(self):
gitcmd_update_submodules()
sdist.run(self)
if __name__ == '__main__':
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
version='1.4.10', # also update version in metrics.py -> version
author_email='[email protected]',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/DIAGNijmegen/picai_eval',
project_urls={
"Bug Tracker": "https://github.com/DIAGNijmegen/picai_eval/issues"
},
license='Apache 2.0',
packages=['picai_eval', 'picai_eval.stat_util'],
cmdclass={
'develop': gitcmd_develop,
'install': gitcmd_install,
'sdist': gitcmd_sdist,
},
)