Open katgit opened 6 months ago
Follow-up discussion (February 26, 2024):
module -t -r avail R/4.3.1
command to check if the module is publishedmodule -r show python3/3.8.6 &>file_name
and then grep _DIR filename | grep setenv
to find the path to the modulefile. This can be done much simpler - Brian or I will give a better solution latermodule -t avail R/4.3.1
command. The output will have 2 lines:
/share/module.8/statistics:
R/4.3.1
Based on these lines, determine the path to the published module:
/share/module.8/statistics/R/4.3.1
Then execute:
ls -l /share/module.8/statistics/R/4.3.1*
to find the name of the softlink and the file it is pointing to:
lrwxrwxrwx 1 ktrn scv 35 Jun 18 2023 /share/module.8/statistics/R/4.3.1.lua -> /share/pkg.8/r/4.3.1/modulefile.lua
From this string I know that the path to the module file is /share/pkg.8/r/4.3.1/modulefile.lua
I think this is a better solution
Command line arguments to implement:
module_check.py modulename/version ...args...
-p path
to find the module, i.e. /share/pkg.7
Default to /share/pkg.8
--nocheck
optional to skip checks, i.e. the user just intends to publish.--testpublish path
give a path to a module test directory. Default to /share/module.8/test
--publish path
publish for real to the real module directory with the category read from modulefile.lua and automatically appended to the path. Defaults to /share/module.8
Checking the arguments with argparse...
modulename/version can be run through the mod_split function automatically by wrapping it into an Action subclass: https://docs.python.org/3/library/argparse.html#argparse.Action and then passing it to add_argument. something like this:
argParser.add_argument("module_to_test", action=mod_split.ModName, required=True)
That can be applied to the -p, --testpublish, and --publish flags too with an Action that makes sure that the path provided exists.
Reetom,
Here are some further tasks for this project. The input arguments should work as follows:
-h
or--help
- help message displayed (again I think it is done)-c module_name/version
(or-c module_name
). I am not sure-c
is the best choice here (I would use-m
) but we can discuss it later.-p path_to_module_file
. I think this option should only be used together with the previous option so we would know the software name and versionMore details:
-c module_name/version
option is used without-p path
option, execute themodule -t -r avail module_name/version
command and check if the listedmodule_name/version
is included in the output.-c module_name
is given and the version is not specified, executemodule -t -r -d avail module_name
command and check if the module exists and what is its default version-p path
is given, check if path to the module file exists. Also check if-c module_name/version
is still present. I think in this case we want to make sure both options are used and in this case the user must specify the version number (as this case is used when the module is not yet published so we cannot use the default version.) If you have any questions, please either use the comment box for this issue, slack or email me.--Katia