mirror of https://github.com/xemu-project/xemu.git
scripts/gen-license.py: Support wrap versions
This commit is contained in:
parent
f96f2754cc
commit
4c943c1956
|
@ -10,6 +10,7 @@ used to build the binary.
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
gplv2 = 'gplv2'
|
gplv2 = 'gplv2'
|
||||||
|
@ -148,10 +149,13 @@ class Submodule:
|
||||||
def head(self):
|
def head(self):
|
||||||
if self.path.endswith(".wrap"):
|
if self.path.endswith(".wrap"):
|
||||||
with open(self.path, "r", encoding="utf-8") as file:
|
with open(self.path, "r", encoding="utf-8") as file:
|
||||||
for line in file.readlines():
|
contents = file.read()
|
||||||
revision_pfx = "revision="
|
revision = re.search(r"^revision\s*=\s*(.*)", contents, re.MULTILINE)
|
||||||
if line.startswith(revision_pfx):
|
if revision:
|
||||||
return line[len(revision_pfx):].strip()
|
return revision.group(1)
|
||||||
|
wrapdb_version = re.search(r"^wrapdb_version\s*=\s*([^-]*)", contents, re.MULTILINE)
|
||||||
|
if wrapdb_version:
|
||||||
|
return wrapdb_version.group(1)
|
||||||
assert False, "revision not found for subproject"
|
assert False, "revision not found for subproject"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue