Generovani flist.txt opet funkcni, template promenne, verze 1.3.0
This commit is contained in:
parent
284a0c1b8c
commit
58983e4b1b
@ -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
|
||||
|
20
generate.py
20
generate.py
@ -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,12 +174,16 @@ 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"
|
||||
isgit = False
|
||||
|
||||
if isgit:
|
||||
if tag.find(b".") < 0:
|
||||
tag = b"0.0.0"
|
||||
if tag == b"0.0.0":
|
||||
@ -198,9 +202,14 @@ def getgitversion():
|
||||
revision = tag + b'.' + after
|
||||
if mod != b"":
|
||||
revision = revision + b"m"
|
||||
else:
|
||||
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"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user