chiark / gitweb /
checkupdates: fix google play check method
[fdroidserver.git] / fdroid
diff --git a/fdroid b/fdroid
index 0774aeb85e49957aa895713612719e318e5a7f67..0b483e0150e98f795e39f84d7096e83c4e9e5159 100755 (executable)
--- a/fdroid
+++ b/fdroid
@@ -1,9 +1,8 @@
-#!/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
-# Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc>
+# Copyright (C) 2013-2014 Daniel Marti <mvdan@mvdan.cc>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -24,25 +23,29 @@ import logging
 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():
@@ -77,9 +80,11 @@ def main():
                     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.]+)["'].*''',
@@ -142,5 +147,6 @@ def main():
         raise
     sys.exit(0)
 
+
 if __name__ == "__main__":
     main()