From 021df3c42420de542bf11f22948831023b47ebf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 3 Apr 2015 00:14:32 +0200 Subject: [PATCH] Other minor file reading fixes --- fdroidserver/common.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index fec6038a..4ded1a88 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -945,16 +945,15 @@ def get_library_references(root_dir): proppath = os.path.join(root_dir, 'project.properties') if not os.path.isfile(proppath): return libraries - with open(proppath) as f: - for line in f.readlines(): - if not line.startswith('android.library.reference.'): - continue - path = line.split('=')[1].strip() - relpath = os.path.join(root_dir, path) - if not os.path.isdir(relpath): - continue - logging.debug("Found subproject at %s" % path) - libraries.append(path) + for line in file(proppath): + if not line.startswith('android.library.reference.'): + continue + path = line.split('=')[1].strip() + relpath = os.path.join(root_dir, path) + if not os.path.isdir(relpath): + continue + logging.debug("Found subproject at %s" % path) + libraries.append(path) return libraries @@ -1884,9 +1883,11 @@ def place_srclib(root_dir, number, libpath): proppath = os.path.join(root_dir, 'project.properties') lines = [] - if os.path.isfile(proppath): - with open(proppath, "r") as o: - lines = o.readlines() + if not os.path.isfile(proppath): + return + + with open(proppath, "r") as o: + lines = o.readlines() with open(proppath, "w") as o: placed = False