-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python3
#
# fdroid.py - part of the FDroid server tools
# Copyright (C) 2010-2015, Ciaran Gultnieks, ciaran@ciarang.com
import fdroidserver.common
import fdroidserver.metadata
from argparse import ArgumentError
-
-commands = {
- "build": "Build a package from source",
- "init": "Quickly start a new repository",
- "publish": "Sign and place packages in the repo",
- "gpgsign": "Add gpg signatures for packages in repo",
- "update": "Update repo information for new packages",
- "verify": "Verify the integrity of downloaded packages",
- "checkupdates": "Check for updates to applications",
- "import": "Add a new application from its source code",
- "install": "Install built packages on devices",
- "readmeta": "Read all the metadata files and exit",
- "rewritemeta": "Rewrite all the metadata files",
- "lint": "Warn about possible metadata errors",
- "scanner": "Scan the source code of a package",
- "stats": "Update the stats of the repo",
- "server": "Interact with the repo HTTP server",
- "signindex": "Sign indexes created using update --nosign",
-}
+from collections import OrderedDict
+
+commands = OrderedDict([
+ ("build", "Build a package from source"),
+ ("init", "Quickly start a new repository"),
+ ("publish", "Sign and place packages in the repo"),
+ ("gpgsign", "Add gpg signatures for packages in repo"),
+ ("update", "Update repo information for new packages"),
+ ("verify", "Verify the integrity of downloaded packages"),
+ ("checkupdates", "Check for updates to applications"),
+ ("import", "Add a new application from its source code"),
+ ("install", "Install built packages on devices"),
+ ("readmeta", "Read all the metadata files and exit"),
+ ("rewritemeta", "Rewrite all the metadata files"),
+ ("lint", "Warn about possible metadata errors"),
+ ("scanner", "Scan the source code of a package"),
+ ("dscanner", "Dynamically scan APKs post build"),
+ ("stats", "Update the stats of the repo"),
+ ("server", "Interact with the repo HTTP server"),
+ ("signindex", "Sign indexes created using update --nosign"),
+ ("btlog", "Update the binary transparency log for a URL"),
+ ("signatures", "Extract signatures from APKs"),
+])
def print_help():
import subprocess
try:
output = subprocess.check_output(['git', 'describe'],
- stderr=subprocess.STDOUT)
+ stderr=subprocess.STDOUT,
+ universal_newlines=True)
except subprocess.CalledProcessError:
- output = 'git commit ' + subprocess.check_output(['git', 'rev-parse', 'HEAD'])
+ output = 'git commit ' + subprocess.check_output(['git', 'rev-parse', 'HEAD'],
+ universal_newlines=True)
elif os.path.exists('setup.py'):
import re
m = re.search(r'''.*[\s,\(]+version\s*=\s*["']([0-9a-z.]+)["'].*''',
raise
sys.exit(0)
+
if __name__ == "__main__":
main()