Skip to content

Commit ae0504d

Browse files
author
Tatu Aalto
authored
Merge pull request #33 from oikarinen-fs/revert_version_reading
fix: retrieve setup.py version from __init__.py
2 parents 15147e9 + 8d1a998 commit ae0504d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
from setuptools import setup, find_packages
2-
import subprocess
2+
from distutils.util import convert_path
3+
from typing import Dict
34

45

56
def _read_long_description():
67
with open("README.md") as readme:
78
return readme.read()
89

910

10-
GIT_VERSION = (
11-
subprocess.check_output("git describe --always".split())
12-
.strip()
13-
.decode("ascii")
14-
.replace("v", "", 1)
15-
)
1611
DEV_REQUIRE = [
1712
"pytest",
1813
"pytest-cov",
@@ -23,6 +18,11 @@ def _read_long_description():
2318
NAME = "flaky_tests_detection"
2419
NAME_DASHED = NAME.replace("_", "-")
2520

21+
init_content: Dict[str, str] = {}
22+
init_path = convert_path('flaky_tests_detection/__init__.py')
23+
with open(init_path) as init_file:
24+
exec(init_file.read(), init_content)
25+
2626

2727
setup(
2828
name=NAME_DASHED,
@@ -34,7 +34,7 @@ def _read_long_description():
3434
url=f"https://github.com/F-Secure/{NAME_DASHED}",
3535
license="Apache License 2.0",
3636
platforms="any",
37-
version=GIT_VERSION,
37+
version=init_content["__version__"],
3838
packages=find_packages(exclude=[f"{NAME}.tests", f"{NAME}.tests.*"]),
3939
entry_points={
4040
"console_scripts": [

0 commit comments

Comments
 (0)