Skip to content

Commit

Permalink
closing open files #12
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed May 15, 2024
1 parent 0afb14a commit 07ed6b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/sumolib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ def fromVersionHeader():
if not exists(versionFile):
versionFile = join('src', 'version.h')
if exists(versionFile):
version = open(versionFile).read().split()
with open(versionFile) as f:
version = f.read().split()
if len(version) > 2:
return version[2][1:-1]
# try to find the version in the config.h
configFile = join(dirname(__file__), '..', '..', 'src', 'config.h.cmake')
if exists(configFile):
config = open(configFile).read()
with open(configFile) as f:
config = f.read()
if "//#define HAVE_VERSION_H" in config:
version = config.find("VERSION_STRING") + 16
if version > 16:
Expand Down

0 comments on commit 07ed6b7

Please sign in to comment.