Skip to content

Commit e545718

Browse files
authored
Update setup.py
1 parent eb40156 commit e545718

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

setup.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
from setuptools import setup, find_packages
2+
import subprocess
23
import codecs
34
import os
45

5-
VERSION = '0.0.1'
6+
#VERSION = '0.0.1'
7+
VERSION = (
8+
subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE)
9+
.stdout.decode("utf-8")
10+
.strip()
11+
)
12+
13+
if "-" in VERSION:
14+
# when not on tag, git describe outputs: "1.3.3-22-gdf81228"
15+
# pip has gotten strict with version numbers
16+
# so change it to: "1.3.3+22.git.gdf81228"
17+
# See: https://peps.python.org/pep-0440/#local-version-segments
18+
v,i,s = VERSION.split("-")
19+
VERSION = v + "+" + i + ".git." + s
20+
21+
# assert "-" not in cf_remote_version
22+
# assert "." in cf_remote_version
23+
24+
# assert os.path.isfile("cf_remote/version.py")
25+
# with open("cf_remote/VERSION", "w", encoding="utf-8") as fh:
26+
# fh.write("%s\n" % cf_remote_version)
27+
28+
# with open("README.md", "r", encoding="utf-8") as fh:
29+
# long_description = fh.read()
30+
631
DESCRIPTION = 'A simple library for Python beginners'
732

833
# Setting up
@@ -23,4 +48,4 @@
2348
"Operating System :: MacOS :: MacOS X",
2449
"Operating System :: Microsoft :: Windows",
2550
]
26-
)
51+
)

0 commit comments

Comments
 (0)