Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
it4i-modules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SCS
it4i-modules
Commits
69815b39
Commit
69815b39
authored
6 years ago
by
Lukáš Krupčík
Browse files
Options
Downloads
Plain Diff
Merge branch '1-nespravne-trideni-modulu' into 'master'
Resolve "Nesprávné třídění modulů" Closes
#1
See merge request
!2
parents
1238d38b
a35b5394
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Resolve "Nesprávné třídění modulů"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
get_modules.sh
+2
-2
2 additions, 2 deletions
get_modules.sh
modules.py
+31
-41
31 additions, 41 deletions
modules.py
with
33 additions
and
43 deletions
get_modules.sh
+
2
−
2
View file @
69815b39
#
!/bin/bash
#!/bin/bash
PWD
=
"/home/easybuild/git/it4i-modules"
PWD
=
"/home/easybuild/git/it4i-modules"
cd
$PWD
cd
$PWD
...
@@ -66,6 +66,6 @@ else
...
@@ -66,6 +66,6 @@ else
./modules.py
>
phi.md
./modules.py
>
phi.md
fi
fi
DATE
=
`
date
-R
`
DATE
=
$(
date
-R
)
git diff
--exit-code
||
git commit
-am
"
$DATE
"
git diff
--exit-code
||
git commit
-am
"
$DATE
"
git push origin master
git push origin master
This diff is collapsed.
Click to expand it.
modules.py
+
31
−
41
View file @
69815b39
...
@@ -2,86 +2,76 @@
...
@@ -2,86 +2,76 @@
import
os
import
os
import
re
import
re
import
socket
def
software_list
(
class_
path
):
def
get_
software_list
(
path
):
"""
List software from given module class
"""
"""
List software from given module class
"""
os
.
chdir
(
class_
path
)
os
.
chdir
(
path
)
software_list
=
next
(
os
.
walk
(
'
.
'
))[
1
]
software_list
=
next
(
os
.
walk
(
'
.
'
))[
1
]
# In case that there is 'all' module
# In case that there is 'all' module
if
'
all
'
in
software_list
:
if
'
all
'
in
software_list
:
software_list
.
remove
(
'
all
'
)
software_list
.
remove
(
'
all
'
)
return
software_list
return
software_list
def
get_software_versions
(
path
):
def
get_software_versions
(
software_path
):
"""
List available versions of software
"""
"""
List available versions of software
"""
os
.
chdir
(
software_
path
)
os
.
chdir
(
path
)
return
next
(
os
.
walk
(
'
.
'
))[
2
]
return
next
(
os
.
walk
(
'
.
'
))[
2
]
def
get_module_description
(
module_path
):
def
get_module_description
(
module_path
):
"""
Return software homepage URL and description
"""
"""
Return software homepage URL and description
"""
url
=
""
url
=
""
url_position
=
0
description
=
"
Old module, description not available.
"
description
=
"
Old module, description not available.
"
with
open
(
module_path
)
as
f
:
with
open
(
module_path
)
as
_file
:
content
=
f
.
read
()
content
=
_file
.
read
()
if
module_path
.
endswith
(
'
lua
'
):
if
module_path
.
endswith
(
'
lua
'
):
data
=
re
.
search
(
r
"
whatis\((\[\[|\[==\[)Description: ?([\s\S]+)(\]\]|\]==\])\)\s+whatis\((\[\[|\[==\[)Homepage:\s(\S+)(\]\]|\]==\])\)
"
,
data
=
re
.
search
(
r
"
whatis\((\[\[|\[==\[)Description: ?([\s\S]+)(?>\]\]|\]==\])\)\s+whatis\((?>\[\[|\[==\[)Homepage:\s(\S+)(?>\]\]|\]==\])\)
"
,
content
,
re
.
DOTALL
)
content
,
re
.
DOTALL
)
url_position
=
5
else
:
else
:
data
=
re
.
search
(
r
"
module-whatis\s{(Description: )?(.+)\s-\sHomepage:\s(\S+)}
"
,
data
=
re
.
search
(
r
"
module-whatis\s{(Description: )?(.+)\s-\sHomepage:\s(\S+)}
"
,
content
,
re
.
DOTALL
)
content
,
re
.
DOTALL
)
url_position
=
3
try
:
try
:
description
=
data
.
group
(
2
)
description
=
data
.
group
(
2
)
url
=
data
.
group
(
url_position
)
url
=
data
.
group
(
3
)
except
AttributeError
:
except
AttributeError
:
pass
pass
return
url
,
description
return
url
,
description
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
HTML_SOURCE_DATA
=
{}
HTML_SOURCE_DATA
=
{}
subdirs
=
os
.
environ
[
'
MODULEPATH
'
].
split
(
'
:
'
)
SUBDIRS
=
os
.
environ
[
'
MODULEPATH
'
].
split
(
'
:
'
)
if
os
.
getenv
(
'
CLUSTER
'
)
==
"
ANSELM
"
:
if
os
.
getenv
(
'
CLUSTER
'
)
==
"
ANSELM
"
:
subdirs
.
remove
(
"
/apps/modules/init
"
)
SUBDIRS
.
remove
(
"
/apps/modules/init
"
)
subdirs
.
remove
(
"
/apps/modules/environments
"
)
SUBDIRS
.
remove
(
"
/apps/modules/environments
"
)
subdirs
.
remove
(
"
/apps/modules/engineering
"
)
SUBDIRS
.
remove
(
"
/apps/modules/engineering
"
)
subdirs
.
remove
(
"
/apps/modules/libraries
"
)
SUBDIRS
.
remove
(
"
/apps/modules/libraries
"
)
subdirs
.
remove
(
"
/apps/modules/omics
"
)
SUBDIRS
.
remove
(
"
/apps/modules/omics
"
)
subdirs
.
remove
(
"
/apps/modules/prace
"
)
SUBDIRS
.
remove
(
"
/apps/modules/prace
"
)
print
"
# Available Modules
"
for
subdir
in
sorted
(
SUBDIRS
,
key
=
lambda
s
:
s
.
lower
()):
for
dir
in
sorted
(
subdirs
):
available_software
=
get_software_list
(
subdir
)
available_software
=
software_list
(
dir
)
print
"
\n
## %s
\n
"
%
os
.
path
.
basename
(
subdir
).
title
()
print
"
\n
## %s
\n
"
%
os
.
path
.
basename
(
dir
).
title
()
print
"
| Module | Description |
"
print
"
| Module | Description |
"
print
"
| ------ | ----------- |
"
print
"
| ------ | ----------- |
"
HTML_SOURCE_DATA
[
dir
]
=
{}
HTML_SOURCE_DATA
[
sub
dir
]
=
{}
for
soft
in
sorted
(
available_software
,
key
=
str
.
lower
):
for
soft
in
sorted
(
available_software
,
key
=
str
.
lower
):
software_path
=
os
.
path
.
join
(
dir
,
soft
)
software_path
=
os
.
path
.
join
(
sub
dir
,
soft
)
if
os
.
getenv
(
'
CLUSTER
'
)
!=
"
ANSELM
"
:
if
os
.
getenv
(
'
CLUSTER
'
)
!=
"
ANSELM
"
:
software_path
=
software_path
.
replace
(
os
.
path
.
basename
(
dir
)
+
'
/
'
,
'
all/
'
)
software_path
=
software_path
.
replace
(
os
.
path
.
basename
(
sub
dir
)
+
'
/
'
,
'
all/
'
)
software_versions
=
get_software_versions
(
software_path
)
software_versions
=
get_software_versions
(
software_path
)
while
"
.common
"
in
software_versions
:
software_versions
.
remove
(
"
.common
"
)
software_versions
=
[
ver
for
ver
in
software_versions
if
not
ver
[
0
]
==
'
.
'
]
while
"
.common-6
"
in
software_versions
:
software_versions
.
remove
(
"
.common-6
"
)
while
"
.version
"
in
software_versions
:
software_versions
.
remove
(
"
.version
"
)
if
not
software_versions
:
if
not
software_versions
:
continue
continue
first_module_path
=
os
.
path
.
join
(
software_path
,
software_versions
[
0
])
first_module_path
=
os
.
path
.
join
(
software_path
,
software_versions
[
0
])
software_url
,
software_description
=
get_module_description
(
first_module_path
)
software_url
,
software_description
=
get_module_description
(
first_module_path
)
HTML_SOURCE_DATA
[
dir
][
soft
]
=
{
'
versions
'
:
[],
HTML_SOURCE_DATA
[
sub
dir
][
soft
]
=
{
'
versions
'
:
[],
'
url
'
:
software_url
,
'
url
'
:
software_url
,
'
description
'
:
software_description
}
'
description
'
:
software_description
}
for
version
in
software_versions
:
for
version
in
software_versions
:
HTML_SOURCE_DATA
[
dir
][
soft
][
'
versions
'
].
append
(
version
)
HTML_SOURCE_DATA
[
subdir
][
soft
][
'
versions
'
].
append
(
version
)
if
software_url
==
""
:
if
software_url
in
[
""
,
"
(none)
"
]:
print
"
| %s | %s |
"
%
(
soft
,
"
"
.
join
(
software_description
.
split
()))
print
"
| %s | %s |
"
%
(
soft
,
"
"
.
join
(
software_description
.
split
()))
elif
software_url
==
"
(none)
"
:
print
"
| %s | %s |
"
%
(
soft
,
"
"
.
join
(
software_description
.
split
()))
else
:
else
:
print
"
| [%s](%s) | %s |
"
%
(
soft
,
software_url
,
"
"
.
join
(
software_description
.
split
()))
print
"
| [%s](%s) | %s |
"
%
(
soft
,
software_url
,
"
"
.
join
(
software_description
.
split
()))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment