Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .hunspell.en.dic
Original file line number Diff line number Diff line change
Expand Up @@ -1662,3 +1662,15 @@ parseModuleCommandArgs
DDTHH
hhmm
22T21
getModshareVarName
getPriorityArray
getPriorityVarName
getReferenceCountArray
parsePathCommandArgs
setPriorityRecordValue
setReferenceCountRecordValue
runModuleUse
TMOD
getPathElementWeight
withdrawPriorityDemands
getPathWeightList
29 changes: 29 additions & 0 deletions MIGRATING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,35 @@ possible values of each variant are set as a JSON array.
:ps:`$` module avail --json -o variant foo
{"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "variants": { "arch": [ "x86_64", "arm64" ], "debug": [ "on", "off" ] }, "pathname": "/path/to/modulefiles/foo/1.0"}}

Priority of path elements
^^^^^^^^^^^^^^^^^^^^^^^^^

The :mfcmd:`prepend-path` and :mfcmd:`append-path` modulefile commands accept
a new ``--priority`` option to assign a priority to the path elements they
add. The prepended elements with the highest priority are kept at the
beginning of the path-like variable and the appended elements with the
highest priority are kept at its end, whatever the modules loaded afterward.
Elements without priority are placed in between and ordered as usual.

.. parsed-literal::

:ps:`$` cat /path/to/modulefiles/wrapper/1.0
#%Module
prepend-path --priority 100 PATH /path/to/wrapper/bin
:ps:`$` cat /path/to/modulefiles/foo/1.0
#%Module
prepend-path PATH /path/to/foo/bin
:ps:`$` module load wrapper foo
:ps:`$` echo $PATH
/path/to/wrapper/bin:/path/to/foo/bin:/usr/bin:/bin

Priority is a number between ``0`` and ``1000000``. The priority of the
elements of a variable is recorded in the
:envvar:`__MODULES_PRIORITY_\<VAR\>` environment variable, so the ordering is
kept across module evaluations. The ``--priority`` option is also available on
the :subcmd:`prepend-path`, :subcmd:`append-path` and :subcmd:`use`
sub-commands.


v5.7
----
Expand Down
9 changes: 9 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ Modules 5.8.0 (not yet released)
* Add *mtime* element to the JSON output configuration of :subcmd:`avail`,
:subcmd:`list` and :subcmd:`spider` sub-commands to report the modification
time of modulefiles. (fix issue #615)
* Doc: add :ref:`path-priority` design notes.
* Add ``--priority`` option to :mfcmd:`prepend-path` and :mfcmd:`append-path`
modulefile commands and sub-commands and to :subcmd:`use` sub-command to
assign a priority to the added path elements. Elements are ordered in the
path-like variable by priority: the prepended elements with the highest
priority stay first and the appended elements with the highest priority
stay last, whatever the modulefiles loaded afterward. Priority of elements
is recorded in the :envvar:`__MODULES_PRIORITY_\<VAR\>` environment
variable. (fix issue #185)


.. _5.7 release notes:
Expand Down
11 changes: 10 additions & 1 deletion doc/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,9 @@ Module Sub-Commands
a modulefile evaluation. In such context, a :subcmd:`module use<use>` will
not increase the reference counter of a path entry already defined.

Starting with version ``5.8``, the ``--priority`` option is added to assign
a priority to added modulepaths.

:subcmd:`unuse`

Reference counting mechanism is ignored when sub-command is not called during
Expand All @@ -721,6 +724,11 @@ Modules Specific Tcl Commands
variable, this element is removed from the reference counter variable when
its counter is equal to 1.

Starting with version ``5.8``, the ``--priority`` option is added to assign
a priority to added elements, which are ordered in the path-like variable
according to it. Priority is recorded in the
:envvar:`__MODULES_PRIORITY_\<VAR\>` environment variable.

:mfcmd:`chdir`, :mfcmd:`module`, ``module-trace``, ``module-verbosity``,
``module-user``, ``module-log``

Expand Down Expand Up @@ -1146,7 +1154,8 @@ The following environment variables appeared on Modules 5.
+------------+-----------------------------------------------------------------+
| 5.8 | :envvar:`MODULES_AVAIL_JSON_OUTPUT`, |
| | :envvar:`MODULES_LIST_JSON_OUTPUT`, |
| | :envvar:`MODULES_SPIDER_JSON_OUTPUT` |
| | :envvar:`MODULES_SPIDER_JSON_OUTPUT`, |
| | :envvar:`__MODULES_PRIORITY_\<VAR\>` |
+------------+-----------------------------------------------------------------+

Modules Specific Tcl Commands
Expand Down
Loading
Loading