Add configuration flag --no-compress-manpages.

This commit is contained in:
Herb Miller Jr 2018-03-24 19:42:49 -04:00 committed by Nick Hall
parent e1ca8303e5
commit fd55f0abff

View File

@ -67,6 +67,8 @@ resource_path = ''
packaging = False packaging = False
argparser = argparse.ArgumentParser(add_help=False) argparser = argparse.ArgumentParser(add_help=False)
argparser.add_argument("--resourcepath", dest="resource_path") argparser.add_argument("--resourcepath", dest="resource_path")
argparser.add_argument("--no-compress-manpages", dest="no_compress_manpages",
action="store_true")
args, passthrough = argparser.parse_known_args() args, passthrough = argparser.parse_known_args()
if args.resource_path: if args.resource_path:
resource_path = args.resource_path resource_path = args.resource_path
@ -159,27 +161,30 @@ def build_man(build_cmd):
subst_vars = (('@VERSION@', VERSION), ) subst_vars = (('@VERSION@', VERSION), )
substitute_variables(filename, newfile, subst_vars) substitute_variables(filename, newfile, subst_vars)
import gzip src = 'gramps.1'
man_file_gz = os.path.join(newdir, 'gramps.1.gz') if not args.no_compress_manpages:
if os.path.exists(man_file_gz): import gzip
if newer(filename, man_file_gz): src += '.gz'
os.remove(man_file_gz) man_file_gz = os.path.join(newdir, src)
else: if os.path.exists(man_file_gz):
filename = False if newer(filename, man_file_gz):
os.remove(man_file_gz)
else:
filename = False
os.remove(newfile)
if filename:
#Binary io, so open is OK
with open(newfile, 'rb') as f_in,\
gzip.open(man_file_gz, 'wb') as f_out:
f_out.writelines(f_in)
log.info('Compiling %s >> %s', filename, man_file_gz)
os.remove(newfile) os.remove(newfile)
filename = False
if filename:
#Binary io, so open is OK
with open(newfile, 'rb') as f_in,\
gzip.open(man_file_gz, 'wb') as f_out:
f_out.writelines(f_in)
log.info('Compiling %s >> %s', filename, man_file_gz)
os.remove(newfile)
filename = False
lang = man_dir[8:] lang = man_dir[8:]
src = build_cmd.build_base + '/data/man' + lang + '/gramps.1.gz' src = build_cmd.build_base + '/data/man' + lang + '/' + src
target = 'share/man' + lang + '/man1' target = 'share/man' + lang + '/man1'
data_files.append((target, [src])) data_files.append((target, [src]))