From be90a2eb9527318e944275102844e2fd8fc425d0 Mon Sep 17 00:00:00 2001 From: "R.A. te Boekhorst" Date: Thu, 7 Mar 2024 13:29:41 +0100 Subject: [PATCH] feat: makefile to install first pre-commit and then venv, documentation in README.md Signed-off-by: R.A. te Boekhorst --- Makefile | 37 +++++++++++++++++++++++++++++++++++++ README.md | 10 +++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b14b63a --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +COLOUR_GREEN=\033[0;32m +COLOUR_RED=\033[0;31m +COLOUR_BLUE=\033[0;34m +COLOUR_END=\033[0m + +.DEFAULT_GOAL:=help + +SHELL := /bin/bash +GENERAL_LIB_LOCATION := $(shell pip show rados | grep -oP "(?<=Location: ).*") +LIBRADOS_LOCATION := $(shell find "${GENERAL_LIB_LOCATION}" -name 'rados*.so' -print) +LIBRADOS_EGGINFO_LOCATION := $(shell find "${GENERAL_LIB_LOCATION}" -name 'rados*.egg-info' -print) +LIBRADOS_NAME := $(shell basename "${LIBRADOS_LOCATION}") +LIBRADOS_EGGINFO_NAME := $(shell basename "${LIBRADOS_EGGINFO_LOCATION}") + +.PHONY: help +help: ## Display this help message + @echo -e '${COLOUR_RED}Usage: make ${COLOUR_END}' + @cat $(MAKEFILE_LIST) | grep '^[a-zA-Z]' | \ + awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n\n", $$1, "${COLOUR_GREEN}"$$2"${COLOUR_END}"}' + +.PHONY: setup +setup: ## Setting up the pre-commit environment and then the venv environment + ${MAKE} setup-pre-commit && \ + ${MAKE} setup-venv + +setup-pre-commit: + pip install --user pre-commit && pre-commit install + +setup-venv: + python -m venv ./.venv + source ./.venv/bin/activate + @echo -e 'GENERAL_LIB_LOCATION: ${GENERAL_LIB_LOCATION}' + @echo -e 'LIBRADOS_LOCATION: ${LIBRADOS_LOCATION}' + @echo -e 'LIBRADOS_EGGINFO_LOCATION: ${LIBRADOS_EGGINFO_LOCATION}' && \ + ln -s "${LIBRADOS_LOCATION}" ./.venv/lib/python3.12/site-packages/"${LIBRADOS_NAME}" && \ + ln -s "${LIBRADOS_EGGINFO_LOCATION}" ./.venv/lib/python3.12/site-packages/"${LIBRADOS_EGGINFO_NAME}" && \ + pip install -r requirements.txt diff --git a/README.md b/README.md index ea09fbe..d91d111 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,19 @@ git clone https://github.com/SovereignCloudStack/rookify cd rookify ``` -3. __TODO:__ Install script +3. To install the local development environment: +(_Note: This will install pre-commit in your local user context_) +```bash +make setup +``` + +4. __TODO:__ Install script for container-based setup ## Usage __TODO__ +See the [Makefile](./Makefile). You can run it by simply typing `make`, which will give you a list of helpfull commands that can be used for development. + ## Support For issues, questions, or contributions, please open an issue or pull request in the GitHub repository. We welcome community feedback and contributions to enhance rookify.