diff --git a/.gitignore b/.gitignore index c35c6698..eeafa318 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ workers autogen master-config.yaml .venv +.vendor diff --git a/Makefile b/Makefile index 95f8d742..480f1f35 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,36 @@ help: @grep -E '^[a-zA-Z1-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' +install: ## Install all necessary tools + $(MAKE) venv + $(MAKE) install-pip-packages + $(MAKE) install-wheel + @echo -e "\n--> You should now activate the python3 venv with:" + @echo -e "source $(VENV_DIR)/bin/activate\n" + venv: ## Create python3 venv if it does not exists $(info --> Create python virtual env ($(VENV_DIR))) [[ -d $(VENV_DIR) ]] || $(shell command -v python3) -m venv $(VENV_DIR) @echo -e "\n--> You should now activate the python3 venv with:" - @echo -e "source $(VENV_DIR)/bin/activate" + @echo -e "source $(VENV_DIR)/bin/activate\n" + +install-pip-packages: ## Install python3 requirements + $(info --> Install requirements via `pip`) + pip install pip -U + pip install wheel + pip install -r requirements.txt + +install-wheel: ## Build and install specific buildbot version + $(info --> Build/Install specific buildbot version) + if [[ ! -d $(VENDOR_DIR) ]]; then \ + git clone --branch grid https://github.com/vladbogo/buildbot $(VENDOR_DIR); \ + cd $(VENDOR_DIR)/master && python setup.py bdist_wheel; \ + pip install ./dist/*.whl; \ + fi install-pre-commit: ## Install pre-commit tool - $(info --> Install pre-commit tool via `pip3`) - pip3 install pre-commit + $(info --> Install pre-commit tool via `pip`) + pip install pre-commit pre-commit-run: ## Run pre-commit hooks with $PRE_COMMIT_ARGS default to (diff master...[current_branch]) $(info --> run pre-commit on changed files (pre-commit run)) @@ -31,3 +52,7 @@ pre-commit-run-all: ## Run pre-commit on the whole repository checkconfig: ## Validate master.cfg files $(info --> validate master.cfg files with docker) ./validate_master_cfg.sh + +clean: ## Clean venv + [[ ! -d $(VENV_DIR) ]] || rm -rf $(VENV_DIR) + [[ ! -d $(VENDOR_DIR) ]] || rm -rf $(VENDOR_DIR) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..cbc2a45d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +buildbot-prometheus +buildbot-worker +python-dotenv