Use context manager for open/close
This commit is contained in:
parent
fae067a0d7
commit
df503f9038
|
@ -263,13 +263,15 @@ class Dune(CMakePackage):
|
|||
def cmake(self, spec, prefix):
|
||||
if self.stage.archive_file:
|
||||
os.remove(self.stage.archive_file)
|
||||
optFile = open(join_path(self.stage.source_path, "..", "dune.opts"), "w")
|
||||
|
||||
# Write an opts file for later use
|
||||
with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile:
|
||||
optFile.write('CMAKE_FLAGS="')
|
||||
for flag in self.cmake_args():
|
||||
optFile.write(flag.replace("\"", "'")+" ")
|
||||
optFile.write('-DCMAKE_INSTALL_PREFIX=%s' % prefix)
|
||||
optFile.write('"')
|
||||
optFile.close()
|
||||
|
||||
set_executable('bin/dunecontrol')
|
||||
installer = Executable('bin/dunecontrol')
|
||||
options_file = join_path(self.stage.source_path, "..", "dune.opts")
|
||||
|
|
Loading…
Reference in New Issue