'''
import git
+ import xml.dom.minidom
+
if os.path.exists(os.path.join(btrepo, '.git')):
gitrepo = git.Repo(btrepo)
else:
if not os.path.exists(repof):
continue
dest = os.path.join(cpdir, f)
- shutil.copyfile(repof, dest)
+ if f.endswith('.xml'):
+ doc = xml.dom.minidom.parse(repof)
+ output = doc.toprettyxml(encoding='utf-8')
+ with open(dest, 'wb') as f:
+ f.write(output)
+ elif f.endswith('.json'):
+ with open(repof) as fp:
+ output = json.load(fp, object_pairs_hook=collections.OrderedDict)
+ with open(dest, 'w') as fp:
+ json.dump(output, fp, indent=2)
gitrepo.index.add([repof, ])
for f in ('index.jar', 'index-v1.jar'):
repof = os.path.join(repodir, f)
json_name = 'index-v1.json'
index_file = os.path.join(repodir, json_name)
with open(index_file, 'w') as fp:
- json.dump(output, fp, default=_index_encoder_default)
+ if common.options.pretty:
+ json.dump(output, fp, default=_index_encoder_default, indent=2)
+ else:
+ json.dump(output, fp, default=_index_encoder_default)
if common.options.nosign:
logging.debug('index-v1 must have a signature, use `fdroid signindex` to create it!')