Skip to content

Instantly share code, notes, and snippets.

@ticapix
Last active February 14, 2020 09:08
Show Gist options
  • Save ticapix/ec2d5bf51d603ae52e96a81679dcb627 to your computer and use it in GitHub Desktop.
Save ticapix/ec2d5bf51d603ae52e96a81679dcb627 to your computer and use it in GitHub Desktop.
Stub for python Makefile
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PYTHON3=python3
VENV_DIR=$(ROOT_DIR)/venv3
NAME=$(shell basename $(ROOT_DIR))
ECHO=@echo
RM=rm -rf
.PHONY: help
help:
$(ECHO) "$(NAME)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m=> %s\n", $$1, $$2}'
$(VENV_DIR):
$(PYTHON3) -m venv $(VENV_DIR)
$(VENV_DIR)/bin/pip install --upgrade pip
$(VENV_DIR)/bin/pip install -Ur requirements.txt
deps: $(VENV_DIR) ## install dependencies
run: deps ## run
$(VENV_DIR)/bin/python $(ROOT_DIR)/XXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment