Update-catalog.py: —quiet option

This commit is contained in:
James Turner 2018-10-17 11:04:11 +01:00
parent feae4a2d56
commit 391ceaea11

View File

@ -24,6 +24,8 @@ parser.add_argument("--no-update",
action="store_true")
parser.add_argument("--clean", help="Force regeneration of all zip files",
action="store_true")
parser.add_argument("--quiet", help="Only print warnings and errors",
action="store_true")
parser.add_argument("dir", help="Catalog directory")
args = parser.parse_args()
@ -64,6 +66,7 @@ def scan_dir_for_change_date_mtime(path):
return maxsec
def make_aircraft_zip(repo_path, name, zip_file):
if (not args.quiet):
print "Updating:", name + '.zip'
savedir = os.getcwd()
os.chdir(repo_path)
@ -136,6 +139,7 @@ def process_aircraft_dir(name, repo_path):
(package, variants) = catalog.scan_aircraft_dir(aircraft_dir, includes)
if package == None:
if not args.quiet:
print "skipping:", name, "(no -set.xml files)"
return
@ -168,10 +172,12 @@ def process_aircraft_dir(name, repo_path):
or dir_mtime > os.path.getmtime(zipfile) \
or args.clean:
# rebuild zip file
if not args.quiet:
print "updating:", zipfile
make_aircraft_zip(repo_path, name, zipfile)
md5sum = get_md5sum(zipfile)
else:
if not args.quiet:
print "(no change)"
if md5sum == "":
md5sum = get_md5sum(zipfile)
@ -300,6 +306,7 @@ for scm in scm_list:
names = os.listdir(repo_path)
for name in sorted(names, key=lambda s: s.lower()):
if name in skip_list:
if not args.quiet:
print "skipping:", name
continue