Skip to content
Open
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
31 changes: 25 additions & 6 deletions src/lmr/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ install: $(PROGRAMS) $(SUB_PROGRAMS) $(PY_PROGRAMS) $(AUX_PROGRAMS) | buildinfo.
- mkdir -p $(INSTALL_DIR)/share
cp $(PROGRAMS) $(INSTALL_DIR)/bin
cp $(SUB_PROGRAMS) $(INSTALL_DIR)/bin
cp $(PY_PROGRAMS) $(INSTALL_DIR)/bin
cp lua-modules/*.lua $(INSTALL_DIR)/lib/
cp lmr.cfg $(INSTALL_DIR)/etc/
cp $(LUA_DIR)/install/bin/* $(BUILD_DIR)/bin
Expand All @@ -327,7 +326,7 @@ clean:
- rm -rf $(BUILD_DIR)/*
- rm $(PROGRAMS)
- rm $(SUB_PROGRAMS)
- rm $(PY_PROGRAMS)
- rm -rf $(PY_PROG_DIR)/__pycache__ $(PY_PROG_DIR)/*.egg-info
- rm lmrconfig_with_str_subst.d
- rm runsim_shared.d runsim_mpi.d
- rm -f gdtk-module
Expand Down Expand Up @@ -431,10 +430,30 @@ lmr%run: $(LMR_SRC_DEPS) $(LMR_LUA_DEPS) | buildinfo.json
lmr%check-jacobian: $(LMR_CMD)/checkjacobian.d $(LMR_SRC_DEPS) $(LMR_LUA_DEPS) | buildinfo.json
$(call build_lmr_entry)

#### Python programs
lmr-verify: $(PY_PROG_DIR)/lmr_verify.py
cp $< $@
chmod +x $@
# Priority:
# 1. VIRTUAL_ENV - Standard set by python virtual-environments
# 2. CONDA_PREFIX - Set by (ana)conda environments
# 3. INSTALL_DIR/.venv - Create our own if none already exist
CONDA_PREFIX ?= $(INSTALL_DIR)/.venv
VIRTUAL_ENV ?= $(CONDA_PREFIX)

# Override if using uv with `PIP='uv pip'`
PIP ?= $(VIRTUAL_ENV)/bin/pip
PYTHON ?= python3

# If it doesn't already exist
$(VIRTUAL_ENV):
- mkdir -p $(INSTALL_DIR)
$(info Creating virtual environment ...)
$(PYTHON) -m venv $(VIRTUAL_ENV)
$(info Updating pip)
$(VIRTUAL_ENV)/bin/pip install --upgrade pip -q

$(PY_PROGRAMS): $(VIRTUAL_ENV)
$(info Installing python tools)
$(PIP) install ./$(PY_PROG_DIR)
- mkdir -p $(INSTALL_DIR)/bin
- ln -sf $(VIRTUAL_ENV)/bin/$@ $(INSTALL_DIR)/bin/$@

#### Auxiliary programs but part of making an eilmer install useful
prep-gas:
Expand Down
14 changes: 14 additions & 0 deletions src/lmr/python-programs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]
name = "lmr-python-programs"
version = "0.1.0"
requires-python = ">=3.8"
dependencies = [
"click",
"pyyaml",
]

[project.scripts]
lmr-verify = "lmr_verify:verify"

[tool.setuptools]
py-modules = ["lmr_verify"]