-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
153 lines (141 loc) · 4.46 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
"""Installation script."""
import setuptools
# inline:
# from omega.logic import lexyacc
# import git
PACKAGE_NAME = 'omega'
DESCRIPTION = (
'Symbolic algorithms for solving '
'games of infinite duration.')
PACKAGE_URL = f'https://github.com/tulip-control/{PACKAGE_NAME}'
PROJECT_URLS = {
'Bug Tracker':
'https://github.com/tulip-control/omega/issues',
'Documentation':
'https://github.com/tulip-control/omega/blob/main/doc/doc.md',
'Source Code':
'https://github.com/tulip-control/omega'}
README = 'README.md'
VERSION_FILE = f'{PACKAGE_NAME}/_version.py'
VERSION = '0.4.1'
VERSION_FILE_TEXT = (
'# This file was generated from setup.py\n'
"version = '{version}'\n")
PYTHON_REQUIRES = '>=3.11'
INSTALL_REQUIRES = [
'astutils >= 0.0.5',
'dd >= 0.6.0',
'natsort >= 3.5.3',
'networkx >= 2.0',
'ply >= 3.6, <= 3.10',
'pydot >= 1.2.2']
TESTS_REQUIRE = ['pytest >= 4.6.11']
CLASSIFIERS = [
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering']
KEYWORDS = [
'first-order', 'propositional', 'logic',
'quantifier', 'forall', 'exists',
'fixpoint', 'mu-calculus', 'formula', 'flatten',
'bitblaster', 'bitvector', 'arithmetic',
'binary decision diagram', 'symbolic',
'games', 'specification', 'system',
'assume', 'guarantee', 'satisfiability',
'enumeration', 'state machine',
'transition system', 'automaton', 'automata',
'streett', 'rabin',
'temporal logic', 'temporal tester',
'gr1', 'generalized reactivity']
def git_version(version):
"""Return version with local version identifier."""
import git
repo = git.Repo('.git')
repo.git.status()
# assert versions are increasing
latest_tag = repo.git.describe(
match='v[0-9]*', tags=True, abbrev=0)
latest_version = _parse_version(latest_tag[1:])
given_version = _parse_version(version)
if latest_version > given_version:
raise AssertionError(
(latest_tag, version))
sha = repo.head.commit.hexsha
if repo.is_dirty():
return f'{version}.dev0+{sha}.dirty'
# commit is clean
# is it release of `version` ?
try:
tag = repo.git.describe(
match='v[0-9]*', exact_match=True,
tags=True, dirty=True)
except git.GitCommandError:
return f'{version}.dev0+{sha}'
assert tag == 'v' + version, (tag, version)
return version
def _parse_version(
version:
str
) -> tuple[
int, int, int]:
"""Return numeric version."""
numerals = version.split('.')
if len(numerals) != 3:
raise ValueError(numerals)
return tuple(map(int, numerals))
def run_setup():
"""Build parser, get version from `git`, install."""
# version
try:
version = git_version(VERSION)
except:
print('No git info: Assume release.')
version = VERSION
s = VERSION_FILE_TEXT.format(version=version)
with open(VERSION_FILE, 'w') as f:
f.write(s)
_build_parser()
with open(README) as fd:
long_description = fd.read()
setuptools.setup(
name=PACKAGE_NAME,
version=version,
description=DESCRIPTION,
long_description=long_description,
long_description_content_type='text/markdown',
author='Caltech Control and Dynamical Systems',
author_email='tulip@tulip-control.org',
url=PACKAGE_URL,
project_urls=PROJECT_URLS,
license='BSD',
python_requires=PYTHON_REQUIRES,
install_requires=INSTALL_REQUIRES,
packages=[
PACKAGE_NAME,
'omega.games',
'omega.logic',
'omega.symbolic'],
package_dir={PACKAGE_NAME: PACKAGE_NAME},
classifiers=CLASSIFIERS,
keywords=KEYWORDS)
def _build_parser():
"""Cache the parser's LALR(1) state machine."""
try:
import astutils
import ply
except ImportError:
print(
'WARNING: `omega` could not cache '
'parser tables (this message can '
'be ignored if running only for '
'"egg_info").')
return
from omega.logic import lexyacc
lexyacc._rewrite_tables(
outputdir='./omega/logic/')
if __name__ == '__main__':
run_setup()