Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --py-ver option to install.sh #164

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this here on purpose? Or left over from debugging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's here on purpose to help with debugging an installation. It's a small file anyway.


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

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