Skip to content

Commit 317c55d

Browse files
pawosm-armFatih Onur
andauthored
[ATfL] Simplify the modulefiles structure (arm#194)
It's a cherry-pick from the arm-software branch. Removed moduleglobals as unused global functions removed The simple is-lmod function is moved to the main module file moduledeps left as it is due to autocompletion still uses it Co-authored-by: Fatih Onur <[email protected]>
1 parent 3d31dab commit 317c55d

File tree

1 file changed

+10
-41
lines changed

1 file changed

+10
-41
lines changed

arm-software/linux/mkmoduledirs.sh.var

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,20 @@ set install_prefix ${ATFL_INSTALL_PREFIX}
7777
# from the install directory
7878
set module_prefix [file dirname \$ModulesCurrentModulefile]/../..
7979
80-
# Base directory of all dependant modules
81-
set moduledeps \$module_prefix/moduledeps
80+
###########################################################################
81+
# Helper Functions #
82+
###########################################################################
83+
proc is-lmod {} {
84+
global env
85+
if { [info exists env(LMOD_VERSION_MAJOR)] } {
86+
return true
87+
}
88+
return false
89+
}
8290
8391
###########################################################################
8492
# Main section #
8593
###########################################################################
86-
# Pull in some utility functions
87-
source \$module_prefix/moduleglobals/compiler_functions/${ATFL_VERSION}
8894
8995
# Install directory of this package
9096
set package_prefix \$install_prefix
@@ -100,9 +106,6 @@ set package_prefix \$install_prefix
100106
append-path LIBRARY_PATH \$package_prefix/lib/aarch64-unknown-linux-gnu
101107
prepend-path MANPATH \$package_prefix/share/man
102108
103-
# Make dependant modules available
104-
prepend-path MODULEPATH \$moduledeps/atfl/${ATFL_VERSION}
105-
106109
if { [is-lmod] } {
107110
# Lmod family
108111
# When this modulefile is used with lmod, This ensures only one compiler is loaded at once
@@ -125,37 +128,3 @@ switch -- \$SHELL {
125128
}
126129
EOT
127130
) > "modulefiles/atfl/${ATFL_VERSION}"
128-
129-
mkdir -p "moduleglobals/compiler_functions"
130-
(
131-
cat <<EOT
132-
#%Module1.0################################################################
133-
##
134-
## Utility functions for Arm modulefiles
135-
##
136-
##
137-
## Copyright 2015-2025 Arm Limited. All rights reserved.
138-
##
139-
140-
# Helper function, to load/unload a set of prerequisite modules
141-
proc depends-on {dependencies} {
142-
foreach dep \$dependencies {
143-
if { [module-info mode load] } {
144-
# This will load the module if it has not already been loaded
145-
# is-loaded only triggers on a mode load, so it would not allow an auto-unload
146-
if { ! [is-loaded \$dep] } {
147-
module load \$dep
148-
}
149-
}
150-
}
151-
}
152-
153-
proc is-lmod {} {
154-
global env
155-
if { [info exists env(LMOD_VERSION_MAJOR)] } {
156-
return true
157-
}
158-
return false
159-
}
160-
EOT
161-
) > "moduleglobals/compiler_functions/${ATFL_VERSION}"

0 commit comments

Comments
 (0)