Skip to content

Add --with-pythondir installation option - #687

Merged
xdelaruelle merged 5 commits into
envmodules:mainfrom
xdelaruelle:issue643
Aug 23, 2026
Merged

Add --with-pythondir installation option#687
xdelaruelle merged 5 commits into
envmodules:mainfrom
xdelaruelle:issue643

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

Add the --with-pythondir configure option to define the installation directory of the env_modules Python module. It enables for instance to install env_modules.py with the other Python modules available on the system (e.g., in Python's site-packages directory).

When the option is not set, env_modules.py is installed in the initialization script directory as before. Whatever the installation directory, the python.py symbolic link created in the initialization script directory points to the module location. When the option is set, the directory added to PYTHONPATH during initialization (if --enable-set-pythonpath is used) refers to this location rather than the initialization directory. If the module is installed in a directory already searched by the Python installation, --disable-set-pythonpath may be used, as documented in INSTALL.

The RPM spec file now installs env_modules.py in %python3_sitelib and disables PYTHONPATH setup at initialization, on platforms where /usr/bin/python3 is used (Fedora 22+ and EL8+). The el8 and el9 CI jobs exercise the new option.

Fixes #643

Add the --with-pythondir option to the configure installation script
to define a particular installation directory for the env_modules
Python module. It enables for instance to install env_modules.py with
the other Python modules available on the system.

If option is not defined, env_modules.py is installed by default in
initdir. Whatever the installation directory of the Python module, the
python.py symbolic link created in initdir points to its location. When
option is set, the PYTHONPATH environment variable defined during
initialization (if --enable-set-pythonpath is used) refers to this
directory rather initdir.

Fixes envmodules#643

Assisted-by: Claude:claude-fable-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Expected PYTHONPATH value now depends on the directory where the
env_modules Python module is installed. Also check this Python module
and the python.py symbolic link are found at their expected location
once installed.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Also fix the installation option named in module.1 to describe the
condition disabling PYTHONPATH setup during initialization
(--enable-set-pythonpath, not --enable-append-pythonpath).

Assisted-by: Claude:claude-fable-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Use the --with-pythondir installation option to install the
env_modules Python module with the other Python modules available on
the system (in python3_sitelib directory). As this location is searched
by default by the Python installation, PYTHONPATH setup during module
command initialization is disabled.

python3-devel build requirement provides the python3_sitelib macro and
the Python interpreter used to byte-compile the env_modules module.

This setup is applied where /usr/bin/python3 is used as Python
interpreter (Fedora 22+ and EL8+). Older platforms keep installing
env_modules.py in initdir.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit eb6672a into envmodules:main Aug 23, 2026
20 checks passed
@xdelaruelle
xdelaruelle deleted the issue643 branch August 23, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install Python module env_modules in a specific directory

1 participant