chiark / gitweb /
Import support for kivy projects (with buildozer spec)
authorCiaran Gultnieks <ciaran@ciarang.com>
Sun, 24 Nov 2013 22:11:29 +0000 (22:11 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Sun, 24 Nov 2013 22:11:29 +0000 (22:11 +0000)
fdroidserver/import.py

index 3bb03681c29af0a46ad832f2b9bb1828a91c669e..997610f6fad7106fed73beb59a5652f8982191e0 100644 (file)
@@ -22,6 +22,7 @@ import os
 import shutil
 import urllib
 from optparse import OptionParser
+from ConfigParser import ConfigParser
 import common, metadata
 
 # Get the repo type and address from the given web page. The page is scanned
@@ -229,18 +230,29 @@ def main():
 
     # Extract some information...
     paths = common.manifest_paths(root_dir, None)
-    if not paths:
-        print "No android project could be found. Specify --subdir?"
-        sys.exit(1)
+    if paths:
 
-    version, vercode, package = common.parse_androidmanifests(paths)
-    if not package:
-        print "Couldn't find package ID"
-        sys.exit(1)
-    if not version:
-        print "WARNING: Couldn't find latest version name"
-    if not vercode:
-        print "WARNING: Couldn't find latest version code"
+        version, vercode, package = common.parse_androidmanifests(paths)
+        if not package:
+            print "Couldn't find package ID"
+            sys.exit(1)
+        if not version:
+            print "WARNING: Couldn't find latest version name"
+        if not vercode:
+            print "WARNING: Couldn't find latest version code"
+    else:
+        spec = os.path.join(root_dir, 'buildozer.spec')
+        if os.path.exists(spec):
+            defaults = {'orientation': 'landscape', 'icon': '', 
+                    'permissions': '', 'android.api': "18"}
+            bconfig = ConfigParser(defaults, allow_no_value=True)
+            bconfig.read(spec)
+            package = bconfig.get('app', 'package.domain') + '.' + bconfig.get('app', 'package.name')
+            version = bconfig.get('app', 'version')
+            vercode = None
+        else:
+            print "No android or kivy project could be found. Specify --subdir?"
+            sys.exit(1)
 
     # Make sure it's actually new...
     for app in apps: