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 be90a2e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 <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: ## 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
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__

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.

Expand Down

0 comments on commit be90a2e

Please sign in to comment.