fix makeversionhdr
This commit is contained in:
parent
dc277f0aff
commit
aceb573c88
@ -13,11 +13,11 @@ import pathlib
|
|||||||
import datetime
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
// CIRCUITPY: use external script
|
# CIRCUITPY: use external script
|
||||||
tools_describe = str(pathlib.Path(__file__).parent.parent / "tools/describe")
|
tools_describe = str(pathlib.Path(__file__).parent.parent / "tools/describe")
|
||||||
|
|
||||||
|
|
||||||
def get_version_info_from_git():
|
def get_version_info_from_git(repo_path):
|
||||||
# Python 2.6 doesn't have check_output, so check for that
|
# Python 2.6 doesn't have check_output, so check for that
|
||||||
try:
|
try:
|
||||||
subprocess.check_output
|
subprocess.check_output
|
||||||
@ -28,7 +28,11 @@ def get_version_info_from_git():
|
|||||||
# Note: git describe doesn't work if no tag is available
|
# Note: git describe doesn't work if no tag is available
|
||||||
try:
|
try:
|
||||||
git_tag = subprocess.check_output(
|
git_tag = subprocess.check_output(
|
||||||
[tools_describe], stderr=subprocess.STDOUT, universal_newlines=True, shell=True
|
[tools_describe],
|
||||||
|
cwd=repo_path,
|
||||||
|
shell=True,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
universal_newlines=True,
|
||||||
).strip()
|
).strip()
|
||||||
except subprocess.CalledProcessError as er:
|
except subprocess.CalledProcessError as er:
|
||||||
if er.returncode == 128:
|
if er.returncode == 128:
|
||||||
@ -85,9 +89,9 @@ If you cloned from a fork, fetch the tags from adafruit/circuitpython as follows
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def make_version_header(filename):
|
def make_version_header(repo_path, filename):
|
||||||
# Get version info using git (required)
|
# Get version info using git (required)
|
||||||
info = get_version_info_from_git()
|
info = get_version_info_from_git(repo_path)
|
||||||
if info is None:
|
if info is None:
|
||||||
cannot_determine_version()
|
cannot_determine_version()
|
||||||
git_tag, git_hash, ver = info
|
git_tag, git_hash, ver = info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user