@@ -59,29 +59,25 @@ def get_version_info_from_git():
59
59
return git_tag , git_hash , ver
60
60
61
61
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
+ )
73
71
74
72
75
73
def make_version_header (filename ):
76
- # Get version info using git, with fallback to docs/conf.py
74
+ # Get version info using git (required)
77
75
info = get_version_info_from_git ()
78
76
if info is None :
79
- info = get_version_info_from_docs_conf ()
80
-
77
+ cannot_determine_version ()
81
78
git_tag , git_hash , ver = info
82
79
if len (ver ) < 3 :
83
- ver = ("0" , "0" , "0" )
84
- version_string = git_hash
80
+ cannot_determine_version ()
85
81
else :
86
82
version_string = "." .join (ver )
87
83
0 commit comments