Make the extractVersion function in setup a bit more robust
This commit is contained in:
@@ -50,12 +50,19 @@ def extractVersion():
|
|||||||
numVers = "Unknown"
|
numVers = "Unknown"
|
||||||
hexVers = "Unknown"
|
hexVers = "Unknown"
|
||||||
initFile = os.path.join("nw", "__init__.py")
|
initFile = os.path.join("nw", "__init__.py")
|
||||||
with open(initFile, mode="r") as inFile:
|
try:
|
||||||
for aLine in inFile:
|
with open(initFile, mode="r", encoding="utf-8") as inFile:
|
||||||
if aLine.startswith("__version__"):
|
for aLine in inFile:
|
||||||
numVers = getValue((aLine))
|
if aLine.startswith("__version__"):
|
||||||
if aLine.startswith("__hexversion__"):
|
numVers = getValue((aLine))
|
||||||
hexVers = getValue((aLine))
|
if aLine.startswith("__hexversion__"):
|
||||||
|
hexVers = getValue((aLine))
|
||||||
|
except Exception as e:
|
||||||
|
print("Could not read file: %s" % initFile)
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
print("novelWriter version is: %s (%s)" % (numVers, hexVers))
|
||||||
|
print("")
|
||||||
|
|
||||||
return numVers, hexVers
|
return numVers, hexVers
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user