forked from mirror/openmw-tes3mp
fix rtd
This commit is contained in:
parent
31d7e6af32
commit
3393ad623f
1 changed files with 19 additions and 3 deletions
|
@ -60,13 +60,29 @@ copyright = u'2017, OpenMW Team'
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
|
||||||
|
def get_openmw_version(haystack):
|
||||||
|
needle = 'OPENMW_VERSION_MAJOR'
|
||||||
|
line_counter = 0
|
||||||
|
for hay in haystack:
|
||||||
|
if needle in str(hay):
|
||||||
|
break
|
||||||
|
line_counter += 1
|
||||||
|
|
||||||
|
if line_counter == 0:
|
||||||
|
raise ImportError('Unable to find OpenMW Version')
|
||||||
|
|
||||||
|
version = '.'.join([haystack[line_counter][1][1].contents,
|
||||||
|
haystack[line_counter+1][1][1].contents,
|
||||||
|
haystack[line_counter+2][1][1].contents])
|
||||||
|
return version
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from parse_cmake import parsing
|
from parse_cmake import parsing
|
||||||
cmake_raw = open(project_root+'/CMakeLists.txt', 'r').read()
|
cmake_raw = open(project_root+'/CMakeLists.txt', 'r').read()
|
||||||
cmake_data = parsing.parse(cmake_raw)
|
cmake_data = parsing.parse(cmake_raw)
|
||||||
release = version = '.'.join([cmake_data[24][1][1].contents,
|
release = version = get_openmw_version(cmake_data)
|
||||||
cmake_data[25][1][1].contents,
|
|
||||||
cmake_data[26][1][1].contents])
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
release = "UNRELEASED"
|
release = "UNRELEASED"
|
||||||
print("WARNING: Unable to import parse_cmake, version will be set to: {0}.".format(release))
|
print("WARNING: Unable to import parse_cmake, version will be set to: {0}.".format(release))
|
||||||
|
|
Loading…
Reference in a new issue