mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
Simplify some file logic with "with"
This commit is contained in:
parent
2894786ec9
commit
6fe8d96e85
4 changed files with 48 additions and 63 deletions
|
@ -1247,9 +1247,8 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||
props = ""
|
||||
if os.path.isfile(path):
|
||||
logging.info("Updating local.properties file at %s" % path)
|
||||
f = open(path, 'r')
|
||||
props += f.read()
|
||||
f.close()
|
||||
with open(path, 'r') as f:
|
||||
props += f.read()
|
||||
props += '\n'
|
||||
else:
|
||||
logging.info("Creating local.properties file at %s" % path)
|
||||
|
@ -1269,9 +1268,8 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||
# Add java.encoding if necessary
|
||||
if build['encoding']:
|
||||
props += "java.encoding=%s\n" % build['encoding']
|
||||
f = open(path, 'w')
|
||||
f.write(props)
|
||||
f.close()
|
||||
with open(path, 'w') as f:
|
||||
f.write(props)
|
||||
|
||||
flavours = []
|
||||
if build['type'] == 'gradle':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue