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
|
* `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
|
* `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í
|
K projektu ho většinou přidáváme pomocí
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
20
generate.py
20
generate.py
@ -9,7 +9,7 @@ __author__ = "Pavel Brychta"
|
|||||||
__copyright__ = "Copyright (c) 2019-2020, Pavel Brychta"
|
__copyright__ = "Copyright (c) 2019-2020, Pavel Brychta"
|
||||||
__credits__ = ["Pavel Brychta"]
|
__credits__ = ["Pavel Brychta"]
|
||||||
__license__ = "Private"
|
__license__ = "Private"
|
||||||
__version__ = "1.2.0"
|
__version__ = "1.3.0"
|
||||||
__maintainer__ = "Pavel Brychta"
|
__maintainer__ = "Pavel Brychta"
|
||||||
__email__ = "Pablo@xPablo.cz"
|
__email__ = "Pablo@xPablo.cz"
|
||||||
__status__ = "Beta"
|
__status__ = "Beta"
|
||||||
@ -156,7 +156,7 @@ def copycompresstree(src, dst, compress, dirbase):
|
|||||||
outfile = gzip.open(d, 'wb')
|
outfile = gzip.open(d, 'wb')
|
||||||
outfile.writelines(infile)
|
outfile.writelines(infile)
|
||||||
outfile.close()
|
outfile.close()
|
||||||
if flist is not None and not fignore:
|
if (flist is not None) and (not fignore):
|
||||||
flc = item + ".gz"
|
flc = item + ".gz"
|
||||||
if fforce:
|
if fforce:
|
||||||
flc += ",force"
|
flc += ",force"
|
||||||
@ -165,7 +165,7 @@ def copycompresstree(src, dst, compress, dirbase):
|
|||||||
d = os.path.normpath(os.path.join(dst, item))
|
d = os.path.normpath(os.path.join(dst, item))
|
||||||
print(s + ' (F)-> ' + d)
|
print(s + ' (F)-> ' + d)
|
||||||
shutil.copy2(s, d)
|
shutil.copy2(s, d)
|
||||||
if flist is not None and not fignore:
|
if (flist is not None) and (not fignore):
|
||||||
flc = item
|
flc = item
|
||||||
if fforce:
|
if fforce:
|
||||||
flc += ",force"
|
flc += ",force"
|
||||||
@ -174,12 +174,16 @@ def copycompresstree(src, dst, compress, dirbase):
|
|||||||
|
|
||||||
# Ziskani verze repozitare z gitu
|
# Ziskani verze repozitare z gitu
|
||||||
def getgitversion():
|
def getgitversion():
|
||||||
|
isgit = True
|
||||||
after = b"0"
|
after = b"0"
|
||||||
mod = b""
|
mod = b""
|
||||||
try:
|
try:
|
||||||
tag = subprocess.check_output(["git", "describe", "--tags", "--always"]).strip()
|
tag = subprocess.check_output(["git", "describe", "--tags", "--always"]).strip()
|
||||||
except:
|
except:
|
||||||
tag = b"0.0.0"
|
tag = b"0.0.0"
|
||||||
|
isgit = False
|
||||||
|
|
||||||
|
if isgit:
|
||||||
if tag.find(b".") < 0:
|
if tag.find(b".") < 0:
|
||||||
tag = b"0.0.0"
|
tag = b"0.0.0"
|
||||||
if tag == b"0.0.0":
|
if tag == b"0.0.0":
|
||||||
@ -198,9 +202,14 @@ def getgitversion():
|
|||||||
revision = tag + b'.' + after
|
revision = tag + b'.' + after
|
||||||
if mod != b"":
|
if mod != b"":
|
||||||
revision = revision + b"m"
|
revision = revision + b"m"
|
||||||
|
else:
|
||||||
|
revision = b"0.0.0.x"
|
||||||
return revision.decode("utf-8")
|
return revision.decode("utf-8")
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
global flist
|
||||||
|
global flistcontent
|
||||||
|
|
||||||
projectfile = PROJECT_FILE # default jmeno projektoveho souboru
|
projectfile = PROJECT_FILE # default jmeno projektoveho souboru
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv, "hi:o:", ["ifile="])
|
opts, args = getopt.getopt(argv, "hi:o:", ["ifile="])
|
||||||
@ -217,6 +226,11 @@ def main(argv):
|
|||||||
with open(projectfile) as fd:
|
with open(projectfile) as fd:
|
||||||
project = json.load(fd)
|
project = json.load(fd)
|
||||||
|
|
||||||
|
if "templatevariables" in project:
|
||||||
|
tv = project["templatevariables"]
|
||||||
|
for entry in tv:
|
||||||
|
templatevars[entry] = tv[entry]
|
||||||
|
|
||||||
if "build" in project:
|
if "build" in project:
|
||||||
build = project["build"]
|
build = project["build"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user