chiark / gitweb /
Switch all headers to python3
[fdroidserver.git] / fdroidserver / build.py
index 2d9e61bfb3fb5e201dd22dfbffacc8a100cd4b8b..cf12c34ed32856ec90c0cedbc64720f8ebcfb09a 100644 (file)
@@ -1,5 +1,4 @@
-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python3
 #
 # build.py - part of the FDroid server tools
 # Copyright (C) 2010-2014, Ciaran Gultnieks, ciaran@ciarang.com
@@ -523,7 +522,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
 
         cmd = [config['gradle']]
         if build.gradleprops:
-            cmd += ['-P'+kv for kv in build.gradleprops]
+            cmd += ['-P' + kv for kv in build.gradleprops]
 
         cmd += ['clean']
 
@@ -557,7 +556,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
             # .gradle/ as binary files. To avoid overcomplicating the scanner,
             # manually delete them, just like `gradle clean` should have removed
             # the build/ dirs.
-            del_dirs(['build', '.gradle', 'gradle'])
+            del_dirs(['build', '.gradle'])
             del_files(['gradlew', 'gradlew.bat'])
 
         if 'pom.xml' in files:
@@ -731,7 +730,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
 
         cmd = [config['gradle']]
         if build.gradleprops:
-            cmd += ['-P'+kv for kv in build.gradleprops]
+            cmd += ['-P' + kv for kv in build.gradleprops]
 
         cmd += gradletasks
 
@@ -807,9 +806,6 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
         src = os.path.join(bindir, src)
     elif omethod == 'raw':
         globpath = os.path.join(root_dir, build.output)
-        print(globpath)
-        globpath = os.path.normpath(globpath)
-        print(globpath)
         apks = glob.glob(globpath)
         if len(apks) > 1:
             raise BuildException('Multiple apks match %s' % globpath, '\n'.join(apks))
@@ -1012,13 +1008,14 @@ def main():
     options, parser = parse_commandline()
 
     metadata_files = glob.glob('.fdroid.*[a-z]')  # ignore files ending in ~
-    if len(metadata_files) > 1:
+    if os.path.isdir('metadata'):
+        pass
+    elif len(metadata_files) == 0:
+        raise FDroidException("No app metadata found, nothing to process!")
+    elif len(metadata_files) > 1:
         raise FDroidException("Only one local metadata file allowed! Found: "
                               + " ".join(metadata_files))
 
-    if not os.path.isdir('metadata') and len(metadata_files) == 0:
-        raise FDroidException("No app metadata found, nothing to process!")
-
     if not options.appid and not options.all:
         parser.error("option %s: If you really want to build all the apps, use --all" % "all")