mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 20:40:11 +01:00
Fixes issue 1571:
Adding missing close for open. If the "close()" call is missing after a "open(filename)" call, the filename isn't guaranteed to be closed before the interpreter exits. This is generally a bad practice as explained here: https://stackoverflow.com/questions/7395542/is-explicitly-closing-files-important Also replaced "fid=open(filename) fid.close()" statements for files with the safer "with open(filename) as fid:" blocks. See https://www.python.org/dev/peps/pep-0343/
This commit is contained in:
@@ -91,8 +91,8 @@ def getWxRelease(wxRoot=None):
|
||||
if not wxRoot:
|
||||
global wxRootDir
|
||||
wxRoot = wxRootDir
|
||||
|
||||
configureText = open(os.path.join(wxRoot, "configure.in"), "r").read()
|
||||
with open(os.path.join(wxRoot, "configure.in"), "r") as fid:
|
||||
configureText = fid.read()
|
||||
majorVersion = re.search("wx_major_version_number=(\d+)", configureText).group(1)
|
||||
minorVersion = re.search("wx_minor_version_number=(\d+)", configureText).group(1)
|
||||
|
||||
@@ -592,9 +592,8 @@ def main(wxDir, args):
|
||||
for include in glob.glob(header_dir + "/*.h"):
|
||||
headers += "#include <wx/" + os.path.basename(include) + ">\n"
|
||||
|
||||
framework_header = open("%s.h" % fwname, "w")
|
||||
framework_header.write(header_template % headers)
|
||||
framework_header.close()
|
||||
with open("%s.h" % fwname, "w") as framework_header:
|
||||
framework_header.write(header_template % headers)
|
||||
|
||||
run("ln -s -f %s wx" % header_dir)
|
||||
os.chdir("wx-%s/wx" % version)
|
||||
|
||||
Reference in New Issue
Block a user