mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Replace remaining file() usage
This commit is contained in:
parent
5026d4e08b
commit
fc21dbc667
2 changed files with 42 additions and 38 deletions
|
@ -1013,7 +1013,8 @@ 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
|
||||||
for line in file(proppath):
|
with open(proppath, 'r') as f:
|
||||||
|
for line in f:
|
||||||
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()
|
||||||
|
@ -1087,7 +1088,8 @@ def parse_androidmanifests(paths, app):
|
||||||
package = None
|
package = None
|
||||||
|
|
||||||
if gradle:
|
if gradle:
|
||||||
for line in file(path):
|
with open(path, 'r') as f:
|
||||||
|
for line in f:
|
||||||
if gradle_comment.match(line):
|
if gradle_comment.match(line):
|
||||||
continue
|
continue
|
||||||
# Grab first occurence of each to avoid running into
|
# Grab first occurence of each to avoid running into
|
||||||
|
@ -1531,7 +1533,8 @@ class KnownApks:
|
||||||
self.path = os.path.join('stats', 'known_apks.txt')
|
self.path = os.path.join('stats', 'known_apks.txt')
|
||||||
self.apks = {}
|
self.apks = {}
|
||||||
if os.path.isfile(self.path):
|
if os.path.isfile(self.path):
|
||||||
for line in file(self.path):
|
with open(self.path, 'r') as f:
|
||||||
|
for line in f:
|
||||||
t = line.rstrip().split(' ')
|
t = line.rstrip().split(' ')
|
||||||
if len(t) == 2:
|
if len(t) == 2:
|
||||||
self.apks[t[0]] = (t[1], None)
|
self.apks[t[0]] = (t[1], None)
|
||||||
|
|
|
@ -199,7 +199,8 @@ def scan_source(build_dir, root_dir, build):
|
||||||
elif ext == 'java':
|
elif ext == 'java':
|
||||||
if not os.path.isfile(fp):
|
if not os.path.isfile(fp):
|
||||||
continue
|
continue
|
||||||
for line in file(fp):
|
with open(fp, 'r') as f:
|
||||||
|
for line in f:
|
||||||
if 'DexClassLoader' in line:
|
if 'DexClassLoader' in line:
|
||||||
count += handleproblem('DexClassLoader', fd, fp)
|
count += handleproblem('DexClassLoader', fd, fp)
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue