Skip to content

Commit

Permalink
cli: Add Makefile with install and editable targets
Browse files Browse the repository at this point in the history
  • Loading branch information
cassava committed Feb 3, 2021
1 parent c4c3561 commit 33d831d
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions cli/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PIPX := $(shell command -v pipx 2>/dev/null)
PIPX_INSTALL_ARGS :=

PIP := $(or \
$(shell command -v pipx 2>/dev/null), \
$(shell command -v pip3 2>/dev/null), \
$(shell command -v pip 2>/dev/null) \
)
ifndef PIPX
PIP_INSTALL_ARGS := --upgrade --user
else
PIP_INSTALL_ARGS := --force ${PIPX_INSTALL_ARGS}
endif

.PHONY: help
.DEFAULT: help
.SILENT: help
help:
echo "Usage: make <target>"
echo "Available targets:"
echo " install to install cloe-launch locally"
echo " editable to install cloe-launch locally in editable mode"

.PHONY: install editable
install:
command -v ${PIP} >/dev/null 2>&1
mv pyproject.toml pyproject.toml.bak
${PIP} install ${PIP_INSTALL_ARGS} . || ( \
mv pyproject.toml.bak pyproject.toml; \
exit 1; \
)
mv pyproject.toml.bak pyproject.toml

editable:
command -v ${PIP} >/dev/null 2>&1
mv pyproject.toml pyproject.toml.bak
${PIP} install -e ${PIP_INSTALL_ARGS} . || ( \
mv pyproject.toml.bak pyproject.toml; \
exit 1; \
)
mv pyproject.toml.bak pyproject.toml

0 comments on commit 33d831d

Please sign in to comment.