mirror of https://github.com/KLayout/klayout.git
Provide version #defines for setup.py too
This commit is contained in:
parent
fc4976be81
commit
caa601fe68
36
setup.py
36
setup.py
|
|
@ -330,7 +330,41 @@ class Config(object):
|
||||||
"""
|
"""
|
||||||
Returns the macros to use for building
|
Returns the macros to use for building
|
||||||
"""
|
"""
|
||||||
return [('HAVE_CURL', 1), ('HAVE_EXPAT', 1)]
|
return [('HAVE_CURL', 1), ('HAVE_EXPAT', 1), ('KLAYOUT_MAJOR_VERSION', self.major_version()), ('KLAYOUT_MINOR_VERSION', self.minor_version())]
|
||||||
|
|
||||||
|
def minor_version(self):
|
||||||
|
"""
|
||||||
|
Gets the version string
|
||||||
|
"""
|
||||||
|
|
||||||
|
# this will obtain the version string from the "version.sh" file which
|
||||||
|
# is the central point of configuration
|
||||||
|
version_file = os.path.join(os.path.dirname(__file__), "version.sh")
|
||||||
|
with open(version_file, "r") as file:
|
||||||
|
version_txt = file.read()
|
||||||
|
rm = re.search(r"KLAYOUT_VERSION\s*=\s*\"(.*?)\.(.*?)(\..*)?\".*", version_txt)
|
||||||
|
if rm:
|
||||||
|
version_string = rm.group(2)
|
||||||
|
return version_string
|
||||||
|
|
||||||
|
raise RuntimeError("Unable to obtain version string from version.sh")
|
||||||
|
|
||||||
|
def major_version(self):
|
||||||
|
"""
|
||||||
|
Gets the version string
|
||||||
|
"""
|
||||||
|
|
||||||
|
# this will obtain the version string from the "version.sh" file which
|
||||||
|
# is the central point of configuration
|
||||||
|
version_file = os.path.join(os.path.dirname(__file__), "version.sh")
|
||||||
|
with open(version_file, "r") as file:
|
||||||
|
version_txt = file.read()
|
||||||
|
rm = re.search(r"KLAYOUT_VERSION\s*=\s*\"(.*?)\.(.*?)(\..*)?\".*", version_txt)
|
||||||
|
if rm:
|
||||||
|
version_string = rm.group(1)
|
||||||
|
return version_string
|
||||||
|
|
||||||
|
raise RuntimeError("Unable to obtain version string from version.sh")
|
||||||
|
|
||||||
def version(self):
|
def version(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue