chiark / gitweb /
Switch all headers to python3
[fdroidserver.git] / fdroidserver / build.py
index 1b3794cde094b5beee581c01115ccdfabf26e952..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
 
@@ -1009,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")