mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
makepanda: Fix unclosed file handles
This commit is contained in:
parent
24755bc8eb
commit
420d1cee61
@ -1599,8 +1599,8 @@ def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"):
|
|||||||
else:
|
else:
|
||||||
handle = os.popen(LocateBinary(tool) + " --cflags")
|
handle = os.popen(LocateBinary(tool) + " --cflags")
|
||||||
result = handle.read().strip()
|
result = handle.read().strip()
|
||||||
if len(result) == 0: return []
|
|
||||||
handle.close()
|
handle.close()
|
||||||
|
if len(result) == 0: return []
|
||||||
dirs = []
|
dirs = []
|
||||||
for opt in result.split(" "):
|
for opt in result.split(" "):
|
||||||
if (opt.startswith("-I")):
|
if (opt.startswith("-I")):
|
||||||
@ -3637,7 +3637,8 @@ def UpdatePythonVersionInfoFile(new_info):
|
|||||||
json_data = []
|
json_data = []
|
||||||
if os.path.isfile(json_file) and not PkgSkip("PYTHON"):
|
if os.path.isfile(json_file) and not PkgSkip("PYTHON"):
|
||||||
try:
|
try:
|
||||||
json_data = json.load(open(json_file, 'r'))
|
with open(json_file, 'r') as fh:
|
||||||
|
json_data = json.load(fh)
|
||||||
except:
|
except:
|
||||||
json_data = []
|
json_data = []
|
||||||
|
|
||||||
@ -3655,7 +3656,9 @@ def UpdatePythonVersionInfoFile(new_info):
|
|||||||
|
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
print("Writing %s" % (json_file))
|
print("Writing %s" % (json_file))
|
||||||
json.dump(json_data, open(json_file, 'w'), indent=4)
|
|
||||||
|
with open(json_file, 'w') as fh:
|
||||||
|
json.dump(json_data, fh, indent=4)
|
||||||
|
|
||||||
|
|
||||||
def ReadPythonVersionInfoFile():
|
def ReadPythonVersionInfoFile():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user