Pour ma part, j'ai proposé la solution suivante à Mickael:
rajouter le numéro de version aux librairies et aux exécutables, ainsi qu'aux modules python
faire des liens pour être compatible avec ce qui est fait actuellement.
C'est ce à quoi je pensais.
Il faut aussi le faire pour le répertoire des includes.
On n'a pas besoin d'installer ces deux versions sous le même préfixe donc pas la peine par exemple d'avoir deux versions de la doc dans share/doc/mfront ou des tests...
Si on modifie l'environnement (LD_LIBRARY_PATH, PYTHONPATH), il faudrait par exemple :
./bin/mfront3.0 (ou tfel-config3.0 pour ceux qu'on appelle)
./lib/libAsterInterface3.0.so
Pour les includes, comme ce n'est utilisé qu'à la construction de code_aster, le plus simple est sans doute :
./include/MFront3.0/MFront/ et ./include/MFront3.0/TFEL/
Pour les packages Python, je pense qu'il faut forcément modifier le PYTHONPATH pour passer d'une version à l'autre...
Last edit: mcourtois 2017-08-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In cmake, the TFEL_APPEND_VERSION option will append the version number to the names of:
The executables.
The libraries.
The python modules. Note that, to comply with python restriction
on module' names, the characters . and - are replace by _ and
that only the first level modules are affected.
The directories in the share folder.
The headers are installed in a subforder named TFEL-${TVEL_VERSION}.
For example, if the TFEL version is 3.0.2-dev, using TFEL_APPEND_VERSION opion will generate:
The mfront-3.0.2-dev executable.
The libTFELMaterial-3.0.2-dev.so library.
The mtest_3_0_2_devpython module.
The tfel_3_0_2_dev.materialpython module. In this case, the
second level (material) is not affected.
This allows multiple executables to be installed in the same directory.
The tfel-config tool
The tfel-config tool has been modified to take this option appropriately. For example:
Users of the python modules could use the following functions:
importos,importlibdefpython_module_version(v):"""Return the python module extension from the TFEL version"""returnv.replace('.','_').replace('-','_')defimport_tfel_module(n,*v):"""Try to import a tfel module, taking into account the TFEL_VERSION environment variable."""ifnotn:ImportError('Empty module name')m=n.split('.')ifnotv:env=os.environ;if('TFEL_VERSION'inenv):v=env.get('TFEL_VERSION')m[0]=m[0]+'_'+python_module_version(v)eliflen(v)==1:m[0]=m[0]+'_'+python_module_version(v[0])else:ImportError('Invalid number of arguments')returnimportlib.import_module('.'.join(m))
Last edit: Helfer Thomas 2017-08-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Note that one can install a version with and without TFEL_APPEND_VERSION. I suggest that without the version without TFEL_APPEND_VERSION is the official one (i.e. the one officially supported by Code_Aster and that the others are meant to test newer versions.
The other valid strategy is to use the TFEL_APPEND_VERSION for the official version, but this leads to more compilcated developments in Code_Aster, including changing the name of the mfront executable in every tests.
Regards,
Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C'est ce à quoi je pensais.
Il faut aussi le faire pour le répertoire des includes.
On n'a pas besoin d'installer ces deux versions sous le même préfixe donc pas la peine par exemple d'avoir deux versions de la doc dans share/doc/mfront ou des tests...
Si on modifie l'environnement (LD_LIBRARY_PATH, PYTHONPATH), il faudrait par exemple :
./bin/mfront3.0 (ou tfel-config3.0 pour ceux qu'on appelle)
./lib/libAsterInterface3.0.so
Pour les includes, comme ce n'est utilisé qu'à la construction de code_aster, le plus simple est sans doute :
./include/MFront3.0/MFront/ et ./include/MFront3.0/TFEL/
Pour les packages Python, je pense qu'il faut forcément modifier le PYTHONPATH pour passer d'une version à l'autre...
Last edit: mcourtois 2017-08-02
In
cmake, theTFEL_APPEND_VERSIONoption will append the version number to the names of:pythonrestrictionon module' names, the characters
.and-are replace by_andthat only the first level modules are affected.
sharefolder.The headers are installed in a subforder named
TFEL-${TVEL_VERSION}.For example, if the
TFELversion is3.0.2-dev, usingTFEL_APPEND_VERSIONopion will generate:mfront-3.0.2-devexecutable.libTFELMaterial-3.0.2-dev.solibrary.mtest_3_0_2_devpythonmodule.tfel_3_0_2_dev.materialpythonmodule. In this case, thesecond level (
material) is not affected.This allows multiple executables to be installed in the same directory.
The
tfel-configtoolThe
tfel-configtool has been modified to take this option appropriately. For example:Modification to
mfrontmfronthas been modified to call the appropriatetfel-configexecutable.For more details, see: https://sourceforge.net/p/tfel/tickets/81/
An helper function for importing
TFELmodulesUsers of the
pythonmodules could use the following functions:Last edit: Helfer Thomas 2017-08-14
Fixed in revision 1780 in
trunk.Fixed in revision 1781 in
rliv-3.0.Note that one can install a version with and without
TFEL_APPEND_VERSION. I suggest that without the version withoutTFEL_APPEND_VERSIONis the official one (i.e. the one officially supported byCode_Asterand that the others are meant to test newer versions.The other valid strategy is to use the
TFEL_APPEND_VERSIONfor the official version, but this leads to more compilcated developments inCode_Aster, including changing the name of themfrontexecutable in every tests.Regards,
Thomas