8000 Merge remote-tracking branch 'origin/main' · litui/circuitpython@00aab25 · GitHub
[go: up one dir, main page]

Skip to content

Commit 00aab25

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 5f65a88 + 32d8dd4 commit 00aab25

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

py/makeversionhdr.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,25 @@ def get_version_info_from_git():
5959
return git_tag, git_hash, ver
6060

6161

62-
def get_version_info_from_docs_conf():
63-
with open(os.path.join(os.path.dirname(sys.argv[0]), "..", "conf.py")) as f:
64-
for line in f:
65-
if line.startswith("version = release = '"):
66-
ver = line.strip().split(" = ")[2].strip("'")
67-
git_tag = "v" + ver
68-
ver = ver.split(".")
69-
if len(ver) == 2:
70-
ver.append("0")
71-
return git_tag, "<no hash>", ver
72-
return None
62+
def cannot_determine_version():
63+
raise SystemExit(
64+
"""Cannot determine version.
65+
66+
CircuitPython must be built from a git clone with tags.
67+
If you cloned from a fork, fetch the tags from adafruit/circuitpython as follows:
68+
69+
git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD"""
70+
)
7371

7472

7573
def make_version_header(filename):
76-
# Get version info using git, with fallback to docs/conf.py
74+
# Get version info using git (required)
7775
info = get_version_info_from_git()
7876
if info is None:
79-
info = get_version_info_from_docs_conf()
80-
77+
cannot_determine_version()
8178
git_tag, git_hash, ver = info
8279
if len(ver) < 3:
83-
ver = ("0", "0", "0")
84-
version_string = git_hash
80+
cannot_determine_version()
8581
else:
8682
version_string = ".".join(ver)
8783

0 commit comments

Comments
 (0)
0