Generovani flist.txt opet funkcni, template promenne, verze 1.3.0

This commit is contained in:
Pavel Brychta 2020-08-28 12:53:37 +02:00
parent 284a0c1b8c
commit 58983e4b1b
2 changed files with 38 additions and 19 deletions

View File

@ -65,6 +65,11 @@ Doplňující parametry v sekci `copy` jsou:
* `flistignore` - soubor se neuloží do seznamu v souboru
* `syntehtic` - příznak, že soubor pro přesun vznikl pomocí sekce `combine` a nemá se tedy hledat ve zdrojových adresářích
* `templatevariables` - seznam proměnných a jejich hodnoty, nahrazované template procesorem.
```json
"templatevariables": {"title":"Titulek", "name":"Jmeno aplikace"}
```
K projektu ho většinou přidáváme pomocí
```sh

View File

@ -9,7 +9,7 @@ __author__ = "Pavel Brychta"
__copyright__ = "Copyright (c) 2019-2020, Pavel Brychta"
__credits__ = ["Pavel Brychta"]
__license__ = "Private"
__version__ = "1.2.0"
__version__ = "1.3.0"
__maintainer__ = "Pavel Brychta"
__email__ = "Pablo@xPablo.cz"
__status__ = "Beta"
@ -156,7 +156,7 @@ def copycompresstree(src, dst, compress, dirbase):
outfile = gzip.open(d, 'wb')
outfile.writelines(infile)
outfile.close()
if flist is not None and not fignore:
if (flist is not None) and (not fignore):
flc = item + ".gz"
if fforce:
flc += ",force"
@ -165,7 +165,7 @@ def copycompresstree(src, dst, compress, dirbase):
d = os.path.normpath(os.path.join(dst, item))
print(s + ' (F)-> ' + d)
shutil.copy2(s, d)
if flist is not None and not fignore:
if (flist is not None) and (not fignore):
flc = item
if fforce:
flc += ",force"
@ -174,33 +174,42 @@ def copycompresstree(src, dst, compress, dirbase):
# Ziskani verze repozitare z gitu
def getgitversion():
isgit = True
after = b"0"
mod = b""
try:
tag = subprocess.check_output(["git", "describe", "--tags", "--always"]).strip()
except:
tag = b"0.0.0"
if tag.find(b".") < 0:
tag = b"0.0.0"
if tag == b"0.0.0":
after = subprocess.check_output(["git", "rev-list", "--all", "--count"]).strip()
else:
if tag.find(b"-") > 0:
taginfo = tag.split(b'-')
tag = taginfo[0]
after = taginfo[1]
isgit = False
if isgit:
if tag.find(b".") < 0:
tag = b"0.0.0"
if tag == b"0.0.0":
after = subprocess.check_output(["git", "rev-list", "--all", "--count"]).strip()
else:
after = subprocess.check_output(["git", "rev-list", tag + "..HEAD", "--count"]).strip()
mod = subprocess.check_output(["git", "diff-index", "HEAD"]).strip()
if after == b"0":
revision = tag
if tag.find(b"-") > 0:
taginfo = tag.split(b'-')
tag = taginfo[0]
after = taginfo[1]
else:
after = subprocess.check_output(["git", "rev-list", tag + "..HEAD", "--count"]).strip()
mod = subprocess.check_output(["git", "diff-index", "HEAD"]).strip()
if after == b"0":
revision = tag
else:
revision = tag + b'.' + after
if mod != b"":
revision = revision + b"m"
else:
revision = tag + b'.' + after
if mod != b"":
revision = revision + b"m"
revision = b"0.0.0.x"
return revision.decode("utf-8")
def main(argv):
global flist
global flistcontent
projectfile = PROJECT_FILE # default jmeno projektoveho souboru
try:
opts, args = getopt.getopt(argv, "hi:o:", ["ifile="])
@ -217,6 +226,11 @@ def main(argv):
with open(projectfile) as fd:
project = json.load(fd)
if "templatevariables" in project:
tv = project["templatevariables"]
for entry in tv:
templatevars[entry] = tv[entry]
if "build" in project:
build = project["build"]