Pocatek moznosti ovladani pomoci argumentu
This commit is contained in:
parent
5fb393d754
commit
284a0c1b8c
24
generate.py
24
generate.py
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import gzip, shutil, os, errno, json, subprocess
|
||||
import gzip, shutil, os, errno, json, subprocess, sys, getopt
|
||||
from distutils import dir_util
|
||||
from string import Template
|
||||
|
||||
@ -9,10 +9,10 @@ __author__ = "Pavel Brychta"
|
||||
__copyright__ = "Copyright (c) 2019-2020, Pavel Brychta"
|
||||
__credits__ = ["Pavel Brychta"]
|
||||
__license__ = "Private"
|
||||
__version__ = "1.1.0"
|
||||
__version__ = "1.2.0"
|
||||
__maintainer__ = "Pavel Brychta"
|
||||
__email__ = "Pablo@xPablo.cz"
|
||||
__status__ = "Private Beta"
|
||||
__status__ = "Beta"
|
||||
|
||||
PROJECT_FILE = "project.json" # soubor s popisem sestaveni projektu
|
||||
|
||||
@ -200,14 +200,21 @@ def getgitversion():
|
||||
revision = revision + b"m"
|
||||
return revision.decode("utf-8")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
def main(argv):
|
||||
projectfile = PROJECT_FILE # default jmeno projektoveho souboru
|
||||
try:
|
||||
opts, args = getopt.getopt(argv, "hi:o:", ["ifile="])
|
||||
except getopt.GetoptError:
|
||||
print("Chyba")
|
||||
sys.exit(2)
|
||||
for opt, arg in opts:
|
||||
if opt in ("-p", "-project"):
|
||||
projectfile = arg
|
||||
version = getgitversion()
|
||||
datadir = None
|
||||
templatevars['version'] = version
|
||||
print("Web version " + version)
|
||||
with open(PROJECT_FILE) as fd:
|
||||
with open(projectfile) as fd:
|
||||
project = json.load(fd)
|
||||
|
||||
if "build" in project:
|
||||
@ -250,3 +257,6 @@ if __name__ == "__main__":
|
||||
with open(os.path.normpath(os.path.join(datadir, flist)), 'wb') as outfile:
|
||||
outfile.write(flistcontent.encode('ascii', 'ignore'))
|
||||
outfile.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
Loading…
Reference in New Issue
Block a user