Tristan Van Berkom pushed to branch chandan/update-requirements-one-liner at BuildStream / buildstream
Commits:
-
cf0e7d26
by Jürg Billeter at 2019-01-04T07:07:59Z
-
0751fc8f
by Jürg Billeter at 2019-01-04T11:27:58Z
-
ebd965fe
by Chandan Singh at 2019-01-04T15:21:35Z
-
bb712886
by Chandan Singh at 2019-01-04T15:21:35Z
-
b9792837
by Chandan Singh at 2019-01-04T15:21:35Z
13 changed files:
- .gitlab-ci.yml
- CONTRIBUTING.rst
- MANIFEST.in
- buildstream/_frontend/cli.py
- + requirements/Makefile
- tools/dev-requirements.in → requirements/dev-requirements.in
- tools/dev-requirements.txt → requirements/dev-requirements.txt
- tools/plugin-requirements.in → requirements/plugin-requirements.in
- tools/plugin-requirements.txt → requirements/plugin-requirements.txt
- tools/requirements.in → requirements/requirements.in
- tools/requirements.txt → requirements/requirements.txt
- setup.py
- tox.ini
Changes:
... | ... | @@ -276,7 +276,7 @@ coverage: |
276 | 276 |
coverage: '/TOTAL +\d+ +\d+ +(\d+\.\d+)%/'
|
277 | 277 |
script:
|
278 | 278 |
- cd dist && ./unpack.sh && cd buildstream
|
279 |
- - pip3 install -r tools/requirements.txt -r tools/dev-requirements.txt
|
|
279 |
+ - pip3 install -r requirements/requirements.txt -r requirements/dev-requirements.txt
|
|
280 | 280 |
- pip3 install --no-index .
|
281 | 281 |
- mkdir report
|
282 | 282 |
- cd report
|
... | ... | @@ -1736,10 +1736,8 @@ obtain profiles:: |
1736 | 1736 |
ForceCommand BST_PROFILE=artifact-receive cd /tmp && bst-artifact-receive --pull-url https://example.com/ /home/artifacts/artifacts
|
1737 | 1737 |
|
1738 | 1738 |
|
1739 |
-The MANIFEST.in and setup.py
|
|
1740 |
-----------------------------
|
|
1741 |
-When adding a dependency to BuildStream, it's important to update the setup.py accordingly.
|
|
1742 |
- |
|
1739 |
+Managing data files
|
|
1740 |
+-------------------
|
|
1743 | 1741 |
When adding data files which need to be discovered at runtime by BuildStream, update setup.py accordingly.
|
1744 | 1742 |
|
1745 | 1743 |
When adding data files for the purpose of docs or tests, or anything that is not covered by
|
... | ... | @@ -1749,3 +1747,23 @@ At any time, running the following command to create a source distribution shoul |
1749 | 1747 |
creating a tarball which contains everything we want it to include::
|
1750 | 1748 |
|
1751 | 1749 |
./setup.py sdist
|
1750 |
+ |
|
1751 |
+ |
|
1752 |
+Updating BuildStream's Python dependencies
|
|
1753 |
+------------------------------------------
|
|
1754 |
+BuildStream's Python dependencies are listed in multiple
|
|
1755 |
+`requirements files <https://pip.readthedocs.io/en/latest/reference/pip_install/#requirements-file-format>`
|
|
1756 |
+present in the ``requirements`` directory.
|
|
1757 |
+ |
|
1758 |
+All ``.txt`` files in this directory are generated from the corresponding
|
|
1759 |
+``.in`` file, and each ``.in`` file represents a set of dependencies. For
|
|
1760 |
+example, ``requirements.in`` contains all runtime dependencies of BuildStream.
|
|
1761 |
+``requirements.txt`` is generated from it, and contains pinned versions of all
|
|
1762 |
+runtime dependencies (including transitive dependencies) of BuildStream.
|
|
1763 |
+ |
|
1764 |
+When adding a new dependency to BuildStream, or updating existing dependencies,
|
|
1765 |
+it is important to update the appropriate requirements file accordingly. After
|
|
1766 |
+changing the ``.in`` file, run the following to update the matching ``.txt``
|
|
1767 |
+file::
|
|
1768 |
+ |
|
1769 |
+ make -C requirements
|
... | ... | @@ -32,12 +32,12 @@ include .pylintrc |
32 | 32 |
recursive-include buildstream/_protos *.proto
|
33 | 33 |
|
34 | 34 |
# Requirements files
|
35 |
-include tools/requirements.in
|
|
36 |
-include tools/requirements.txt
|
|
37 |
-include tools/dev-requirements.in
|
|
38 |
-include tools/dev-requirements.txt
|
|
39 |
-include tools/plugin-requirements.in
|
|
40 |
-include tools/plugin-requirements.txt
|
|
35 |
+include requirements/requirements.in
|
|
36 |
+include requirements/requirements.txt
|
|
37 |
+include requirements/dev-requirements.in
|
|
38 |
+include requirements/dev-requirements.txt
|
|
39 |
+include requirements/plugin-requirements.in
|
|
40 |
+include requirements/plugin-requirements.txt
|
|
41 | 41 |
|
42 | 42 |
# Versioneer
|
43 | 43 |
include versioneer.py
|
... | ... | @@ -719,6 +719,11 @@ def source_fetch(app, elements, deps, track_, except_, track_cross_junctions): |
719 | 719 |
deps = PipelineSelection.ALL
|
720 | 720 |
|
721 | 721 |
with app.initialized(session_name="Fetch"):
|
722 |
+ if not elements:
|
|
723 |
+ guessed_target = app.context.guess_element()
|
|
724 |
+ if guessed_target:
|
|
725 |
+ elements = (guessed_target,)
|
|
726 |
+ |
|
722 | 727 |
app.stream.fetch(elements,
|
723 | 728 |
selection=deps,
|
724 | 729 |
except_targets=except_,
|
... | ... | @@ -755,6 +760,11 @@ def source_track(app, elements, deps, except_, cross_junctions): |
755 | 760 |
all: All dependencies of all specified elements
|
756 | 761 |
"""
|
757 | 762 |
with app.initialized(session_name="Track"):
|
763 |
+ if not elements:
|
|
764 |
+ guessed_target = app.context.guess_element()
|
|
765 |
+ if guessed_target:
|
|
766 |
+ elements = (guessed_target,)
|
|
767 |
+ |
|
758 | 768 |
# Substitute 'none' for 'redirect' so that element redirections
|
759 | 769 |
# will be done
|
760 | 770 |
if deps == 'none':
|
1 |
+# Makefile for updating BuildStream's requirements files.
|
|
2 |
+#
|
|
3 |
+ |
|
4 |
+REQUIREMENTS_IN := $(wildcard *.in)
|
|
5 |
+REQUIREMENTS_TXT := $(REQUIREMENTS_IN:.in=.txt)
|
|
6 |
+PYTHON := python3
|
|
7 |
+VENV := $(PYTHON) -m venv
|
|
8 |
+ |
|
9 |
+VENV_PIP = $(VENVDIR)/bin/pip
|
|
10 |
+ |
|
11 |
+ |
|
12 |
+.PHONY: all
|
|
13 |
+ |
|
14 |
+all: $(REQUIREMENTS_TXT)
|
|
15 |
+ |
|
16 |
+%.txt: %.in
|
|
17 |
+ $(eval VENVDIR := $(shell mktemp -d $(CURDIR)/.bst-venv.XXXXXX))
|
|
18 |
+ $(VENV) $(VENVDIR)
|
|
19 |
+ $(VENV_PIP) install -r $^
|
|
20 |
+ $(VENV_PIP) freeze -r $^ > $@
|
|
21 |
+ rm -rf $(VENVDIR)
|
... | ... | @@ -270,10 +270,10 @@ def get_cmdclass(): |
270 | 270 |
#####################################################
|
271 | 271 |
# Gather requirements #
|
272 | 272 |
#####################################################
|
273 |
-with open('tools/dev-requirements.in') as dev_reqs:
|
|
273 |
+with open('requirements/dev-requirements.in') as dev_reqs:
|
|
274 | 274 |
dev_requires = dev_reqs.read().splitlines()
|
275 | 275 |
|
276 |
-with open('tools/requirements.in') as install_reqs:
|
|
276 |
+with open('requirements/requirements.in') as install_reqs:
|
|
277 | 277 |
install_requires = install_reqs.read().splitlines()
|
278 | 278 |
|
279 | 279 |
#####################################################
|
... | ... | @@ -5,9 +5,9 @@ skip_missing_interpreters = true |
5 | 5 |
[testenv]
|
6 | 6 |
commands = pytest {posargs}
|
7 | 7 |
deps =
|
8 |
- -rtools/requirements.txt
|
|
9 |
- -rtools/dev-requirements.txt
|
|
10 |
- -rtools/plugin-requirements.txt
|
|
8 |
+ -rrequirements/requirements.txt
|
|
9 |
+ -rrequirements/dev-requirements.txt
|
|
10 |
+ -rrequirements/plugin-requirements.txt
|
|
11 | 11 |
passenv =
|
12 | 12 |
BST_FORCE_BACKEND
|
13 | 13 |
GI_TYPELIB_PATH
|
... | ... | @@ -18,9 +18,9 @@ commands = |
18 | 18 |
pycodestyle
|
19 | 19 |
pylint buildstream
|
20 | 20 |
deps =
|
21 |
- -rtools/requirements.txt
|
|
22 |
- -rtools/dev-requirements.txt
|
|
23 |
- -rtools/plugin-requirements.txt
|
|
21 |
+ -rrequirements/requirements.txt
|
|
22 |
+ -rrequirements/dev-requirements.txt
|
|
23 |
+ -rrequirements/plugin-requirements.txt
|
|
24 | 24 |
|
25 | 25 |
[testenv:docs]
|
26 | 26 |
commands =
|
... | ... | @@ -30,8 +30,8 @@ deps = |
30 | 30 |
sphinx==1.7.9
|
31 | 31 |
sphinx-click
|
32 | 32 |
sphinx_rtd_theme
|
33 |
- -rtools/requirements.txt
|
|
34 |
- -rtools/plugin-requirements.txt
|
|
33 |
+ -rrequirements/requirements.txt
|
|
34 |
+ -rrequirements/plugin-requirements.txt
|
|
35 | 35 |
passenv =
|
36 | 36 |
BST_FORCE_SESSION_REBUILD
|
37 | 37 |
BST_SOURCE_CACHE
|