Skip to content

Commit ac48560

Browse files
authored
setup.py: Define version directly
Define the version directly instead of loading from an environment variable and writing to a file.
1 parent de5b85a commit ac48560

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

python/setup.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,9 @@
1919
from datetime import datetime
2020
from setuptools import setup
2121

22-
23-
def _update_version_attr(new_version):
24-
for line in fileinput.input('flatbuffers/_version.py', inplace=True):
25-
if line.startswith('__version__'):
26-
line = re.sub(r'".*"', '"{}"'.format(new_version), line)
27-
sys.stdout.write(line)
28-
29-
30-
def version():
31-
version = os.getenv('VERSION', None)
32-
if version:
33-
# Most git tags are prefixed with 'v' (example: v1.2.3) this is
34-
# never desirable for artifact repositories, so we strip the
35-
# leading 'v' if it's present.
36-
version = version[1:] if version.startswith('v') else version
37-
else:
38-
# Default version is an ISO8601 compiliant datetime. PyPI doesn't allow
39-
# the colon ':' character in its versions, and time is required to allow
40-
# for multiple publications to master in one day. This datetime string
41-
# uses the "basic" ISO8601 format for both its date and time components
42-
# to avoid issues with the colon character (ISO requires that date and
43-
# time components of a date-time string must be uniformly basic or
44-
# extended, which is why the date component does not have dashes.
45-
#
46-
# Publications using datetime versions should only be made from master
47-
# to represent the HEAD moving forward.
48-
version = datetime.utcnow().strftime('%Y%m%d%H%M%S')
49-
print("VERSION environment variable not set, using datetime instead: {}"
50-
.format(version))
51-
52-
_update_version_attr(version)
53-
54-
return version
55-
56-
5722
setup(
5823
name='flatbuffers',
59-
version=version(),
24+
version='22.10.25',
6025
license='Apache 2.0',
6126
author='FlatBuffers Contributors',
6227
author_email='[email protected]',
@@ -81,4 +46,4 @@ def version():
8146
'Documentation': 'https://google.github.io/flatbuffers/',
8247
'Source': 'https://github.com/google/flatbuffers',
8348
},
84-
)
49+
)

0 commit comments

Comments
 (0)