Skip to content

Commit

Permalink
add --py-ver option to install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Aug 7, 2023
1 parent b9365e6 commit 5713e28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ In most cases, running `./install.sh` should be sufficient to install all packag
- `--git-ssh`: Use SSH-based URL to clone mirgecom.
- `--debug`: Show debugging output of this script (set -x).
- `--skip-clone`: Skip cloning mirgecom, assume it will be manually copied to the selected installation prefix.
- `--py-ver=VERSION`: Replace the Python version specified in the conda environment file with `VERSION` (e.g., `--py-ver=3.10`).
- `--help`: Print this help text.

## Testing the installation
Expand Down
13 changes: 13 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ opt_git_ssh=0
# Skip cloning mirgecom
opt_skip_clone=0

opt_py_ver=

while [[ $# -gt 0 ]]; do
arg=$1
shift
Expand Down Expand Up @@ -110,6 +112,10 @@ while [[ $# -gt 0 ]]; do
--skip-clone)
opt_skip_clone=1
;;
--py-ver=*)
# Install this python version instead of the version specified in the conda env file.
opt_py_ver=${arg#*=}
;;
--help)
usage
exit 0
Expand Down Expand Up @@ -159,6 +165,13 @@ echo "==== Create $env_name conda environment"

[[ -z $conda_env_file ]] && conda_env_file="$mcsrc/conda-env.yml"

if [[ -n $opt_py_ver ]]; then
echo "=== Overriding Python version with $opt_py_ver"
sed -i.bak "s,- python=3[0-9\.]*,- python=$opt_py_ver," "$conda_env_file"
fi

cat "$conda_env_file"

mamba env create --name "$env_name" --force --file="$conda_env_file"

# Avoid a 'frankenconda' env that uses Python from the base env.
Expand Down

0 comments on commit 5713e28

Please sign in to comment.