diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d3d6f5c2b..d47e8b967d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,9 @@ include(GNUInstallDirs) set(URANIUM_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/../uranium/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository") +set(CURA_VERSION "master" CACHE STRING "Version name of Cura") +configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY) + if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") # Extract Strings add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura) @@ -60,9 +63,11 @@ install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) install(DIRECTORY plugins DESTINATION lib/cura) install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) if(NOT APPLE AND NOT WIN32) - install(DIRECTORY cura DESTINATION lib/python${PYTHON_VERSION_MAJOR}/dist-packages) + install(DIRECTORY cura DESTINATION lib/python${PYTHON_VERSION_MAJOR}/dist-packages FILES_MATCHING PATTERN *.py) + install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py DESTINATION lib/python${PYTHON_VERSION_MAJOR}/dist-packages/cura) install(FILES cura.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) else() - install(DIRECTORY cura DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) + install(DIRECTORY cura DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages FILES_MATCHING PATTERN *.py) + install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py DESTINATION lib/python${PYTHON_VERSION_MAJOR}/site-packages/cura) endif() diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 689ae888a6..64551948dc 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -51,6 +51,11 @@ import numpy import copy numpy.seterr(all="ignore") +try: + from cura.CuraVersion import CuraVersion +except ImportError: + CuraVersion = "master" + class CuraApplication(QtApplication): class ResourceTypes: QmlFiles = Resources.UserType + 1 @@ -62,7 +67,7 @@ class CuraApplication(QtApplication): if not hasattr(sys, "frozen"): Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) - super().__init__(name = "cura", version = "15.09.91") + super().__init__(name = "cura", version = CuraVersion) self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) diff --git a/cura/CuraVersion.py.in b/cura/CuraVersion.py.in new file mode 100644 index 0000000000..bb69319ee6 --- /dev/null +++ b/cura/CuraVersion.py.in @@ -0,0 +1,4 @@ +# Copyright (c) 2015 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +CuraVersion = "@CURA_VERSION@"