Skip to content

Commit 844539a

Browse files
committed
Attempt at making versions only exist in git
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
1 parent 04857a5 commit 844539a

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

cf_remote/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def string():
2-
return "0.1.5"
2+
return "UNKOWN_VERSION"

setup.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
import setuptools
2-
from cf_remote import version
2+
import subprocess
3+
4+
cf_remote_version = subprocess.run(['git', 'describe', '--tags'], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
5+
assert "." in cf_remote_version
6+
7+
with open("cf_remote/version.py", "r", encoding="utf-8") as fh:
8+
version_module = fh.read()
9+
10+
assert "UNKOWN_VERSION" in version_module
11+
12+
version_module = version_module.replace("UNKOWN_VERSION", cf_remote_version)
13+
14+
with open("cf_remote/version.py", "w", encoding="utf-8") as fh:
15+
fh.write(version_module)
316

417
with open("README.md", "r", encoding="utf-8") as fh:
518
long_description = fh.read()
619

720
setuptools.setup(
821
name="cf-remote",
9-
version=f"{version.string()}",
22+
version=cf_remote_version,
1023
author="Northern.tech, Inc.",
1124
author_email="contact@northern.tech",
1225
description="Tooling to deploy CFEngine (and much more)",

0 commit comments

Comments
 (0)