1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 18:50:11 +02:00

Other minor file reading fixes

This commit is contained in:
Daniel Martí 2015-04-03 00:14:32 +02:00
parent 241a3f02ac
commit 021df3c424

View File

@ -945,16 +945,15 @@ def get_library_references(root_dir):
proppath = os.path.join(root_dir, 'project.properties') proppath = os.path.join(root_dir, 'project.properties')
if not os.path.isfile(proppath): if not os.path.isfile(proppath):
return libraries return libraries
with open(proppath) as f: for line in file(proppath):
for line in f.readlines(): if not line.startswith('android.library.reference.'):
if not line.startswith('android.library.reference.'): continue
continue path = line.split('=')[1].strip()
path = line.split('=')[1].strip() relpath = os.path.join(root_dir, path)
relpath = os.path.join(root_dir, path) if not os.path.isdir(relpath):
if not os.path.isdir(relpath): continue
continue logging.debug("Found subproject at %s" % path)
logging.debug("Found subproject at %s" % path) libraries.append(path)
libraries.append(path)
return libraries return libraries
@ -1884,9 +1883,11 @@ def place_srclib(root_dir, number, libpath):
proppath = os.path.join(root_dir, 'project.properties') proppath = os.path.join(root_dir, 'project.properties')
lines = [] lines = []
if os.path.isfile(proppath): if not os.path.isfile(proppath):
with open(proppath, "r") as o: return
lines = o.readlines()
with open(proppath, "r") as o:
lines = o.readlines()
with open(proppath, "w") as o: with open(proppath, "w") as o:
placed = False placed = False