From e64e25f414b14218c94e06ff2f4550153518ff08 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Mon, 9 Nov 2015 15:29:02 +0100 Subject: [PATCH] Deal with the version of the generated modules. --- module_generator/doc_tmpl.py | 5 +++++ module_generator/gener.py | 18 ++++++++++++++---- module_generator/gui_tmpl.py | 12 ++++++++++++ module_generator/mod_tmpl.py | 9 ++++++--- module_generator/yacsgen_version.py | 23 +++++++++++++++++++++++ setup.py | 3 ++- 6 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 module_generator/yacsgen_version.py diff --git a/module_generator/doc_tmpl.py b/module_generator/doc_tmpl.py index e758ed9..b40047b 100644 --- a/module_generator/doc_tmpl.py +++ b/module_generator/doc_tmpl.py @@ -283,10 +283,15 @@ man_pages = [ docconf=Template(docconf) +# SalomeApp.xml file for a documentation only module. +# template parameters: +# module : module name +# version : version number of the module docsalomeapp="""
+
diff --git a/module_generator/gener.py b/module_generator/gener.py index 3fdd0d7..1473b8d 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -47,6 +47,7 @@ from yacstypes import ValidTypes, PyValidTypes, calciumTypes, DatastreamParallel from yacstypes import ValidImpl, ValidImplTypes, ValidStreamTypes, ValidParallelStreamTypes, ValidDependencies from gui_tmpl import cmake_py_gui, pysalomeapp, cmake_cpp_gui, cppsalomeapp from doc_tmpl import docmakefile, docconf, docsalomeapp +import yacsgen_version def makedirs(namedir): """Create a new directory named namedir. If a directory already exists copy it to namedir.bak""" @@ -445,7 +446,10 @@ class Generator(object): compolibs=component_libs, with_doc=cmake_doc, with_gui=cmake_gui, - add_modules=add_modules), + add_modules=add_modules, + major_version=yacsgen_version.major_version, + minor_version=yacsgen_version.minor_version, + patch_version=yacsgen_version.patch_version), "README":"", "NEWS":"", "AUTHORS":"", "ChangeLog":"", "src":srcs, "resources":{"CMakeLists.txt":cmake_ressources.substitute( @@ -517,7 +521,9 @@ class Generator(object): #without gui but with doc: create a small SalomeApp.xml in doc directory if not os.path.exists(os.path.join(namedir, "doc", "SalomeApp.xml")): #create a minimal SalomeApp.xml - salomeapp=docsalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower()) + salomeapp=docsalomeapp.substitute(module=self.module.name, + lmodule=self.module.name.lower(), + version=yacsgen_version.complete_version) d["SalomeApp.xml"]=salomeapp if not os.path.exists(os.path.join(namedir, "doc", "CMakeLists.txt")): @@ -584,7 +590,9 @@ class Generator(object): if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "SalomeApp.xml")): #create a minimal SalomeApp.xml - salomeapp=pysalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower()) + salomeapp=pysalomeapp.substitute(module=self.module.name, + lmodule=self.module.name.lower(), + version=yacsgen_version.complete_version) d["SalomeApp.xml"]=salomeapp return d @@ -629,7 +637,9 @@ class Generator(object): if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "SalomeApp.xml")): #create a minimal SalomeApp.xml - salomeapp=cppsalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower()) + salomeapp=cppsalomeapp.substitute(module=self.module.name, + lmodule=self.module.name.lower(), + version=yacsgen_version.complete_version) d["SalomeApp.xml"]=salomeapp return d diff --git a/module_generator/gui_tmpl.py b/module_generator/gui_tmpl.py index 8fd5cb9..16035f7 100644 --- a/module_generator/gui_tmpl.py +++ b/module_generator/gui_tmpl.py @@ -22,6 +22,11 @@ try: except: from compat import Template,set +# SalomeApp.xml file for a python gui. +# template parameters: +# module : module name +# lmodule : module name in lower case +# version : version number of the module pysalomeapp="""
@@ -29,6 +34,7 @@ pysalomeapp=""" +
@@ -41,12 +47,18 @@ pysalomeapp=""" """ pysalomeapp=Template(pysalomeapp) +# SalomeApp.xml file for a cpp gui. +# template parameters: +# module : module name +# lmodule : module name in lower case +# version : version number of the module cppsalomeapp="""
+
diff --git a/module_generator/mod_tmpl.py b/module_generator/mod_tmpl.py index 4c3c587..e9fc301 100644 --- a/module_generator/mod_tmpl.py +++ b/module_generator/mod_tmpl.py @@ -47,6 +47,9 @@ fi # with_doc : ON|OFF # with_gui : ON|OFF - module has its own GUI # add_modules : code to find other modules +# major_version : major version of the module +# minor_version : minor version of the module +# patch_version : patch version of the module cmake_root_cpp = """ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) @@ -61,9 +64,9 @@ CMAKE_POLICY(SET CMP0003 NEW) # Project name, upper case STRING(TOUPPER $${PROJECT_NAME} PROJECT_NAME_UC) -SET($${PROJECT_NAME_UC}_MAJOR_VERSION 7) -SET($${PROJECT_NAME_UC}_MINOR_VERSION 4) -SET($${PROJECT_NAME_UC}_PATCH_VERSION 0) +SET($${PROJECT_NAME_UC}_MAJOR_VERSION ${major_version}) +SET($${PROJECT_NAME_UC}_MINOR_VERSION ${minor_version}) +SET($${PROJECT_NAME_UC}_PATCH_VERSION ${patch_version}) SET($${PROJECT_NAME_UC}_VERSION $${$${PROJECT_NAME_UC}_MAJOR_VERSION}.$${$${PROJECT_NAME_UC}_MINOR_VERSION}.$${$${PROJECT_NAME_UC}_PATCH_VERSION}) SET($${PROJECT_NAME_UC}_VERSION_DEV 1) diff --git a/module_generator/yacsgen_version.py b/module_generator/yacsgen_version.py new file mode 100644 index 0000000..06c1560 --- /dev/null +++ b/module_generator/yacsgen_version.py @@ -0,0 +1,23 @@ +# Copyright (C) 2009-2015 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +major_version=7 +minor_version=7 +patch_version=0 +complete_version="%d.%d.%d" % (major_version, minor_version, patch_version) \ No newline at end of file diff --git a/setup.py b/setup.py index 0acdf71..e26bdbb 100644 --- a/setup.py +++ b/setup.py @@ -18,8 +18,9 @@ # from distutils.core import setup +from module_generator import yacsgen_version setup(name='YACSGEN', - version='7.7.0', + version=yacsgen_version.complete_version, author='C. Caremoli', packages=['module_generator'], scripts=['script/hxx2salome.py',] -- 2.39.2