From c1bf2cacb509d2377b5f5dd8cd0faa302d0ce56d Mon Sep 17 00:00:00 2001 From: Chandan Singh Date: Sat, 29 Dec 2018 05:02:06 +0000 Subject: WIP: Add Makefile to regenerate frozen requirements files It can be a bit of hassle to update the requirements files properly as we need to install the dependencies in a virtual environment and then capture the output of `pip freeze`. Provide a simple Makefile that would enable users to run `make requirements-update` to simplify the above process. --- Makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..2f0afbd83 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# Makefile for BuildStream +# + +REQUIREMENTS_FILES := requirements.txt dev-requirements.txt plugin-requirements.txt +PYTHON := python3 +VENV := $(PYTHON) -m venv +TOX := tox + +VENV_PIP = $(VENVDIR)/bin/pip + + +.PHONY: all sdist tests clean requirements-remove requirements-update + +all: tests + +tests: + $(TOX) + +sdist: + python3 setup.py sdsit + +requirements-remove: + rm $(REQUIREMENTS_FILES) || true + +requirements-update: requirements-remove $(REQUIREMENTS_FILES) + +%.txt: %.in + $(eval VENVDIR := $(shell mktemp -d $$TMPDIR/bst-venv.XXXXXX)) + $(VENV) $(VENVDIR) + $(VENV_PIP) install -r $^ + $(VENV_PIP) freeze -r $^ > $@ + rm -rf $(VENVDIR) + +clean: + rm -rf __pycache__ tmp .tox -- cgit v1.2.1