Skip to content

Commit

Permalink
Add local dev environment venv
Browse files Browse the repository at this point in the history
  • Loading branch information
fauust committed Oct 10, 2023
1 parent 2476cab commit 50f84ac
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ workers
autogen
master-config.yaml
.venv
.vendor
31 changes: 28 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
buildbot-prometheus
buildbot-worker
python-dotenv

0 comments on commit 50f84ac

Please sign in to comment.