From 6c103a07349e10db010a892cc03a5f47f2195680 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 25 May 2006 08:52:00 +0000 Subject: [PATCH] SALOME versioning system improvement: 1) Add KERNEL_version.h file 2) Remove version numbers duplication 3) Provide Python script to get version number --- DEPRECATED/configure.in.base | 4 +- INSTALL | 17 +--- KERNEL_version.h.in | 34 ++++++++ Makefile.am | 4 + bin/VERSION | 1 - bin/VERSION.in | 1 + configure.ac | 10 ++- .../sources/static/{tree.js => tree.js.in} | 2 +- doc/salome/tui/Makefile.am | 3 +- ...gResources.xml => CatalogResources.xml.in} | 40 ++++----- ...KERNELCatalog.xml => KERNELCatalog.xml.in} | 6 +- src/KERNEL_PY/Makefile.am | 3 +- src/KERNEL_PY/salome_version.py | 84 +++++++++++++++++++ 13 files changed, 162 insertions(+), 47 deletions(-) create mode 100644 KERNEL_version.h.in delete mode 100755 bin/VERSION create mode 100755 bin/VERSION.in rename doc/salome/tui/KERNEL/sources/static/{tree.js => tree.js.in} (99%) rename resources/{CatalogResources.xml => CatalogResources.xml.in} (54%) rename resources/{KERNELCatalog.xml => KERNELCatalog.xml.in} (90%) create mode 100644 src/KERNEL_PY/salome_version.py diff --git a/DEPRECATED/configure.in.base b/DEPRECATED/configure.in.base index d2debb47f..1567a6394 100644 --- a/DEPRECATED/configure.in.base +++ b/DEPRECATED/configure.in.base @@ -22,8 +22,10 @@ AC_CANONICAL_HOST PACKAGE=salome AC_SUBST(PACKAGE) -VERSION=0.0.1 +VERSION=3.2.0 AC_SUBST(VERSION) +XVERSION=0x030200 +AC_SUBST(XVERSION) dnl dnl Initialize source and build root directories diff --git a/INSTALL b/INSTALL index 1ee08b7b4..e39fb5942 100644 --- a/INSTALL +++ b/INSTALL @@ -1,16 +1 @@ -This is the version 3.2.0 of KERNEL -Previous versions : - - 3.1.0 - - 3.0.0 - - 2.2.4 - - 2.2.3 - - 2.2.2 - - 2.2.1 - - 2.2.0 - - 2.1.1 - - 2.1.0 - - 2.0.0 - - 1.4.1 - - 1.3.0 - - 1.2.1 - +See ./doc/INSTALL.txt for installation instructions. \ No newline at end of file diff --git a/KERNEL_version.h.in b/KERNEL_version.h.in new file mode 100644 index 000000000..8ca12918d --- /dev/null +++ b/KERNEL_version.h.in @@ -0,0 +1,34 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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/ +// +// File : KERNEL_version.h +// Author : Vadim SANDLER +// Module : SALOME + +#if !defined(__KERNEL_VERSION_H__) +#define __KERNEL_VERSION_H__ + +/* + KERNEL_VERSION is (major << 16) + (minor << 8) + patch. +*/ + +#define KERNEL_VERSION_STR "@VERSION@" +#define KERNEL_VERSION @XVERSION@ + +#endif // __KERNEL_VERSION_H__ diff --git a/Makefile.am b/Makefile.am index db9dfa137..3fe754717 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,6 +5,8 @@ # $Header$ # +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + if CORBA_GEN IDLDIR = idl endif @@ -15,6 +17,8 @@ DIST_SUBDIRS= idl salome_adm src doc bin resources DISTCLEANFILES = a.out +salomeinclude_DATA = KERNEL_version.h + EXTRA_DIST = \ build_configure \ clean_configure \ diff --git a/bin/VERSION b/bin/VERSION deleted file mode 100755 index d0fe4400c..000000000 --- a/bin/VERSION +++ /dev/null @@ -1 +0,0 @@ -THIS IS SALOME - KERNEL VERSION: 3.2.0 diff --git a/bin/VERSION.in b/bin/VERSION.in new file mode 100755 index 000000000..bd8de56f2 --- /dev/null +++ b/bin/VERSION.in @@ -0,0 +1 @@ +THIS IS SALOME - KERNEL VERSION: @VERSION@ diff --git a/configure.ac b/configure.ac index 0ba3f492b..139252b95 100644 --- a/configure.ac +++ b/configure.ac @@ -19,8 +19,9 @@ PACKAGE=salome AC_SUBST(PACKAGE) VERSION=3.2.0 +XVERSION=0x030200 AC_SUBST(VERSION) - +AC_SUBST(XVERSION) echo echo --------------------------------------------- @@ -484,21 +485,26 @@ AC_OUTPUT_COMMANDS([ \ # autoscan, the Makefile list is generated in the output file configure.scan. # This could be helpfull to update de configuration. AC_OUTPUT([ \ + ./KERNEL_version.h \ ./salome_adm/unix/SALOMEconfig.ref \ ./salome_adm/Makefile \ ./salome_adm/unix/Makefile \ ./salome_adm/unix/config_files/Makefile \ ./Makefile \ ./bin/Makefile \ + ./bin/VERSION \ ./bin/runIDLparser \ ./doc/Makefile \ ./doc/salome/Makefile \ ./doc/salome/DevelopersGuide/DevelopersGuide.tex \ ./doc/salome/DevelopersGuide/Makefile \ ./doc/salome/tui/Makefile \ - ./doc/salome/tui/KERNEL/doxyuser \ + ./doc/salome/tui/INPUT/doxyuser:./doc/salome/tui/KERNEL/doxyuser.in \ + ./doc/salome/tui/INPUT/sources/static/tree.js:./doc/salome/tui/KERNEL/sources/static/tree.js.in \ ./idl/Makefile \ ./resources/Makefile \ + ./resources/KERNELCatalog.xml \ + ./resources/CatalogResources.xml \ ./resources/DEPRECATED/Plugin \ ./src/Makefile \ ./src/Basics/Makefile \ diff --git a/doc/salome/tui/KERNEL/sources/static/tree.js b/doc/salome/tui/KERNEL/sources/static/tree.js.in similarity index 99% rename from doc/salome/tui/KERNEL/sources/static/tree.js rename to doc/salome/tui/KERNEL/sources/static/tree.js.in index d7579b20f..b7422d7b8 100755 --- a/doc/salome/tui/KERNEL/sources/static/tree.js +++ b/doc/salome/tui/KERNEL/sources/static/tree.js.in @@ -1,4 +1,4 @@ -foldersTree = gFld("SALOME v.3.2.0b1 ", "", "") +foldersTree = gFld("SALOME v.@VERSION@ ", "", "") insDoc(foldersTree, gLnk("Main Page", "", "main.html")) aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index f8a3770c9..35ec0370c 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -13,8 +13,7 @@ dist-hook: rm -rf `find $(distdir) -name CVS` userdoc: - cp -fr $(srcdir)/KERNEL ./INPUT; \ - cp -f $(top_builddir)/doc/salome/tui/KERNEL/doxyuser ./INPUT; \ + cp -fr $(srcdir)/KERNEL/* ./INPUT; \ cd ./INPUT; \ pwd; ls;\ echo "DOXYGEN SUPPORT PYTHON - $(DOXYGEN_WITH_PYTHON)"; \ diff --git a/resources/CatalogResources.xml b/resources/CatalogResources.xml.in similarity index 54% rename from resources/CatalogResources.xml rename to resources/CatalogResources.xml.in index 06a7f5905..c83cafac5 100644 --- a/resources/CatalogResources.xml +++ b/resources/CatalogResources.xml.in @@ -3,44 +3,44 @@ - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + diff --git a/resources/KERNELCatalog.xml b/resources/KERNELCatalog.xml.in similarity index 90% rename from resources/KERNELCatalog.xml rename to resources/KERNELCatalog.xml.in index 472e1e572..02afa4055 100644 --- a/resources/KERNELCatalog.xml +++ b/resources/KERNELCatalog.xml.in @@ -16,7 +16,7 @@ Salome Other NRI - 3.2.0 + @VERSION@ GUI Neutral Context 1 @@ -27,7 +27,7 @@ SalomeTestComponent Other NRI - 3.2.0 + @VERSION@ GUI Neutral Context 1 'linux' ~ OS @@ -37,7 +37,7 @@ SALOME_TestComponentPy Other NRI - 3.2.0 + @VERSION@ GUI Neutral Context 1 'linux' ~ OS diff --git a/src/KERNEL_PY/Makefile.am b/src/KERNEL_PY/Makefile.am index e4ee6443f..f4d8aef60 100755 --- a/src/KERNEL_PY/Makefile.am +++ b/src/KERNEL_PY/Makefile.am @@ -39,7 +39,8 @@ pkgpython_PYTHON = \ salome_iapp.py \ salome_ComponentGUI.py \ omnipatch.py \ - iparameters.py + iparameters.py \ + salome_version.py sharedpkgpython_PYTHON = kernel_shared_modules.py diff --git a/src/KERNEL_PY/salome_version.py b/src/KERNEL_PY/salome_version.py new file mode 100644 index 000000000..97e90765e --- /dev/null +++ b/src/KERNEL_PY/salome_version.py @@ -0,0 +1,84 @@ +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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. +# +# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# File : salome_version.py +# Author : Vadim SANDLER +# Module : SALOME + +_salome_versions = {} + +def getVersion( mod = "KERNEL" ): + """ + Get SALOME module version number + Returns: version number string or None if VERSION file is not found + """ + global _salome_versions + mod = mod.upper() + if not _salome_versions.has_key( mod ): + _salome_versions[ mod ] = None + import os + root_dir = os.getenv( "%s_ROOT_DIR" % mod ) + if root_dir: + try: + filename = root_dir + "/bin/salome/VERSION" + if not os.path.exists( filename ): + filename = root_dir + "/bin/VERSION" + file = open( filename ) + ver = file.readline() + file.close() + _salome_versions[ mod ] = ver.split( ":" )[ -1 ].strip() + except: + pass + return _salome_versions[ mod ] + +def getVersionMajor( mod = "KERNEL" ): + """ + Get SALOME module major version number + Returns: version major number string or None if VERSION file is not found + """ + ver = getVersion( mod ) + try: + return ver.split( "." )[ 0 ] + except: + pass + return None + +def getVersionMinor( mod = "KERNEL" ): + """ + Get SALOME module minor version number + Returns: version minor number string or None if VERSION file is not found + """ + ver = getVersion( mod ) + try: + return ver.split( "." )[ 1 ] + except: + pass + return None + +def getVersionRelease( mod = "KERNEL" ): + """ + Get SALOME module release version number + Returns: version release number string or None if VERSION file is not found + """ + ver = getVersion( mod ) + try: + return ver.split( "." )[ 2 ] + except: + pass + return None -- 2.39.2