[Notes] [Git][BuildStream/buildstream][chandan/no-sdist] 7 commits: _frontend/cli.py: Reinstate support for guessing targets



Title: GitLab

Chandan Singh pushed to branch chandan/no-sdist at BuildStream / buildstream

Commits:

13 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -6,7 +6,6 @@ cache:
    6 6
         - cache/
    
    7 7
     
    
    8 8
     stages:
    
    9
    -  - prepare
    
    10 9
       - test
    
    11 10
       - post
    
    12 11
     
    
    ... ... @@ -15,41 +14,6 @@ variables:
    15 14
       INTEGRATION_CACHE: "${CI_PROJECT_DIR}/cache/integration-cache"
    
    16 15
       TEST_COMMAND: "tox -- --color=yes --integration"
    
    17 16
     
    
    18
    -#####################################################
    
    19
    -#                  Prepare stage                    #
    
    20
    -#####################################################
    
    21
    -
    
    22
    -# Create a source distribution
    
    23
    -#
    
    24
    -source_dist:
    
    25
    -  stage: prepare
    
    26
    -  script:
    
    27
    -
    
    28
    -  # Generate the source distribution tarball
    
    29
    -  #
    
    30
    -  - python3 setup.py sdist
    
    31
    -  - tar -ztf dist/*
    
    32
    -  - tarball=$(cd dist && echo $(ls *))
    
    33
    -
    
    34
    -  # Verify that the source distribution tarball can be installed correctly
    
    35
    -  #
    
    36
    -  - pip3 install dist/*.tar.gz
    
    37
    -  - bst --version
    
    38
    -
    
    39
    -  # unpack tarball as `dist/buildstream` directory
    
    40
    -  - |
    
    41
    -    cat > dist/unpack.sh << EOF
    
    42
    -    #!/bin/sh
    
    43
    -    tar -zxf ${tarball}
    
    44
    -    mv ${tarball%.tar.gz} buildstream
    
    45
    -    EOF
    
    46
    -
    
    47
    -  # Make our helpers executable
    
    48
    -  - chmod +x dist/unpack.sh
    
    49
    -  artifacts:
    
    50
    -    paths:
    
    51
    -    - dist/
    
    52
    -
    
    53 17
     
    
    54 18
     #####################################################
    
    55 19
     #                    Test stage                     #
    
    ... ... @@ -72,8 +36,7 @@ source_dist:
    72 36
       - useradd -Um buildstream
    
    73 37
       - chown -R buildstream:buildstream .
    
    74 38
     
    
    75
    -  # Run the tests from the source distribution, We run as a simple
    
    76
    -  # user to test for permission issues
    
    39
    +  # Run the tests as a simple user to test for permission issues
    
    77 40
       - su buildstream -c "${TEST_COMMAND}"
    
    78 41
     
    
    79 42
       after_script:
    
    ... ... @@ -192,7 +155,8 @@ docs:
    192 155
         scheduler:
    
    193 156
           fetchers: 2
    
    194 157
         EOF
    
    195
    -  - (cd dist && ./unpack.sh && cd buildstream && pip3 install .)
    
    158
    +  - pip3 install -r requirements/requirements.txt -r requirements/dev-requirements.txt
    
    159
    +  - pip3 install --no-index .
    
    196 160
       - pip3 install --user -e ${BST_EXT_URL}@${BST_EXT_REF}#egg=bst_ext
    
    197 161
       - git clone https://gitlab.com/freedesktop-sdk/freedesktop-sdk.git
    
    198 162
       - git -C freedesktop-sdk checkout ${FD_SDK_REF}
    
    ... ... @@ -275,22 +239,19 @@ coverage:
    275 239
       stage: post
    
    276 240
       coverage: '/TOTAL +\d+ +\d+ +(\d+\.\d+)%/'
    
    277 241
       script:
    
    278
    -    - cd dist && ./unpack.sh && cd buildstream
    
    279
    -    - pip3 install -r tools/requirements.txt -r tools/dev-requirements.txt
    
    280
    -    - pip3 install --no-index .
    
    242
    +    - pip3 install -r requirements/dev-requirements.txt
    
    281 243
         - mkdir report
    
    282 244
         - cd report
    
    283
    -    - cp ../../../coverage-unix/coverage.* .
    
    284
    -    - cp ../../../coverage-linux/coverage.* .
    
    245
    +    - cp ../coverage-unix/coverage.* .
    
    246
    +    - cp ../coverage-linux/coverage.* .
    
    285 247
         - ls coverage.*
    
    286
    -    - coverage combine --rcfile=../.coveragerc -a coverage.*
    
    287
    -    - coverage report --rcfile=../.coveragerc -m
    
    248
    +    - coverage combine -a coverage.*
    
    249
    +    - coverage report -m
    
    288 250
       dependencies:
    
    289 251
       - tests-debian-9
    
    290 252
       - tests-fedora-27
    
    291 253
       - tests-fedora-28
    
    292 254
       - tests-unix
    
    293
    -  - source_dist
    
    294 255
       except:
    
    295 256
       - schedules
    
    296 257
     
    
    ... ... @@ -299,7 +260,6 @@ coverage:
    299 260
     pages:
    
    300 261
       stage: post
    
    301 262
       dependencies:
    
    302
    -  - source_dist
    
    303 263
       - docs
    
    304 264
       variables:
    
    305 265
         ACME_DIR: public/.well-known/acme-challenge
    

  • CONTRIBUTING.rst
    ... ... @@ -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

  • MANIFEST.in
    ... ... @@ -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

  • buildstream/_frontend/cli.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':
    

  • requirements/Makefile
    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)

  • tools/dev-requirements.inrequirements/dev-requirements.in

  • tools/dev-requirements.txtrequirements/dev-requirements.txt

  • tools/plugin-requirements.inrequirements/plugin-requirements.in

  • tools/plugin-requirements.txtrequirements/plugin-requirements.txt

  • tools/requirements.inrequirements/requirements.in

  • tools/requirements.txtrequirements/requirements.txt

  • setup.py
    ... ... @@ -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
     #####################################################
    

  • tox.ini
    ... ... @@ -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
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]