MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / get_version

Function get_version

setup.py:18–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def get_version():
19 init_py_path = path.join(path.abspath(path.dirname(__file__)), "detectron2", "__init__.py")
20 init_py = open(init_py_path, "r").readlines()
21 version_line = [l.strip() for l in init_py if l.startswith("__version__")][0]
22 version = version_line.split("=")[-1].strip().strip("'\"")
23
24 # The following is used to build release packages.
25 # Users should never use it.
26 suffix = os.getenv("D2_VERSION_SUFFIX", "")
27 version = version + suffix
28 if os.getenv("BUILD_NIGHTLY", "0") == "1":
29 from datetime import datetime
30
31 date_str = datetime.today().strftime("%y%m%d")
32 version = version + ".dev" + date_str
33
34 new_init_py = [l for l in init_py if not l.startswith("__version__")]
35 new_init_py.append('__version__ = "{}"\n'.format(version))
36 with open(init_py_path, "w") as f:
37 f.write("".join(new_init_py))
38 return version
39
40
41def get_extensions():

Callers 1

setup.pyFile · 0.70

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected