Skip to content

Commit

Permalink
feat: makefile to install first pre-commit and then venv, documentation
Browse files Browse the repository at this point in the history
in README.md

Signed-off-by: R.A. te Boekhorst <[email protected]>
  • Loading branch information
boekhorstb1 committed Mar 7, 2024
1 parent 14541a6 commit 9fb8b51
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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

# Get needed paths and information from locally installed librados
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}")
PYTHON_VERSION=$(shell python -c "import platform; print(platform.python_version()[:4])")

.PHONY: help
help: ## Display this help message
@echo -e '${COLOUR_RED}Usage: make <command>${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: setup-pre-commit setup-venv ## Setup the pre-commit environment and then the venv environment

setup-pre-commit:
pip install --user pre-commit && pre-commit install

setup-venv:
python -m venv ./.venv && \
source ./.venv/bin/activate && \
echo -e 'PYTHON_VERSION: $(PYTHON_VERSION)'; \
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/python$(PYTHON_VERSION)/site-packages/${LIBRADOS_NAME}" && \
ln -s "${LIBRADOS_EGGINFO_LOCATION}" "./.venv/lib/python$(PYTHON_VERSION)/site-packages/${LIBRADOS_EGGINFO_NAME}" && \
pip install -r requirements.txt
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Type `make` to get a list of available development specific commands.

## 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.

Expand Down

0 comments on commit 9fb8b51

Please sign in to comment.