Skip to content

Commit

Permalink
Fix determination of wasi-sdk version when built in a subdirectory.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jul 13, 2024
1 parent 297b6d0 commit bab4cf0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
GIT_REF_LEN = 12


def exec(command, cwd=None):
def exec(command, cwd):
result = subprocess.run(command, stdout=subprocess.PIPE,
universal_newlines=True, check=True, cwd=cwd)
return result.stdout.strip()


def git_commit(dir='.'):
def git_commit(dir):
return exec(['git', 'rev-parse', f'--short={GIT_REF_LEN}', 'HEAD'], dir)


Expand Down Expand Up @@ -61,7 +61,8 @@ def parse_git_version(version):

def git_version():
version = exec(['git', 'describe', '--long', '--candidates=999',
'--match=wasi-sdk-*', '--dirty=+m', f'--abbrev={GIT_REF_LEN}'])
'--match=wasi-sdk-*', '--dirty=+m', f'--abbrev={GIT_REF_LEN}'],
os.path.dirname(sys.argv[0]))
major, minor, git, dirty = parse_git_version(version)
version = f'{major}.{minor}'
if git:
Expand Down

0 comments on commit bab4cf0

Please sign in to comment.