FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
HydroModPy/install/setup_wsl_dev.sh at dev · HydroModPy/HydroModPy · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
HydroModPy
/
HydroModPy
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
11
Code
Issues
18
Pull requests
1
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
HydroModPy
/
install
/
setup_wsl_dev.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
122 lines (104 loc) · 3.08 KB
Breadcrumbs
HydroModPy
/
install
/
setup_wsl_dev.sh
Copy path
File metadata and controls
122 lines (104 loc) · 3.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!
/usr/bin/env bash
set
-euo pipefail
usage
() {
cat
<<
'
EOF
'
Usage: bash install/setup_wsl_dev.sh [options]
Create or update a Linux/WSL developer environment for HydroModPy.
Options:
--env-name NAME Conda environment name (default: hydromodpy-wsl)
--full Use the full editable stack with Spyder/Jupyter extras
--with-petsc Install PETSc, petsc4py, mpi4py, and mpich in the env
--skip-apt Do not install Ubuntu system dependencies with apt
-h, --help Show this help and exit
Examples:
bash install/setup_wsl_dev.sh
bash install/setup_wsl_dev.sh --env-name hydromodpy-linux --with-petsc
bash install/setup_wsl_dev.sh --full
EOF
}
ENV_NAME=
"
hydromodpy-wsl
"
ENV_FILE=
"
env_hydromodpy_light_pkg.yml
"
WITH_PETSC=0
USE_APT=1
while
[[
$#
-gt
0 ]]
;
do
case
"
$1
"
in
--env-name)
ENV_NAME=
"
$2
"
shift
2
;;
--full)
ENV_FILE=
"
env_hydromodpy_pkg.yml
"
shift
;;
--with-petsc)
WITH_PETSC=1
shift
;;
--skip-apt)
USE_APT=0
shift
;;
-h|--help)
usage
exit
0
;;
*
)
echo
"
Unknown option:
$1
"
>&2
usage
>&2
exit
2
;;
esac
done
SCRIPT_DIR=
"
$(
cd --
"
$(
dirname --
"
${BASH_SOURCE[0]}
"
)
"
&&
pwd
)
"
REPO_ROOT=
"
$(
cd --
"
${SCRIPT_DIR}
/..
"
&&
pwd
)
"
if
[[
!
-f
"
${SCRIPT_DIR}
/
${ENV_FILE}
"
]]
;
then
echo
"
Environment file not found:
${SCRIPT_DIR}
/
${ENV_FILE}
"
>&2
exit
1
fi
if
!
command
-v conda
>
/dev/null
2>&1
;
then
cat
>&2
<<
'
EOF
'
conda was not found in this shell.
Install Miniforge inside WSL first, for example:
sudo apt update && sudo apt install -y curl
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh
source ~/miniforge3/etc/profile.d/conda.sh
EOF
exit
1
fi
if
[[
"
${USE_APT}
"
-eq
1 ]]
&&
command
-v apt-get
>
/dev/null
2>&1
;
then
APT_PREFIX=
"
"
if
command
-v sudo
>
/dev/null
2>&1
;
then
APT_PREFIX=
"
sudo
"
fi
${APT_PREFIX}
apt-get update
${APT_PREFIX}
apt-get install -y libglu1-mesa
fi
pushd
"
${SCRIPT_DIR}
"
>
/dev/null
if
!
conda env create -n
"
${ENV_NAME}
"
-f
"
${ENV_FILE}
"
;
then
conda env update -n
"
${ENV_NAME}
"
-f
"
${ENV_FILE}
"
--prune
fi
popd
>
/dev/null
#
gmsh wheels on Linux can require libXft at runtime. Installing the conda
#
package keeps the fix inside the environment and avoids an extra system
#
dependency beyond libglu1-mesa.
conda install -n
"
${ENV_NAME}
"
-c conda-forge -y xorg-libxft
if
[[
"
${WITH_PETSC}
"
-eq
1 ]]
;
then
conda install -n
"
${ENV_NAME}
"
-c conda-forge -y petsc petsc4py mpi4py mpich
conda run -n
"
${ENV_NAME}
"
python -c
"
from petsc4py import PETSc; print('PETSc', PETSc.Sys.getVersion())
"
fi
conda run -n
"
${ENV_NAME}
"
python
"
${SCRIPT_DIR}
/verify_dev_env.py
"
\
--dist-name hydromodpy \
--expected-editable-root
"
${REPO_ROOT}
"
\
--require-docs \
--require-tests
cat
<<
EOF
Environment ready:
${ENV_NAME}
Repository root:
${REPO_ROOT}
Suggested next commands:
conda activate
${ENV_NAME}
export MPLBACKEND=Agg
python -m pytest tests/unit -q
hmp test regression --fast -j 2
hmp test validation --fast
EOF
Back
|
FazBrowse Home
|
New Git URL