Issues

Issue #6 resolved

Allow the installation of several versions into the same $PREFIX

Mathieu Courtois
created an issue

The current installation tree is:

.
├── bin
│   ├── aster
├── include
│   └── aster
│       ├── asterc_config.h
│       ├── ...
├── lib
│   └── python2.7
│       └── site-packages
│           ├── Cata
│           │   ├── cata.py
│           │   ├── __init__.py
│           │   ├── ops.py
│           ├── Comportement
│           │   ├── acier.py
│           │   ├── ...
│           └── Validation
│               └── V_UN_PARMI.py
└── share
    ├── aster
    │   ├── config.txt
    │   └── profile.sh
    └── locale
        └── ...

I propose a small enhancement of the build/install system to allow the installation of several versions in the directory. I think it could make easier the work of packagers to have at least two versions installed.

It would be :

.
├── bin
│   ├── aster11.5
│   └── aster12.1
├── include
│   ├── aster11.5
│   │   ├── asterc_config.h
│   │   └── ...
│   └── aster12.1
│       ├── asterc_config.h
│       └── ...
├── lib
│   └── python2.7
│       └── site-packages
│           ├── aster11.5
│           │   ├── Cata
│           │   │   ├── cata.py
│           │   │   ├── __init__.py
│           │   │   ├── ops.py
│           │   ├── Comportement
│           │   │   ├── acier.py
│           │   │   ├── ...
│           │   └── Validation
│           │       └── V_UN_PARMI.py
│           ├── aster12.1
│           │   ├── Cata
│           │   │   ├── cata.py
│           │   │   ├── __init__.py
│           │   │   ├── ops.py
│           │   ├── Comportement
│           │   │   ├── acier.py
│           │   │   ├── ...
│           │   └── Validation
│           │       └── V_UN_PARMI.py
└── share
    ├── aster11.5
    │   ├── config.txt
    │   └── profile.sh
    ├── locale
    │   └── ...
    ├── aster12.1
    │   ├── config.txt
    │   └── profile.sh
    └── locale
        └── ...

Installations would be as simple as:

sudo apt-get install codeaster-11.5
sudo apt-get install codeaster-12.1

All advices are welcome...

Comments (9)

  1. Denis Laxalde

    Even with a single version scheme, I think introducing a namespace for python modules (Cata, Comportement, etc.) is a good idea. By the way, aren't these modules intended to be private?

  2. Mathieu Courtois reporter

    Public vs private

    • for a (code_aster) user, all modules could be private, except Cata.

    • an external software that would only use the "commands level API", that's the same (should only use Cata).

    • another software could use its own macro-commands and call more elementary functions... Should Utilitai/Table.py be considered as of internal api or public ?

    Install tree

    About the proposed installation tree :

    binaries

    If I want to use the version 12, I will call $PREFIX/bin/aster12.1 : ok

    header files

    If I want to write an extension, what is expected in the source code (of the extension) ?

    #include "aster/asterc_config.h"
    

    and the proposed tree must be changed, for example, into $PREFIX/include/aster12.1/aster/*.h (and use -I$PREFIX/include/aster12.1 in cflags).

    Or:

    #include "asterc_config.h"
    

    and it's ok with the proposed include dir using -I$PREFIX/include/aster12.1 in cflags.

    python packages/modules

    The commands files (of users or macro-commands) must be independant of the version:

    from Cata.cata import XXX
    

    So, with the proposal, I have to set PYTHONPATH to $PREFIX/lib/python2.7/site-packages/aster12.1. Is it a problem ? not to much out of standard practices ?

    locale

    As for python modules, the LOCALEDIR has to be set to $PREFIX/share/locale/aster12.1/$LANG/LC_MESSAGES/.

    I have see no versioned package in /usr/share/locale...

    Another design is to rename "domain" into aster12.1_messages.mo and put all them in $PREFIX/share/locale/en/LC_MESSAGES/.

  3. Anonymous

    binaries

    +1

    Dev files

    +1.

    pkg-config will help for that purpose. So waf has to produce the corresponding .pc file.

    python packages/modules

    I think that they are private libraries, because the main entry point is the asterXX.YY executable (not python). They shall be placed in $PREFIX/share/aster.

    The Cata module could be placed in $PREFIX/share/aster/shared and other version dependent modules could be placed in $PREFIX/share/aster/XX.YY/site-packages.

    Finally the asterXX.YY executable could set the right PYTHONPATH value, by appending paths in order to preload manually installed modules.

    locale

    As for python modules, they are aster specific files. They shall be placed in $PREFIX/share/aster/XX.YY/locale

    Using aster as python package

    A specific python package could be created and placed into $PREFIX/lib/python2.7/site-packages/aster with a dedicated function that helps users to choose the right version (with a fallback to a default version).

  4. Mathieu Courtois reporter

    This issue is partially solved by the commits of pull request #2 et pull request #3 that make packaging easier.

    The last changeset adds the --install-as=N.P option to use versionned subdirectories.

    Here are two examples :

    1. first using --shared-aster --install-as=12.x --install-i18n:
    ├── include
    │   └── aster
    │       └── 12.x
    │           ├── asterc_config.h
    │           ├── ...
    ├── lib
    │   └── aster
    │       └── 12.x
    │           ├── Accas
    │           │   ├── ...
    │           ├── aster_core.py
    │           ├── _aster_core.so
    │           ├── aster_fonctions.so
    │           ├── aster_pkginfo.py
    │           ├── aster.so
    │           ├── Build
    │           │   ├── ...
    │           ├── elements
    │           ├── Execution
    │           │   ├── ...
    │           ├── libaster.so
    │           ├── med_aster.so
    │           └── Validation
    │               ├── ...
    └── share
        ├── locale
        │   └── aster
        │       └── 12.x
        │           ├── en
        │           │   └── LC_MESSAGES
        │           │       └── aster_messages.mo
        │           └── ...
        └── aster
            └── 12.x
                ├── config.txt
                ├── datg
                │   ├── ...
                ├── materiau
                │   ├── ...
                └── profile.sh
    
    1. then installing two releases (11.5 and 12.1) under the same prefix: waf configure --install-as=12.1 --embed-aster and waf configure --install-as=11.5 --embed-aster
    ├── bin
    │   ├── aster11.5
    │   ├── aster12.1
    │   ├── asterd11.5
    │   └── asterd12.1
    ├── include
    │   └── aster
    │       ├── 11.5
    │       │   ├── ...
    │       └── 12.1
    │           ├── ...
    ├── lib
    │   └── aster
    │       ├── 11.5
    │       │   ├── ...
    │       └── 12.1
    │           ├── Accas
    │           │   ├── ...
    │           ├── aster_core.py
    │           ├── aster_pkginfo.py
    │           ├── Build
    │           │   ├── ...
    │           ├── elements
    │           └── Validation
    │               ├── ...
    └── share
        └── aster
            ├── 11.5
            │   ├── config.txt
            │   ├── datg
            │   │   ├── ...
            │   ├── materiau
            │   │   ├── ...
            │   └── profile.sh
            └── 12.1
                ├── config.txt
                ├── datg
                │   ├── ...
                ├── materiau
                │   ├── ...
                └── profile.sh
    

    Please note that --install-i18n is not ready for production.

  5. Alain Leufroy

    Great!

    3 small questions:

    • Should Cata not be version independent ?
    • Where is libaster.so if we use --shared ?
    • Is it possible to consider /usr/share/code_aster/ and /usr/lib/code_aster/ ?
  6. Log in to comment