summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-12-29 05:02:06 +0000
committerChandan Singh <csingh43@bloomberg.net>2018-12-29 05:02:06 +0000
commitc1bf2cacb509d2377b5f5dd8cd0faa302d0ce56d (patch)
tree002b772e6b55c7253cb6feeafbdbbc1ed9d7d26f
parent63ce0e4a60915facaab7519b3ac790a0e84d0f42 (diff)
downloadbuildstream-chandan/tox-make.tar.gz
WIP: Add Makefile to regenerate frozen requirements fileschandan/tox-make
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.
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
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