mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
gen-license.py: Fall back to submodule HEAD file for version info
This commit is contained in:
committed by
mborgerson
parent
517e4b3414
commit
a1c02b793e
@ -145,10 +145,19 @@ class Submodule:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def head(self):
|
def head(self):
|
||||||
head = subprocess.run(['git', 'rev-parse', 'HEAD'],
|
try:
|
||||||
cwd=self.path, capture_output=True,
|
return subprocess.run(['git', 'rev-parse', 'HEAD'],
|
||||||
check=True)
|
cwd=self.path, capture_output=True,
|
||||||
return head.stdout.decode('utf-8').strip()
|
check=True).stdout.decode('utf-8').strip()
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
commit_file_path = os.path.join(self.path, 'HEAD')
|
||||||
|
if os.path.exists(commit_file_path):
|
||||||
|
return open(commit_file_path).read().strip()
|
||||||
|
|
||||||
|
raise Exception('Failed to determine submodule revision')
|
||||||
|
return ''
|
||||||
|
|
||||||
LIBS = [
|
LIBS = [
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user