-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
109 lines (87 loc) · 2.91 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import sys
from setuptools import setup
from setuptools.command.install import install as _install
from setuptools.command.develop import develop as _develop
from setuptools.command.build_py import build_py as _build_py
from setuptools import Command
from setuptools import find_packages
import re
from subprocess import run
packageName = "myGym"
with open("README.md", "r") as f:
long_description = f.read()
with open("LICENSE.txt", "r") as f:
license_text = f.read()
# versionRegex = re.compile("\d+[.]\d+[.]\d+[^\s]*")
# with open("CHANGELOG.md", "r") as f:
# for line in f:
# versionMatch = versionRegex.match(line)
# if versionMatch:
# version = versionMatch.group()
# break
def writeInitPy():
from setuptools_scm import get_version
version = get_version()
print(f"Building version {version}")
init_file = f"{packageName}/__init__.py"
fileText = [
'# This file was generated by the setup.py and will be rewritten at the next build\n',
f'__version__ = "{version}"\n',
f'__name__ = "{packageName}"'
]
with open(init_file, "w") as f:
f.writelines(fileText)
class BuildWrapper(_build_py):
def run(self):
writeInitPy()
_build_py.run(self)
class InstallWrapper(_install):
def run(self):
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>")
writeInitPy()
_install.run(self)
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<")
self.execute(self._post_install, (),
msg="Running post install task")
def _post_install(self):
print("no task post-install tasks")
class DevelopWrapper(_develop):
def run(self):
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>")
writeInitPy()
_develop.run(self)
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<")
self.execute(self._post_install, (),
msg="Running post install task")
def _post_install(self):
print("no task post-install tasks")
setup(
name=packageName,
# version=version,
setup_requires=["setuptools_scm"],
use_scm_version=True,
description='myGym',
long_description=long_description,
author='Incognite group CIIRC CVUT',
maintainer_email='michal.vavrecka@cvut.cz',
url='',
download_url='',
license=license_text,
include_package_data=True,
packages=find_packages(),
cmdclass={
'build_py': BuildWrapper,
'install': InstallWrapper,
'develop': DevelopWrapper,
},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Development Status :: 3 - Alpha",
"Intended Audience :: Education",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Human Machine Interfaces"
]
)