forked from OpenPythons/OpenPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmicropython-patch.diff
More file actions
32 lines (30 loc) · 1.91 KB
/
micropython-patch.diff
File metadata and controls
32 lines (30 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- py/makeversionhdr.py
+++ py/makeversionhdr.py
@@ -21,7 +21,7 @@ def get_version_info_from_git():
# Note: git describe doesn't work if no tag is available
try:
- git_tag = subprocess.check_output(["git", "describe", "--dirty", "--always"], stderr=subprocess.STDOUT, universal_newlines=True).strip()
+ git_tag = subprocess.check_output(["git", "describe", "--dirty", "--always"], stderr=subprocess.STDOUT, universal_newlines=True, cwd=os.path.dirname(sys.argv[0])).strip()
except subprocess.CalledProcessError as er:
if er.returncode == 128:
# git exit code of 128 means no repository found
@@ -30,7 +30,7 @@ def get_version_info_from_git():
except OSError:
return None
try:
- git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], stderr=subprocess.STDOUT, universal_newlines=True).strip()
+ git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], stderr=subprocess.STDOUT, universal_newlines=True, cwd=os.path.dirname(sys.argv[0])).strip()
except subprocess.CalledProcessError:
git_hash = "unknown"
except OSError:
@@ -38,9 +38,9 @@ def get_version_info_from_git():
try:
# Check if there are any modified files.
- subprocess.check_call(["git", "diff", "--no-ext-diff", "--quiet", "--exit-code"], stderr=subprocess.STDOUT)
+ subprocess.check_call(["git", "diff", "--no-ext-diff", "--quiet", "--exit-code"], stderr=subprocess.STDOUT, cwd=os.path.dirname(sys.argv[0]))
# Check if there are any staged files.
- subprocess.check_call(["git", "diff-index", "--cached", "--quiet", "HEAD", "--"], stderr=subprocess.STDOUT)
+ subprocess.check_call(["git", "diff-index", "--cached", "--quiet", "HEAD", "--"], stderr=subprocess.STDOUT, cwd=os.path.dirname(sys.argv[0]))
except subprocess.CalledProcessError:
git_hash += "-dirty"
except OSError: