You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:39:14 UTC

[buildstream] branch sam/meson created (now 23a2abe)

This is an automated email from the ASF dual-hosted git repository.

root pushed a change to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 23a2abe  Update HACKING.rst for Meson changes

This branch includes the following new commits:

     new 8ae7319  Add Meson build instructions
     new 852f23c  meson: Add dependency checks
     new ca2e53f  meson: Set version number at configure time
     new c025f0e  Only import pkg_resources when looking for plugins with Pip
     new 48cf26d  meson: Print message before setuptools check
     new f8764fd  meson: Make sure importing from the source tree still works
     new 2c21203  meson: Integrate manpage generation
     new 9da8c81  meson: Add bst-artifact-receive hook
     new d376eb6  meson: Install Bash completions
     new 79eca1e  Document Meson installation instructions
     new 7003547  Fix version numbering when uninstalled
     new 9f7ba54  meson: Add support for running the test suite through `meson test`
     new 62ebd00  Remove old setuptools build system
     new 8dd53a2  meson: Fix `ninja dist` target
     new 11ffa04  meson: Only install bash completion when it's enabled
     new 0593189  Remove MANIFEST.in
     new 23a2abe  Update HACKING.rst for Meson changes

The 17 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 17/17: Update HACKING.rst for Meson changes

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 23a2abe1560722a4b0f2079f15983f001c84bd19
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 16:18:01 2017 +0000

    Update HACKING.rst for Meson changes
---
 HACKING.rst | 90 ++++++++++++++++++++++---------------------------------------
 1 file changed, 32 insertions(+), 58 deletions(-)

diff --git a/HACKING.rst b/HACKING.rst
index 15df58a..4d55622 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -7,18 +7,31 @@ Getting Started
 ---------------
 After cloning the BuildStream module with git, you will want a development installation.
 
-To do this, first install ``pip`` and run the following command in the buildstream
-checkout directory::
+First install it with Meson as normal into a location of your choice, for
+example /opt/buildstream.
 
-  pip install --user -e .
+  sudo mkdir /opt/buildstream
+  sudo chown $USER:$USER /opt/buildstream
+  mkdir build
+  meson .. --prefix=/opt/buildstream -Dbash_completion=no
+  ninja install
+
+You should now be able to run ``/opt/buildstream/bin/bst``. You will probably
+want to add ``/opt/buildstream/bin`` to your PATH as part of your shell's
+startup file.
 
-The above will install some dependencies and also a symlink to your buildstream checkout
-in your local user's python environment, so any changes you make to buildstream will be
-effective for your user.
+Feel free to enable the bash_completion option, but you will need to run
+`ninja install` as root in that case.
 
-You can later uninstall the local installation by running::
+Every time you make a change to the BuildStream source code you will need
+to rerun `ninja install`. This can be avoided by replacing the installed
+module with a symlink to your source directory (similar to the `pip -e`
+feature of Pip). Here is an example command to do this. The exact paths
+will depend on your OS and Python version. Run it from the top of your
+buildstream.git checkout.
 
-  pip uninstall buildstream
+  rm -R /opt/buildstream/lib64/python3.6/site-packages/buildstream
+  ln -s `pwd`/buildstream /opt/buildstream/lib64/python3.6/site-packages/buildstream
 
 
 Coding Style
@@ -141,27 +154,6 @@ Finally, to build the current set of docs, just run the following::
 This will give you a build/html directory with the html docs.
 
 
-Man Pages
-~~~~~~~~~
-Unfortunately it is quite difficult to integrate the man pages build
-into the ``setup.py``, as such, whenever the frontend command line
-interface changes, the static man pages should be regenerated and
-committed with that.
-
-To do this, first ensure you have ``click_man`` installed, possibly
-with::
-
-  pip install --user click_man
-
-Then, in the toplevel directory of buildstream, run the following::
-
-  python3 setup.py --command-packages=click_man.commands man_pages
-
-And commit the result, ensuring that you have added anything in
-the ``man/`` subdirectory, which will be automatically included
-in the buildstream distribution.
-
-
 Documenting Conventions
 ~~~~~~~~~~~~~~~~~~~~~~~
 When adding a new class to the buildstream core, an entry referring to
@@ -203,36 +195,34 @@ Don't get lost in the docs if you don't need to, follow existing examples instea
 
 Running Tests
 ~~~~~~~~~~~~~
-To run the tests, just type::
+To run the tests, just type this in the build directory::
 
-  ./setup.py test
-
-At the toplevel.
+  meson test
 
 When debugging a test, it can be desirable to see the stdout
-and stderr generated by a test, to do this use the --addopts
-function to feed arguments to pytest as such::
+and stderr generated by a test, to do this use the --verbose
+option:
 
-  ./setup.py test --addopts -s
+  meson test --verbose
 
-You can always abort on the first failure by running::
+In order to pass in extra arguments to Pytest, set the PYTEST_ARGS
+environment variable. For example, to abort on the first failure
+you can run::
 
-  ./setup.py test --addopts -x
+  PYTEST_ADDOPTS=-x meson test --verbose
 
 If you want to run a specific test or a group of tests, you
 can specify a prefix to match. E.g. if you want to run all of
 the frontend tests you can do::
 
-  ./setup.py test --addopts '-k tests/frontend/'
+  PYTEST_ADDOPTS='-k tests/frontend' meson test --verbose
 
 
 Adding Tests
 ~~~~~~~~~~~~
 Tests are found in the tests subdirectory, inside of which
 there is a separarate directory for each *domain* of tests.
-All tests are collected as::
-
-  tests/*/*.py
+The list of tests in maintained in ``tests/meson.build``.
 
 If the new test is not appropriate for the existing test domains,
 then simply create a new directory for it under the tests subdirectory.
@@ -245,19 +235,3 @@ When creating a test that needs data, use the datafiles extension
 to decorate your test case (again, examples exist in the existing
 tests for this), documentation on the datafiles extension can
 be found here: https://pypi.python.org/pypi/pytest-datafiles
-
-
-The MANIFEST.in and setup.py
-----------------------------
-When adding a dependency to BuildStream, it's important to update the setup.py accordingly.
-
-When adding data files which need to be discovered at runtime by BuildStream, it's important
-update setup.py accordingly.
-
-When adding data files for the purpose of docs or tests, or anything that is not covered by
-setup.py, it's important to update the MANIFEST.in accordingly.
-
-At any time, running the following command to create a source distribution should result in
-creating a tarball which contains everything we want it to include::
-
-  ./setup.py sdist


[buildstream] 11/17: Fix version numbering when uninstalled

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 7003547dad62d9007fabfca4774915d587acae68
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 13:41:29 2017 +0000

    Fix version numbering when uninstalled
    
    This unbreaks the test suite, in particular.
---
 buildstream/__init__.py | 2 +-
 buildstream/utils.py    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/buildstream/__init__.py b/buildstream/__init__.py
index 4b3b94b..ff38beb 100644
--- a/buildstream/__init__.py
+++ b/buildstream/__init__.py
@@ -29,4 +29,4 @@ from .scriptelement import ScriptElement
 try:
     from .version import VERSION
 except ImportError:
-    VERSION = '(uninstalled)'
+    VERSION = '0.0.0 (uninstalled)'
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 41d38f8..8b57b60 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -46,7 +46,7 @@ from ._exceptions import ProgramNotFoundError
 try:
     from .version import VERSION
 except ImportError:
-    VERSION = '(uninstalled)'
+    VERSION = '0.0.0 (uninstalled)'
 
 
 class FileListResult():


[buildstream] 07/17: meson: Integrate manpage generation

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 2c2120371964146d5421305747b179a1058002bf
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 17:59:49 2017 +0000

    meson: Integrate manpage generation
---
 man/bst-artifact-receive.1 |  16 ------
 man/bst-build.1            |  18 -------
 man/bst-checkout.1         |  16 ------
 man/bst-fetch.1            |  33 -------------
 man/bst-pull.1             |  21 --------
 man/bst-push.1             |  21 --------
 man/bst-shell.1            |  32 ------------
 man/bst-show.1             |  69 --------------------------
 man/bst-source-bundle.1    |  27 ----------
 man/bst-track.1            |  28 -----------
 man/bst-workspace-close.1  |  18 -------
 man/bst-workspace-list.1   |   8 ---
 man/bst-workspace-open.1   |  24 ---------
 man/bst-workspace-reset.1  |  21 --------
 man/bst-workspace.1        |  28 -----------
 man/bst.1                  | 119 ---------------------------------------------
 man/click-man-wrapper      |  31 ++++++++++++
 man/meson.build            |  30 ++++++++++++
 meson.build                |   2 +
 19 files changed, 63 insertions(+), 499 deletions(-)

diff --git a/man/bst-artifact-receive.1 b/man/bst-artifact-receive.1
deleted file mode 100644
index 8054e68..0000000
--- a/man/bst-artifact-receive.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH "BST-ARTIFACT-RECEIVE" "1" "10-Sep-2017" "" "bst-artifact-receive Manual"
-.SH NAME
-bst-artifact-receive \- Receive pushed artifacts over ssh
-.SH SYNOPSIS
-.B bst-artifact-receive
-[OPTIONS] REPO
-.SH DESCRIPTION
-A BuildStream sister program for receiving artifacts send to a shared artifact cache
-    
-.SH OPTIONS
-.TP
-\fB\-v,\fP \-\-verbose
-Verbose mode
-.TP
-\fB\-d,\fP \-\-debug
-Debug mode
\ No newline at end of file
diff --git a/man/bst-build.1 b/man/bst-build.1
deleted file mode 100644
index d22d178..0000000
--- a/man/bst-build.1
+++ /dev/null
@@ -1,18 +0,0 @@
-.TH "BST BUILD" "1" "10-Sep-2017" "" "bst build Manual"
-.SH NAME
-bst\-build \- Build elements in a pipeline
-.SH SYNOPSIS
-.B bst build
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Build elements in a pipeline
-.SH OPTIONS
-.TP
-\fB\-\-all\fP
-Build elements that would not be needed for the current build plan
-.TP
-\fB\-\-track\fP
-Track new source references before building (implies --all)
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-checkout.1 b/man/bst-checkout.1
deleted file mode 100644
index 6fb64ce..0000000
--- a/man/bst-checkout.1
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH "BST CHECKOUT" "1" "10-Sep-2017" "" "bst checkout Manual"
-.SH NAME
-bst\-checkout \- Checkout a built artifact
-.SH SYNOPSIS
-.B bst checkout
-[OPTIONS] TARGET DIRECTORY
-.SH DESCRIPTION
-Checkout a built artifact to the specified directory
-    
-.SH OPTIONS
-.TP
-\fB\-f,\fP \-\-force
-Overwrite files existing in checkout directory
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-fetch.1 b/man/bst-fetch.1
deleted file mode 100644
index 046549b..0000000
--- a/man/bst-fetch.1
+++ /dev/null
@@ -1,33 +0,0 @@
-.TH "BST FETCH" "1" "10-Sep-2017" "" "bst fetch Manual"
-.SH NAME
-bst\-fetch \- Fetch sources in a pipeline
-.SH SYNOPSIS
-.B bst fetch
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Fetch sources required to build the pipeline
-
-By default this will only try to fetch sources which are
-required for the build plan of the specified target element,
-omitting sources for any elements which are already built
-and available in the artifact cache.
-
-Specify `--deps` to control which sources to fetch:
-
-
-    none:  No dependencies, just the element itself
-    plan:  Only dependencies required for the build plan
-    all:   All dependencies
-.SH OPTIONS
-.TP
-\fB\-\-except\fP TEXT
-Except certain dependencies from fetching
-.TP
-\fB\-d,\fP \-\-deps [none|plan|all]
-The dependencies to fetch (default: plan)
-.TP
-\fB\-\-track\fP
-Track new source references before fetching
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-pull.1 b/man/bst-pull.1
deleted file mode 100644
index fe66a66..0000000
--- a/man/bst-pull.1
+++ /dev/null
@@ -1,21 +0,0 @@
-.TH "BST PULL" "1" "10-Sep-2017" "" "bst pull Manual"
-.SH NAME
-bst\-pull \- Pull a built artifact
-.SH SYNOPSIS
-.B bst pull
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Pull a built artifact from the configured remote artifact cache.
-
-Specify `--deps` to control which artifacts to pull:
-
-
-    none:  No dependencies, just the element itself
-    all:   All dependencies
-.SH OPTIONS
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
-.TP
-\fB\-d,\fP \-\-deps [none|all]
-The dependency artifacts to pull (default: none)
\ No newline at end of file
diff --git a/man/bst-push.1 b/man/bst-push.1
deleted file mode 100644
index a68eb5d..0000000
--- a/man/bst-push.1
+++ /dev/null
@@ -1,21 +0,0 @@
-.TH "BST PUSH" "1" "10-Sep-2017" "" "bst push Manual"
-.SH NAME
-bst\-push \- Push a built artifact
-.SH SYNOPSIS
-.B bst push
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Push a built artifact to the configured remote artifact cache.
-
-Specify `--deps` to control which artifacts to push:
-
-
-    none:  No dependencies, just the element itself
-    all:   All dependencies
-.SH OPTIONS
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
-.TP
-\fB\-d,\fP \-\-deps [none|all]
-The dependencies to push (default: none)
\ No newline at end of file
diff --git a/man/bst-shell.1 b/man/bst-shell.1
deleted file mode 100644
index 7c53ff1..0000000
--- a/man/bst-shell.1
+++ /dev/null
@@ -1,32 +0,0 @@
-.TH "BST SHELL" "1" "10-Sep-2017" "" "bst shell Manual"
-.SH NAME
-bst\-shell \- Shell into an element's sandbox environment
-.SH SYNOPSIS
-.B bst shell
-[OPTIONS] TARGET [COMMAND]...
-.SH DESCRIPTION
-Run a command in the target element's sandbox environment
-
-This will first stage a temporary sysroot for running
-the target element, assuming it has already been built
-and all required artifacts are in the local cache.
-
-Use the --build option to create a temporary sysroot for
-building the element instead.
-
-Use the --sysroot option with an existing failed build
-directory or with a checkout of the given target, in order
-to use a specific sysroot.
-
-If no COMMAND is specified, the default is to attempt
-to run an interactive shell with `sh -i`.
-.SH OPTIONS
-.TP
-\fB\-b,\fP \-\-build
-Create a build sandbox
-.TP
-\fB\-s,\fP \-\-sysroot DIRECTORY
-An existing sysroot
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-show.1 b/man/bst-show.1
deleted file mode 100644
index 8d1e5ab..0000000
--- a/man/bst-show.1
+++ /dev/null
@@ -1,69 +0,0 @@
-.TH "BST SHOW" "1" "10-Sep-2017" "" "bst show Manual"
-.SH NAME
-bst\-show \- Show elements in the pipeline
-.SH SYNOPSIS
-.B bst show
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Show elements in the pipeline
-
-By default this will show all of the dependencies of the
-specified target element.
-
-Specify `--deps` to control which elements to show:
-
-
-    none:  No dependencies, just the element itself
-    plan:  Dependencies required for a build plan
-    run:   Runtime dependencies, including the element itself
-    build: Build time dependencies, excluding the element itself
-    all:   All dependencies
-
-
-FORMAT
-~~~~~~
-The --format option controls what should be printed for each element,
-the following symbols can be used in the format string:
-
-
-    %{name}           The element name
-    %{variant}        The selected element variant
-    %{key}            The abbreviated cache key (if all sources are consistent)
-    %{full-key}       The full cache key (if all sources are consistent)
-    %{state}          cached, buildable, waiting or inconsistent
-    %{config}         The element configuration
-    %{vars}           Variable configuration
-    %{env}            Environment settings
-    %{public}         Public domain data
-    %{workspaced}     If the element is workspaced
-    %{workspace-dirs} A list of workspace directories
-
-The value of the %{symbol} without the leading '%' character is understood
-as a pythonic formatting string, so python formatting features apply,
-examle:
-
-
-    bst show target.bst --format \
-        'Name: %{name: ^20} Key: %{key: ^8} State: %{state}'
-
-If you want to use a newline in a format string in bash, use the '$' modifier:
-
-
-    bst show target.bst --format \
-        $'---------- %{name} ----------\n%{vars}'
-.SH OPTIONS
-.TP
-\fB\-\-except\fP TEXT
-Except certain dependencies
-.TP
-\fB\-d,\fP \-\-deps [none|plan|run|build|all]
-The dependencies to show (default: all)
-.TP
-\fB\-\-order\fP [stage|alpha]
-Staging or alphabetic ordering of dependencies
-.TP
-\fB\-f,\fP \-\-format FORMAT
-Format string for each element
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-source-bundle.1 b/man/bst-source-bundle.1
deleted file mode 100644
index 28a61c8..0000000
--- a/man/bst-source-bundle.1
+++ /dev/null
@@ -1,27 +0,0 @@
-.TH "BST SOURCE-BUNDLE" "1" "10-Sep-2017" "" "bst source-bundle Manual"
-.SH NAME
-bst\-source-bundle \- Produce a build bundle to be manually executed
-.SH SYNOPSIS
-.B bst source-bundle
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Produce a source bundle to be manually executed
-.SH OPTIONS
-.TP
-\fB\-\-except\fP TEXT
-Elements to except from the tarball
-.TP
-\fB\-\-compression\fP [none|gz|bz2|xz]
-Compress the tar file using the given algorithm.
-.TP
-\fB\-\-track\fP
-Track new source references before building
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
-.TP
-\fB\-f,\fP \-\-force
-Overwrite files existing in checkout directory
-.TP
-\fB\-\-directory\fP TEXT
-The directory to write the tarball to
\ No newline at end of file
diff --git a/man/bst-track.1 b/man/bst-track.1
deleted file mode 100644
index 3c6f963..0000000
--- a/man/bst-track.1
+++ /dev/null
@@ -1,28 +0,0 @@
-.TH "BST TRACK" "1" "10-Sep-2017" "" "bst track Manual"
-.SH NAME
-bst\-track \- Track new source references
-.SH SYNOPSIS
-.B bst track
-[OPTIONS] TARGET
-.SH DESCRIPTION
-Consults the specified tracking branches for new versions available
-to build and updates the project with any newly available references.
-
-By default this will track just the specified element, but you can also
-update a whole tree of dependencies in one go.
-
-Specify `--deps` to control which sources to track:
-
-
-    none:  No dependencies, just the element itself
-    all:   All dependencies
-.SH OPTIONS
-.TP
-\fB\-\-except\fP TEXT
-Except certain dependencies from tracking
-.TP
-\fB\-d,\fP \-\-deps [none|all]
-The dependencies to track (default: none)
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-workspace-close.1 b/man/bst-workspace-close.1
deleted file mode 100644
index 8d889c3..0000000
--- a/man/bst-workspace-close.1
+++ /dev/null
@@ -1,18 +0,0 @@
-.TH "BST WORKSPACE CLOSE" "1" "10-Sep-2017" "" "bst workspace close Manual"
-.SH NAME
-bst\-workspace\-close \- Close a workspace
-.SH SYNOPSIS
-.B bst workspace close
-[OPTIONS] ELEMENT
-.SH DESCRIPTION
-Close a workspace
-.SH OPTIONS
-.TP
-\fB\-s,\fP \-\-source INDEX
-The source of the workspace to remove. Projects with one source may omit this
-.TP
-\fB\-\-remove\-dir\fP
-Remove the path that contains the closed workspace
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-workspace-list.1 b/man/bst-workspace-list.1
deleted file mode 100644
index e44a496..0000000
--- a/man/bst-workspace-list.1
+++ /dev/null
@@ -1,8 +0,0 @@
-.TH "BST WORKSPACE LIST" "1" "10-Sep-2017" "" "bst workspace list Manual"
-.SH NAME
-bst\-workspace\-list \- List open workspaces
-.SH SYNOPSIS
-.B bst workspace list
-[OPTIONS]
-.SH DESCRIPTION
-List open workspaces
\ No newline at end of file
diff --git a/man/bst-workspace-open.1 b/man/bst-workspace-open.1
deleted file mode 100644
index 35a4731..0000000
--- a/man/bst-workspace-open.1
+++ /dev/null
@@ -1,24 +0,0 @@
-.TH "BST WORKSPACE OPEN" "1" "10-Sep-2017" "" "bst workspace open Manual"
-.SH NAME
-bst\-workspace\-open \- Open a new workspace
-.SH SYNOPSIS
-.B bst workspace open
-[OPTIONS] ELEMENT DIRECTORY
-.SH DESCRIPTION
-Open a workspace for manual source modification
-.SH OPTIONS
-.TP
-\fB\-\-no\-checkout\fP
-Do not checkout the source, only link to the given directory
-.TP
-\fB\-f,\fP \-\-force
-Overwrite files existing in checkout directory
-.TP
-\fB\-s,\fP \-\-source INDEX
-The source to create a workspace for. Projects with one source may omit this
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
-.TP
-\fB\-\-track\fP
-Track and fetch new source references before checking out the workspace
\ No newline at end of file
diff --git a/man/bst-workspace-reset.1 b/man/bst-workspace-reset.1
deleted file mode 100644
index fd08bba..0000000
--- a/man/bst-workspace-reset.1
+++ /dev/null
@@ -1,21 +0,0 @@
-.TH "BST WORKSPACE RESET" "1" "10-Sep-2017" "" "bst workspace reset Manual"
-.SH NAME
-bst\-workspace\-reset \- Reset a workspace to its original state
-.SH SYNOPSIS
-.B bst workspace reset
-[OPTIONS] ELEMENT
-.SH DESCRIPTION
-Reset a workspace to its original state
-.SH OPTIONS
-.TP
-\fB\-s,\fP \-\-source INDEX
-The source of the workspace to reset. Projects with one source may omit this
-.TP
-\fB\-\-track\fP
-Track and fetch the latest source before resetting
-.TP
-\fB\-\-no\-checkout\fP
-Do not checkout the source, only link to the given directory
-.TP
-\fB\-\-variant\fP TEXT
-A variant of the specified target
\ No newline at end of file
diff --git a/man/bst-workspace.1 b/man/bst-workspace.1
deleted file mode 100644
index faf61b9..0000000
--- a/man/bst-workspace.1
+++ /dev/null
@@ -1,28 +0,0 @@
-.TH "BST WORKSPACE" "1" "10-Sep-2017" "" "bst workspace Manual"
-.SH NAME
-bst\-workspace \- Manipulate developer workspaces
-.SH SYNOPSIS
-.B bst workspace
-[OPTIONS] COMMAND [ARGS]...
-.SH DESCRIPTION
-Manipulate developer workspaces
-.SH COMMANDS
-.PP
-\fBopen\fP
-  Open a new workspace
-  See \fBbst workspace-open(1)\fP for full documentation on the \fBopen\fP command.
-
-.PP
-\fBlist\fP
-  List open workspaces
-  See \fBbst workspace-list(1)\fP for full documentation on the \fBlist\fP command.
-
-.PP
-\fBclose\fP
-  Close a workspace
-  See \fBbst workspace-close(1)\fP for full documentation on the \fBclose\fP command.
-
-.PP
-\fBreset\fP
-  Reset a workspace to its original state
-  See \fBbst workspace-reset(1)\fP for full documentation on the \fBreset\fP command.
diff --git a/man/bst.1 b/man/bst.1
deleted file mode 100644
index 783b74a..0000000
--- a/man/bst.1
+++ /dev/null
@@ -1,119 +0,0 @@
-.TH "BST" "1" "10-Sep-2017" "" "bst Manual"
-.SH NAME
-bst \- Build and manipulate BuildStream projects...
-.SH SYNOPSIS
-.B bst
-[OPTIONS] COMMAND [ARGS]...
-.SH DESCRIPTION
-Build and manipulate BuildStream projects
-
-Most of the main options override options in the
-user preferences configuration file.
-.SH OPTIONS
-.TP
-\fB\-\-version\fP
-Show the version and exit.
-.TP
-\fB\-c,\fP \-\-config PATH
-Configuration file to use
-.TP
-\fB\-C,\fP \-\-directory DIRECTORY
-Project directory (default: current directory)
-.TP
-\fB\-\-on\-error\fP [continue|quit|terminate]
-What to do when an error is encountered
-.TP
-\fB\-\-fetchers\fP INTEGER
-Maximum simultaneous download tasks
-.TP
-\fB\-\-builders\fP INTEGER
-Maximum simultaneous build tasks
-.TP
-\fB\-\-pushers\fP INTEGER
-Maximum simultaneous upload tasks
-.TP
-\fB\-\-network\-retries\fP INTEGER
-Maximum retries for network tasks
-.TP
-\fB\-\-no\-interactive\fP
-Force non interactive mode, otherwise this is automatically decided
-.TP
-\fB\-\-verbose\fP / \-\-no\-verbose
-Be extra verbose
-.TP
-\fB\-\-debug\fP / \-\-no\-debug
-Print debugging output
-.TP
-\fB\-\-error\-lines\fP INTEGER
-Maximum number of lines to show from a task log
-.TP
-\fB\-\-message\-lines\fP INTEGER
-Maximum number of lines to show in a detailed message
-.TP
-\fB\-\-log\-file\fP FILENAME
-A file to store the main log (allows storing the main log while in interactive mode)
-.TP
-\fB\-\-colors\fP / \-\-no\-colors
-Force enable/disable ANSI color codes in output
-.TP
-\fB\-a,\fP \-\-arch TEXT
-Machine architecture (default: x86_64)
-.TP
-\fB\-\-host\-arch\fP TEXT
-Machine architecture for the sandbox (defaults to --arch)
-.TP
-\fB\-\-target\-arch\fP TEXT
-Machine architecture for build output (defaults to --arch)
-.TP
-\fB\-\-strict\fP / \-\-no\-strict
-Elements must be rebuilt when their dependencies have changed
-.SH COMMANDS
-.PP
-\fBbuild\fP
-  Build elements in a pipeline
-  See \fBbst-build(1)\fP for full documentation on the \fBbuild\fP command.
-
-.PP
-\fBshell\fP
-  Shell into an element's sandbox environment
-  See \fBbst-shell(1)\fP for full documentation on the \fBshell\fP command.
-
-.PP
-\fBcheckout\fP
-  Checkout a built artifact
-  See \fBbst-checkout(1)\fP for full documentation on the \fBcheckout\fP command.
-
-.PP
-\fBfetch\fP
-  Fetch sources in a pipeline
-  See \fBbst-fetch(1)\fP for full documentation on the \fBfetch\fP command.
-
-.PP
-\fBworkspace\fP
-  Manipulate developer workspaces
-  See \fBbst-workspace(1)\fP for full documentation on the \fBworkspace\fP command.
-
-.PP
-\fBpull\fP
-  Pull a built artifact
-  See \fBbst-pull(1)\fP for full documentation on the \fBpull\fP command.
-
-.PP
-\fBshow\fP
-  Show elements in the pipeline
-  See \fBbst-show(1)\fP for full documentation on the \fBshow\fP command.
-
-.PP
-\fBsource-bundle\fP
-  Produce a build bundle to be manually executed
-  See \fBbst-source-bundle(1)\fP for full documentation on the \fBsource-bundle\fP command.
-
-.PP
-\fBpush\fP
-  Push a built artifact
-  See \fBbst-push(1)\fP for full documentation on the \fBpush\fP command.
-
-.PP
-\fBtrack\fP
-  Track new source references
-  See \fBbst-track(1)\fP for full documentation on the \fBtrack\fP command.
diff --git a/man/click-man-wrapper b/man/click-man-wrapper
new file mode 100644
index 0000000..70ccd90
--- /dev/null
+++ b/man/click-man-wrapper
@@ -0,0 +1,31 @@
+# click_man is designed to be used only with setuptools.
+# As we don't use setuptools, we need a wrapper to integrate it with Meson.
+
+
+import click_man.core
+
+import sys
+
+import buildstream._frontend
+import buildstream._artifactcache.pushreceive
+
+
+def main():
+    if len(sys.argv) != 2:
+        raise RuntimeError("Usage: {} OUTPUT_DIR".format(sys.argv[0]))
+
+    output_directory = sys.argv[1]
+
+    click_man.core.write_man_pages(name='bst',
+                                   cli=buildstream._frontend.cli,
+                                   target_dir=output_directory)
+    click_man.core.write_man_pages(name='bst-artifact-receive',
+                                   cli=buildstream._artifactcache.pushreceive.receive_main,
+                                   target_dir=output_directory)
+
+
+try:
+    main()
+except RuntimeError as e:
+    sys.stderr.write("{}\n".format(e))
+    sys.exit(1)
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..857a356
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,30 @@
+# FIXME: having to hardcode all the names that click-man will generate is
+# fragile and annoying
+
+manpages = [
+  'bst.1',
+  'bst-artifact-receive.1',
+  'bst-build.1',
+  'bst-checkout.1',
+  'bst-fetch.1',
+  'bst-pull.1',
+  'bst-push.1',
+  'bst-shell.1',
+  'bst-show.1',
+  'bst-source-bundle.1',
+  'bst-track.1',
+  'bst-workspace.1',
+  'bst-workspace-close.1',
+  'bst-workspace-list.1',
+  'bst-workspace-open.1',
+  'bst-workspace-reset.1',
+]
+
+click_man_wrapper = join_paths(meson.current_source_dir(), 'click-man-wrapper')
+
+custom_target('manpages',
+  command: [python, click_man_wrapper, '@OUTDIR@'],
+  output: manpages,
+  install: true,
+  install_dir: get_option('mandir'),
+)
diff --git a/meson.build b/meson.build
index f7649fb..6dc56b9 100644
--- a/meson.build
+++ b/meson.build
@@ -42,6 +42,7 @@ endif
 install_requires = [
   'blessings',
   'Click',
+  'click-man',
   'jinja2',
   'pluginbase',
   'psutil',
@@ -133,3 +134,4 @@ cdata.set('package_version', package_version)
 cdata.set('pythondir', python_site_packages_dir)
 
 subdir('buildstream')
+subdir('man')


[buildstream] 05/17: meson: Print message before setuptools check

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 48cf26d8d1e51f5e722f24b72de9aefd453b3720
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 17:59:41 2017 +0000

    meson: Print message before setuptools check
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index e4f8f9b..f7649fb 100644
--- a/meson.build
+++ b/meson.build
@@ -32,7 +32,7 @@ endif
 
 # FIXME: We check manually for our Python dependencies as Meson doesn't
 # support doing so yet. See https://github.com/mesonbuild/meson/issues/2377
-
+message('Checking for setuptools (for pkg_resources)')
 setuptools_check = run_command(python, '-c', 'import pkg_resources')
 if setuptools_check.returncode() != 0
   error('Python Setuptools was not found; the pkg_resources module is required.\n' +


[buildstream] 10/17: Document Meson installation instructions

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 79eca1e592271c56c0ad71b0fecba9f949078d73
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 18:55:05 2017 +0000

    Document Meson installation instructions
---
 doc/source/install.rst | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/doc/source/install.rst b/doc/source/install.rst
index 45beb71..f50e228 100644
--- a/doc/source/install.rst
+++ b/doc/source/install.rst
@@ -27,7 +27,8 @@ this package so we recommend installing it with your package manager first.
 For the purpose of installing BuildStream while there are no distro packages,
 you will additionally need:
 
-* pip for python3 (only required for setup)
+* Meson
+* Ninja
 * Python 3 development libraries and headers
 * git (to checkout buildstream)
 
@@ -83,17 +84,20 @@ requirements you need::
                  python3-psutil ostree
 
 
-User installation with pip
+User installation with Meson
 --------------------------
 Once you have the base system dependencies, you can clone the buildstream
 git repository and install it as a regular user::
 
   git clone https://gitlab.com/BuildStream/buildstream.git
   cd buildstream
-  pip3 install --user .
+  mkdir build
+  cd build
+  meson .. --prefix=$HOME/.local -Dbash_completion=no
+  ninja install
 
-This will install buildstream and it's pure python dependencies directly into
-your user's homedir in ``~/.local``
+This will install buildstream and its pure python dependencies directly into
+your user's homedir in ``$HOME/.local``.
 
 
 Adjust PATH
@@ -121,12 +125,12 @@ to your ``~/.bash_completion``:
    :language: yaml
 
 
-Upgrading with pip
+Upgrading with Meson
 ~~~~~~~~~~~~~~~~~~
 To upgrade a previously install BuildStream, you will need to pull the latest
-changes and reinstall as such::
+changes and rerun ``ninja install`` from the build/ directory.
 
-  pip3 uninstall buildstream
   cd buildstream
   git pull --rebase
-  pip3 install --user .
+  cd build
+  ninja install


[buildstream] 16/17: Remove MANIFEST.in

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 05931894e7a578faa3081d9f9775876fcde5a779
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 16:06:16 2017 +0000

    Remove MANIFEST.in
    
    It's another setuptools thing.
---
 MANIFEST.in | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 7647e69..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,19 +0,0 @@
-# Basic toplevel package includes
-include README.rst
-include HACKING.rst
-include COPYING
-include Dockerfile
-include Dockerfile-build.sh
-
-# Documentation package includes
-include doc/Makefile
-include doc/source/conf.py
-include doc/source/index.rst
-
-# Tests
-recursive-include tests *.py
-recursive-include tests *.yaml
-recursive-include tests *.bst
-recursive-include tests *.conf
-recursive-include tests *.sh
-recursive-include tests *.expected


[buildstream] 04/17: Only import pkg_resources when looking for plugins with Pip

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c025f0e486d317a9ebe76a1f1ba98755e652f1e9
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 15:12:06 2017 +0000

    Only import pkg_resources when looking for plugins with Pip
    
    There is a cost to importing pkg_resources, so we should only do it when
    necessary.
---
 buildstream/_plugincontext.py |  5 ++++-
 meson-python-packages-check   | 24 +++++++++++++++++++++++
 meson.build                   | 44 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/buildstream/_plugincontext.py b/buildstream/_plugincontext.py
index 1759333..290cd57 100644
--- a/buildstream/_plugincontext.py
+++ b/buildstream/_plugincontext.py
@@ -20,7 +20,6 @@
 
 import os
 import inspect
-import pkg_resources
 
 from ._exceptions import PluginError
 from . import utils
@@ -82,6 +81,10 @@ class PluginContext():
         return source
 
     def _get_pip_plugin_source(self, package_name, kind):
+        # Importing pkg_resources can be a slow operation (see:
+        # https://github.com/pypa/setuptools/issues/510) so we only do it when
+        # needed.
+        import pkg_resources
         defaults = None
         if ('pip', package_name) not in self.alternate_sources:
             # key by a tuple to avoid collision
diff --git a/meson-python-packages-check b/meson-python-packages-check
new file mode 100644
index 0000000..59bfe0c
--- /dev/null
+++ b/meson-python-packages-check
@@ -0,0 +1,24 @@
+# Script to detect if a Python module requirement is satisfied.
+#
+# This should be handled by Meson instead of requiring a script, see:
+# https://github.com/mesonbuild/meson/issues/2377
+
+import pkg_resources
+
+import sys
+
+requirements =  sys.argv[1:]
+
+returncode = 0
+
+for requirement in requirements:
+    try:
+        pkg_resources.require(requirement)
+    except pkg_resources.VersionConflict as e:
+        sys.stderr.write("Wanted Python dependency {}, got {}.\n".format(e.req, e.dist))
+        returncode = 1
+    except pkg_resources.DistributionNotFound as e:
+        sys.stderr.write("Required Python dependency {} was not found.\n".format(e.req))
+        returncode = 1
+
+sys.exit(returncode)
diff --git a/meson.build b/meson.build
index d1eae78..e4f8f9b 100644
--- a/meson.build
+++ b/meson.build
@@ -30,6 +30,50 @@ if not python_version.version_compare('>= 3.4')
   error('BuildStream requires Python >= 3.4')
 endif
 
+# FIXME: We check manually for our Python dependencies as Meson doesn't
+# support doing so yet. See https://github.com/mesonbuild/meson/issues/2377
+
+setuptools_check = run_command(python, '-c', 'import pkg_resources')
+if setuptools_check.returncode() != 0
+  error('Python Setuptools was not found; the pkg_resources module is required.\n' +
+        setuptools_check.stderr().strip())
+endif
+
+install_requires = [
+  'blessings',
+  'Click',
+  'jinja2',
+  'pluginbase',
+  'psutil',
+  'ruamel.yaml',
+]
+
+setup_requires = [
+  'setuptools_scm',
+]
+
+test_requires = [
+  'pep8',
+  # Pin coverage to 4.2 for now, we're experiencing
+  # random crashes with 4.4.2
+  'coverage == 4.4.0',
+  'pytest >= 3.1.0',
+  'pytest-cov',
+  'pytest-datafiles',
+  'pytest-env',
+  'pytest-pep8',
+  # Provide option to run tests in parallel, less reliable
+  'pytest-xdist',
+]
+
+missing_dependency_errors = []
+
+message('Checking for Python dependencies')
+modules_check = run_command(python, 'meson-python-packages-check', install_requires + setup_requires + test_requires)
+if modules_check.returncode() != 0
+  error('Python dependency requirements are not satisfied:\n' + modules_check.stderr().strip())
+endif
+
 ##################################################################
 # Bubblewrap requirements
 ##################################################################


[buildstream] 12/17: meson: Add support for running the test suite through `meson test`

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 9f7ba54e8bc8d20d3c38ccf1ec8d9d356fc7fab7
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 14:19:16 2017 +0000

    meson: Add support for running the test suite through `meson test`
    
    We have to list every test, we can't do globs from Meson itself.
---
 meson.build       |  6 ++++++
 pytest.ini        | 16 ++++++++++++++++
 tests/meson.build | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)

diff --git a/meson.build b/meson.build
index d9c4343..1536c16 100644
--- a/meson.build
+++ b/meson.build
@@ -75,6 +75,11 @@ if modules_check.returncode() != 0
   error('Python dependency requirements are not satisfied:\n' + modules_check.stderr().strip())
 endif
 
+pytest = find_program('pytest-3')
+# We configure pytest through a pytest.ini file in this directory, so as
+# long as we set the workdir correctly it "just works" when run by Meson.
+pytest_workdir = meson.current_source_dir()
+
 ##################################################################
 # Bubblewrap requirements
 ##################################################################
@@ -163,3 +168,4 @@ cdata.set('pythondir', python_site_packages_dir)
 
 subdir('buildstream')
 subdir('man')
+subdir('tests')
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..ed2761c
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,16 @@
+[pytest]
+addopts = --verbose --basetemp ./tmp --pep8 --cov=buildstream --cov-config .coveragerc
+norecursedirs = integration-tests*
+python_files = tests/*/*.py
+pep8maxlinelength = 119
+pep8ignore =
+    * E129
+    * E125
+    doc/source/conf.py ALL
+    tmp/* ALL
+    */lib/python3* ALL
+    */bin/* ALL
+    buildstream/_fuse/fuse.py ALL
+    .eggs/* ALL
+env =
+    D:BST_TEST_SUITE=True
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..7170f9f
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,57 @@
+tests = [
+  'tests/artifactcache/tar.py',
+  'tests/cachekey/cachekey.py',
+  'tests/cachekey/update.py',
+  'tests/completions/completions.py',
+  'tests/context/context.py',
+  'tests/format/assertion.py',
+  'tests/format/listdirectiveerrors.py',
+  'tests/format/optionarch.py',
+  'tests/format/optionbool.py',
+  'tests/format/optioneltmask.py',
+  'tests/format/optionenum.py',
+  'tests/format/optionexports.py',
+  'tests/format/optionflags.py',
+  'tests/format/options.py',
+  'tests/format/projectoverrides.py',
+  'tests/format/project.py',
+  'tests/frontend/buildcheckout.py',
+  'tests/frontend/buildtrack.py',
+  'tests/frontend/compose_splits.py',
+  'tests/frontend/fetch.py',
+  'tests/frontend/help.py',
+  'tests/frontend/main.py',
+  'tests/frontend/overlaps.py',
+  'tests/frontend/pull.py',
+  'tests/frontend/push.py',
+  'tests/frontend/show.py',
+  'tests/frontend/track.py',
+  'tests/frontend/version.py',
+  'tests/frontend/workspace.py',
+  'tests/loader/basics.py',
+  'tests/loader/dependencies.py',
+  'tests/pipeline/load.py',
+  'tests/plugins/basics.py',
+  'tests/plugins/pipeline.py',
+  'tests/plugins/third_party.py',
+  'tests/project/plugins.py',
+  'tests/project/project.py',
+  'tests/sources/git.py',
+  'tests/sources/local.py',
+  'tests/sources/patch.py',
+  'tests/sources/tar.py',
+  'tests/sources/zip.py',
+  'tests/testutils/artifactshare.py',
+  'tests/testutils/runcli.py',
+  'tests/testutils/setuptools.py',
+  'tests/testutils/site.py',
+  'tests/variables/variables.py',
+  'tests/yaml/yaml.py',
+]
+
+# This must be run as a single test, otherwise the coverage report that
+# it generates at the end will be meaningless.
+test('pytest', pytest,
+  args: tests,
+  workdir: pytest_workdir,
+  timeout: 1200)


[buildstream] 06/17: meson: Make sure importing from the source tree still works

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit f8764fde0a86fb982b8270312fd4b02cc714f3e1
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 17:39:43 2017 +0000

    meson: Make sure importing from the source tree still works
    
    It's annoying and confusing to find that `import buildstream` fails when
    you happen to be in a certain directory. This was happening because we
    were importing the version number from a module generated by the Meson
    build instructions. We can use a placeholder when running from the source
    tree though.
    
    This is also needed so that we can generate the man pages at build time,
    because this requires being able to import buildstream.
    
    The only catch is that when buildstream is imported from the current
    directory, the version number is simply returned as '(uninstalled)' now.
---
 buildstream/__init__.py                     | 6 +++++-
 buildstream/meson.build                     | 8 ++++----
 buildstream/utils.py                        | 7 ++++++-
 buildstream/{config.py.in => version.py.in} | 0
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/buildstream/__init__.py b/buildstream/__init__.py
index c49a88f..4b3b94b 100644
--- a/buildstream/__init__.py
+++ b/buildstream/__init__.py
@@ -25,4 +25,8 @@ from .source import Source, SourceError, Consistency
 from .element import Element, ElementError, Scope
 from .buildelement import BuildElement
 from .scriptelement import ScriptElement
-from .config import VERSION
+
+try:
+    from .version import VERSION
+except ImportError:
+    VERSION = '(uninstalled)'
diff --git a/buildstream/meson.build b/buildstream/meson.build
index 2bd4a23..7c34ec3 100644
--- a/buildstream/meson.build
+++ b/buildstream/meson.build
@@ -36,13 +36,13 @@ sources = [
     '_yaml.py',
 ]
 
-config = configure_file(
-    input: 'config.py.in',
-    output: 'config.py',
+version = configure_file(
+    input: 'version.py.in',
+    output: 'version.py',
     configuration: cdata)
 
 install_data(
-    sources + [config],
+    sources + [version],
     install_dir: join_paths(python_site_packages_dir, 'buildstream'))
 
 main = configure_file(
diff --git a/buildstream/utils.py b/buildstream/utils.py
index d263bf7..41d38f8 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -38,12 +38,17 @@ from contextlib import contextmanager
 
 import psutil
 
-from . import VERSION
 from . import _signals
 from . import _yaml
 from ._exceptions import ProgramNotFoundError
 
 
+try:
+    from .version import VERSION
+except ImportError:
+    VERSION = '(uninstalled)'
+
+
 class FileListResult():
     """An object which stores the result of one of the operations
     which run on a list of files.
diff --git a/buildstream/config.py.in b/buildstream/version.py.in
similarity index 100%
rename from buildstream/config.py.in
rename to buildstream/version.py.in


[buildstream] 15/17: meson: Only install bash completion when it's enabled

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 11ffa04d15209705be508946b307ebbaaf0bba58
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 16:05:26 2017 +0000

    meson: Only install bash completion when it's enabled
---
 buildstream/data/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/buildstream/data/meson.build b/buildstream/data/meson.build
index 5d4c950..eda257e 100644
--- a/buildstream/data/meson.build
+++ b/buildstream/data/meson.build
@@ -8,5 +8,7 @@ data = [
 install_data(data,
     install_dir: join_paths(python_site_packages_dir, 'buildstream', 'data'))
 
-install_data('bst',
+if install_bash_completion
+  install_data('bst',
     install_dir: bash_completion_dir)
+endif


[buildstream] 03/17: meson: Set version number at configure time

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit ca2e53ffc2e666881fae06f76572487cf9b60769
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 15:09:57 2017 +0000

    meson: Set version number at configure time
    
    This saves us from importing pkg_resources just to find the version
    number, which saves between 0 and many seconds of startup time
    (see https://github.com/pypa/setuptools/issues/510)
    
    We use the setuptools_scm module to calculate a version number as
    before, so the version numbers should be exactly the same as before.
---
 buildstream/__init__.py                   |  1 +
 buildstream/_frontend/main.py             |  8 ++------
 buildstream/_frontend/widget.py           |  6 ++----
 buildstream/{__init__.py => config.py.in} | 13 ++++---------
 buildstream/meson.build                   | 13 +++++++++----
 buildstream/utils.py                      |  5 ++---
 meson.build                               | 12 +++++++++++-
 7 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/buildstream/__init__.py b/buildstream/__init__.py
index cde1b43..c49a88f 100644
--- a/buildstream/__init__.py
+++ b/buildstream/__init__.py
@@ -25,3 +25,4 @@ from .source import Source, SourceError, Consistency
 from .element import Element, ElementError, Scope
 from .buildelement import BuildElement
 from .scriptelement import ScriptElement
+from .config import VERSION
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index 117d148..d1707f2 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -20,13 +20,12 @@
 import os
 import sys
 import click
-import pkg_resources  # From setuptools
 from contextlib import contextmanager
 from blessings import Terminal
 from click import UsageError
 
 # Import buildstream public symbols
-from .. import Scope
+from .. import Scope, VERSION
 
 # Import various buildstream internals
 from .._context import Context
@@ -42,9 +41,6 @@ from .. import _yaml
 from . import Profile, LogLine, Status
 from .complete import main_bashcomplete, complete_path, CompleteUnhandled
 
-# Some globals resolved for default arguments in the cli
-build_stream_version = pkg_resources.require("buildstream")[0].version
-
 
 ##################################################################
 #            Override of click's main entry point                #
@@ -140,7 +136,7 @@ click.BaseCommand.main = override_main
 #                          Main Options                          #
 ##################################################################
 @click.group(context_settings=dict(help_option_names=['-h', '--help']))
-@click.version_option(version=build_stream_version)
+@click.version_option(version=VERSION)
 @click.option('--config', '-c',
               type=click.Path(exists=True, dir_okay=False, readable=True),
               help="Configuration file to use")
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index 83befd3..a57f926 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -24,11 +24,10 @@ from contextlib import ExitStack
 from mmap import mmap
 
 import click
-import pkg_resources
 from ruamel import yaml
 
 from . import Profile
-from .. import Element, Scope, Consistency
+from .. import Element, Scope, Consistency, VERSION
 from .. import _yaml
 from .._exceptions import ImplError
 from .._message import MessageType
@@ -423,12 +422,11 @@ class LogLine(Widget):
         context = pipeline.context
         project = pipeline.project
         starttime = datetime.datetime.now()
-        bst = pkg_resources.require("buildstream")[0]
         text = ''
 
         # Main invocation context
         text += '\n'
-        text += self.content_profile.fmt("BuildStream Version {}\n".format(bst.version), bold=True)
+        text += self.content_profile.fmt("BuildStream Version {}\n".format(VERSION), bold=True)
         values = OrderedDict()
         values["Session Start"] = starttime.strftime('%A, %d-%m-%Y at %H:%M:%S')
         values["Project"] = "{} ({})".format(project.name, project.directory)
diff --git a/buildstream/__init__.py b/buildstream/config.py.in
similarity index 64%
copy from buildstream/__init__.py
copy to buildstream/config.py.in
index cde1b43..e061be8 100644
--- a/buildstream/__init__.py
+++ b/buildstream/config.py.in
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #
-#  Copyright (C) 2016 Codethink Limited
+#  Copyright (C) 2017 Codethink Limited
 #
 #  This program is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
@@ -16,12 +16,7 @@
 #  License along with this library. If not, see <http://www.gnu.org/licenses/>.
 #
 #  Authors:
-#        Tristan Van Berkom <tr...@codethink.co.uk>
+#        Sam Thursfield <sa...@codethink.co.uk>
 
-# Plugin auther facing APIs
-from .sandbox import Sandbox, SandboxFlags
-from .plugin import Plugin
-from .source import Source, SourceError, Consistency
-from .element import Element, ElementError, Scope
-from .buildelement import BuildElement
-from .scriptelement import ScriptElement
+
+VERSION = '@package_version@'
diff --git a/buildstream/meson.build b/buildstream/meson.build
index b7c7683..2bd4a23 100644
--- a/buildstream/meson.build
+++ b/buildstream/meson.build
@@ -36,12 +36,17 @@ sources = [
     '_yaml.py',
 ]
 
+config = configure_file(
+    input: 'config.py.in',
+    output: 'config.py',
+    configuration: cdata)
+
+install_data(
+    sources + [config],
+    install_dir: join_paths(python_site_packages_dir, 'buildstream'))
+
 main = configure_file(
     input: 'main.py.in',
     output: 'bst',
     configuration: cdata,
     install_dir: get_option('bindir'))
-
-install_data(
-    sources,
-    install_dir: join_paths(python_site_packages_dir, 'buildstream'))
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 30c79ab..d263bf7 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -36,9 +36,9 @@ import subprocess
 import tempfile
 from contextlib import contextmanager
 
-import pkg_resources
 import psutil
 
+from . import VERSION
 from . import _signals
 from . import _yaml
 from ._exceptions import ProgramNotFoundError
@@ -408,8 +408,7 @@ def get_bst_version():
        (int): The major version
        (int): The minor version
     """
-    package = pkg_resources.require("buildstream")[0]
-    versions = package.version.split('.')[:2]
+    versions = VERSION.split('.')[:2]
 
     return (int(versions[0]), int(versions[1]))
 
diff --git a/meson.build b/meson.build
index 0e0fa78..d1eae78 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('buildstream', version: '0.1')
+project('buildstream')
 
 if get_option('check_backend') == 'auto'
   platform = host_machine.system()
@@ -72,10 +72,20 @@ if backend == 'linux'
 endif
 
 
+# Detect version from Git using setuptools_scm.
+package_version_result = run_command(python, '-c', 'import setuptools_scm; print(setuptools_scm.get_version())')
+if package_version_result.returncode() != 0
+  error('Failed to detect package version: @0@'.format(package_version_result.stderr().strip()))
+endif
+package_version = package_version_result.stdout().strip()
+message('Detected package version @0@'.format(package_version))
+
+
 python_name = 'python' + python_version
 python_site_packages_dir = join_paths(get_option('prefix'), get_option('libdir'), python_name, 'site-packages')
 
 cdata = configuration_data()
+cdata.set('package_version', package_version)
 cdata.set('pythondir', python_site_packages_dir)
 
 subdir('buildstream')


[buildstream] 13/17: Remove old setuptools build system

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 62ebd00cd6fad4aa30af3cc0db2f9703feb85de3
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 14:20:17 2017 +0000

    Remove old setuptools build system
---
 setup.cfg |  19 -------
 setup.py  | 186 --------------------------------------------------------------
 2 files changed, 205 deletions(-)

diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 1cd2750..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,19 +0,0 @@
-[aliases]
-test=pytest
-
-[tool:pytest]
-addopts = --verbose --basetemp ./tmp --pep8 --cov=buildstream --cov-config .coveragerc
-norecursedirs = integration-tests*
-python_files = tests/*/*.py
-pep8maxlinelength = 119
-pep8ignore =
-    * E129
-    * E125
-    doc/source/conf.py ALL
-    tmp/* ALL
-    */lib/python3* ALL
-    */bin/* ALL
-    buildstream/_fuse/fuse.py ALL
-    .eggs/* ALL
-env =
-    D:BST_TEST_SUITE=True
diff --git a/setup.py b/setup.py
deleted file mode 100755
index 7bbd245..0000000
--- a/setup.py
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/usr/bin/env python3
-#
-#  Copyright (C) 2016 Codethink Limited
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
-#
-#  Authors:
-#        Tristan Van Berkom <tr...@codethink.co.uk>
-
-import os
-import shutil
-import sys
-
-if sys.version_info[0] != 3 or sys.version_info[1] < 4:
-    print("BuildStream requires Python >= 3.4")
-    sys.exit(1)
-
-try:
-    from setuptools import setup, find_packages
-except ImportError:
-    print("BuildStream requires setuptools in order to build. Install it using"
-          " your package manager (usually python3-setuptools) or via pip (pip3"
-          " install setuptools).")
-    sys.exit(1)
-
-
-##################################################################
-# Bubblewrap requirements
-##################################################################
-def assert_bwrap():
-    platform = os.environ.get('BST_FORCE_BACKEND', '') or sys.platform
-    if platform.startswith('linux'):
-        bwrap_path = shutil.which('bwrap')
-        if not bwrap_path:
-            print("Bubblewrap not found: BuildStream requires Bubblewrap (bwrap) for"
-                  " sandboxing the build environment. Install it using your package manager"
-                  " (usually bwrap or bubblewrap)")
-            sys.exit(1)
-
-
-##################################################################
-# OSTree version requirements
-##################################################################
-REQUIRED_OSTREE_YEAR = 2017
-REQUIRED_OSTREE_RELEASE = 8
-
-
-def exit_ostree(reason):
-    print(reason +
-          "\nBuildStream requires OSTree >= v{}.{} with Python bindings. "
-          .format(REQUIRED_OSTREE_YEAR, REQUIRED_OSTREE_RELEASE) +
-          "Install it using your package manager (usually ostree or gir1.2-ostree-1.0).")
-    sys.exit(1)
-
-
-def assert_ostree_version():
-    platform = os.environ.get('BST_FORCE_BACKEND', '') or sys.platform
-    if platform.startswith('linux'):
-        try:
-            import gi
-        except ImportError:
-            print("BuildStream requires PyGObject (aka PyGI). Install it using"
-                  " your package manager (usually pygobject3 or python-gi).")
-            sys.exit(1)
-
-        try:
-            gi.require_version('OSTree', '1.0')
-            from gi.repository import OSTree
-        except:
-            exit_ostree("OSTree not found")
-
-        try:
-            if OSTree.YEAR_VERSION < REQUIRED_OSTREE_YEAR or \
-               (OSTree.YEAR_VERSION == REQUIRED_OSTREE_YEAR and
-                OSTree.RELEASE_VERSION < REQUIRED_OSTREE_RELEASE):
-                exit_ostree("OSTree v{}.{} is too old."
-                            .format(OSTree.YEAR_VERSION, OSTree.RELEASE_VERSION))
-        except AttributeError:
-            exit_ostree("OSTree is too old.")
-
-
-###########################################
-# List the pre-built man pages to install #
-###########################################
-#
-# Man pages are automatically generated however it was too difficult
-# to integrate with setuptools as a step of the build (FIXME !).
-#
-# To update the man pages in tree before a release, you need to
-# ensure you have the 'click_man' package installed, and run:
-#
-# python3 setup.py --command-packages=click_man.commands man_pages
-#
-# Then commit the result.
-#
-def list_man_pages():
-    bst_dir = os.path.dirname(os.path.abspath(__file__))
-    man_dir = os.path.join(bst_dir, 'man')
-    man_pages = os.listdir(man_dir)
-    return [os.path.join('man', page) for page in man_pages]
-
-
-#####################################################
-#                Conditional Checks                 #
-#####################################################
-#
-# Because setuptools... there is no way to pass an option to
-# the setup.py explicitly at install time.
-#
-# So screw it, lets just use an env var.
-bst_install_entry_points = {
-    'console_scripts': [
-        'bst-artifact-receive = buildstream._artifactcache.pushreceive:receive_main'
-    ],
-}
-
-if not os.environ.get('BST_ARTIFACTS_ONLY', ''):
-    assert_bwrap()
-    assert_ostree_version()
-    bst_install_entry_points['console_scripts'] += [
-        'bst = buildstream._frontend:cli'
-    ]
-
-
-#####################################################
-#             Main setup() Invocation               #
-#####################################################
-setup(name='BuildStream',
-      version='0.1',
-      description='A framework for modelling build pipelines in YAML',
-      license='LGPL',
-      use_scm_version=True,
-      packages=find_packages(),
-      package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
-                                    'data/*.yaml', 'data/*.sh.in']},
-      data_files=[
-          # This is a weak attempt to integrate with the user nicely,
-          # installing things outside of the python package itself with pip is
-          # not recommended, but there seems to be no standard structure for
-          # addressing this; so just installing this here.
-          #
-          # These do not get installed in developer mode (`pip install --user -e .`)
-          #
-          # The completions are ignored by bash unless it happens to be installed
-          # in the right directory; this is more like a weak statement that we
-          # attempt to install bash completion scriptlet.
-          #
-          ('share/man/man1', list_man_pages()),
-          ('share/bash-completion/completions', [
-              os.path.join('buildstream', 'data', 'bst')
-          ])
-      ],
-      install_requires=[
-          'setuptools',
-          'psutil',
-          'ruamel.yaml',
-          'pluginbase',
-          'Click',
-          'blessings',
-          'jinja2',
-      ],
-      entry_points=bst_install_entry_points,
-      setup_requires=['pytest-runner', 'setuptools_scm'],
-      tests_require=['pep8',
-                     # Pin coverage to 4.2 for now, we're experiencing
-                     # random crashes with 4.4.2
-                     'coverage == 4.4.0',
-                     'pytest-datafiles',
-                     'pytest-env',
-                     'pytest-pep8',
-                     'pytest-cov',
-                     # Provide option to run tests in parallel, less reliable
-                     'pytest-xdist',
-                     'pytest >= 3.1.0'],
-      zip_safe=False)


[buildstream] 09/17: meson: Install Bash completions

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit d376eb66359378c2f4d0a6e24c2efcf533ca7ac8
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 18:19:08 2017 +0000

    meson: Install Bash completions
---
 buildstream/data/meson.build |  3 +++
 meson.build                  | 28 ++++++++++++++++++++++++++++
 meson_options.txt            |  3 +++
 3 files changed, 34 insertions(+)

diff --git a/buildstream/data/meson.build b/buildstream/data/meson.build
index 758445c..5d4c950 100644
--- a/buildstream/data/meson.build
+++ b/buildstream/data/meson.build
@@ -7,3 +7,6 @@ data = [
 
 install_data(data,
     install_dir: join_paths(python_site_packages_dir, 'buildstream', 'data'))
+
+install_data('bst',
+    install_dir: bash_completion_dir)
diff --git a/meson.build b/meson.build
index 6dc56b9..d9c4343 100644
--- a/meson.build
+++ b/meson.build
@@ -117,6 +117,34 @@ if backend == 'linux'
 endif
 
 
+####################################################################
+# bash-completion
+####################################################################
+
+install_bash_completion = false
+if get_option('bash_completion') == 'yes' or get_option('bash_completion') == 'auto'
+  bash_completion_package = dependency('bash-completion', required: false)
+  if bash_completion_package.found()
+    bash_completion_dir = bash_completion_package.get_pkgconfig_variable('completionsdir')
+  else
+    bash_completion_dir = join_paths(get_option('prefix'), get_option('datadir'), 'bash-completion', 'completions')
+  endif
+  install_bash_completion = true
+elif get_option('bash_completion') == 'no' or get_option('bash_completion') == ''
+  install_bash_completion = false
+  bash_completion_dir = '(disabled)'
+else
+  install_bash_completion = true
+  bash_completion_dir = get_option('bash_completion')
+endif
+
+if install_bash_completion
+  message('Installing Bash completion script to @0@'.format(bash_completion_dir))
+else
+  message('Not installing Bash completion script')
+endif
+
+
 # Detect version from Git using setuptools_scm.
 package_version_result = run_command(python, '-c', 'import setuptools_scm; print(setuptools_scm.get_version())')
 if package_version_result.returncode() != 0
diff --git a/meson_options.txt b/meson_options.txt
index 01ef12d..496a54b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,5 @@
 option('check_backend', type: 'combo', choices: ['auto', 'linux', 'unix'],
         description: 'Check for dependencies needed for a specific backend (default: autodetect backend)')
+
+option('bash_completion', type: 'string', value: 'yes',
+       description: 'Directory to install Bash completion files (or "yes" for default directory, "no" to disable installation')


[buildstream] 08/17: meson: Add bst-artifact-receive hook

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 9da8c81a8c1df525c81be75c1e6783fdace9f752
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Thu Dec 14 18:14:46 2017 +0000

    meson: Add bst-artifact-receive hook
    
    The BST_ARTIFACTS_ONLY option isn't yet supported.
---
 buildstream/{main.py.in => bst-artifact-receive.in} |  4 ++--
 buildstream/{main.py.in => bst.in}                  |  4 ++--
 buildstream/meson.build                             | 10 ++++++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/buildstream/main.py.in b/buildstream/bst-artifact-receive.in
similarity index 91%
copy from buildstream/main.py.in
copy to buildstream/bst-artifact-receive.in
index b4902a8..dbfc97b 100755
--- a/buildstream/main.py.in
+++ b/buildstream/bst-artifact-receive.in
@@ -25,6 +25,6 @@ PYTHON_SITE_PACKAGES_DIR = '@pythondir@'
 
 sys.path.insert(1, PYTHON_SITE_PACKAGES_DIR)
 
-import buildstream._frontend
+from buildstream._artifactcache.pushreceive import receive_main
 
-sys.exit(buildstream._frontend.cli())
+sys.exit(receive_main())
diff --git a/buildstream/main.py.in b/buildstream/bst.in
similarity index 93%
rename from buildstream/main.py.in
rename to buildstream/bst.in
index b4902a8..1827de5 100755
--- a/buildstream/main.py.in
+++ b/buildstream/bst.in
@@ -25,6 +25,6 @@ PYTHON_SITE_PACKAGES_DIR = '@pythondir@'
 
 sys.path.insert(1, PYTHON_SITE_PACKAGES_DIR)
 
-import buildstream._frontend
+from buildstream._frontend import cli
 
-sys.exit(buildstream._frontend.cli())
+sys.exit(cli())
diff --git a/buildstream/meson.build b/buildstream/meson.build
index 7c34ec3..c84f94c 100644
--- a/buildstream/meson.build
+++ b/buildstream/meson.build
@@ -45,8 +45,14 @@ install_data(
     sources + [version],
     install_dir: join_paths(python_site_packages_dir, 'buildstream'))
 
-main = configure_file(
-    input: 'main.py.in',
+bst_main = configure_file(
+    input: 'bst.in',
     output: 'bst',
     configuration: cdata,
     install_dir: get_option('bindir'))
+
+bst_artifact_receive_main = configure_file(
+    input: 'bst-artifact-receive.in',
+    output: 'bst-artifact-receive',
+    configuration: cdata,
+    install_dir: get_option('bindir'))


[buildstream] 02/17: meson: Add dependency checks

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 852f23c31b426e0fcf9e6e3562bbaedae0a1c57e
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Wed Dec 13 18:25:58 2017 +0000

    meson: Add dependency checks
    
    We don't check for our Python dependencies so far. Adding support upstream
    to do this would be the best approach.
    
    See: https://github.com/mesonbuild/meson/issues/2377
---
 meson-ostree-check | 17 +++++++++++++++
 meson.build        | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt  |  2 ++
 3 files changed, 82 insertions(+)

diff --git a/meson-ostree-check b/meson-ostree-check
new file mode 100755
index 0000000..19c21ca
--- /dev/null
+++ b/meson-ostree-check
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+import sys
+
+try:
+    import gi
+    gi.require_version('OSTree', '1.0')
+    from gi.repository import OSTree
+except (ImportError, ValueError):
+    sys.stderr.write("OSTree not found.\n")
+    sys.exit(1)
+
+try:
+    print('{}.{}'.format(OSTree.YEAR_VERSION, OSTree.RELEASE_VERSION))
+except AttributeError:
+    sys.stderr.write("OSTree found, but it is probably too old as it does not "
+                     "provide the expected version information.\n")
diff --git a/meson.build b/meson.build
index 66a6b44..0e0fa78 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,22 @@
 project('buildstream', version: '0.1')
 
+if get_option('check_backend') == 'auto'
+  platform = host_machine.system()
+  if platform == 'linux'
+    backend = 'linux'
+  else
+    backend = 'posix'
+  endif
+else
+  backend = get_option('check_backend')
+endif
+
+message('Checking dependencies for backend: @0@'.format(backend))
+
+
+##################################################################
+# Python requirements
+##################################################################
 
 python = find_program('python3', required: true)
 
@@ -9,6 +26,52 @@ if python_version_check.returncode() != 0
 endif
 python_version = python_version_check.stdout()
 
+if not python_version.version_compare('>= 3.4')
+  error('BuildStream requires Python >= 3.4')
+endif
+
+##################################################################
+# Bubblewrap requirements
+##################################################################
+
+if backend == 'linux'
+  bwrap = find_program('bwrap', required: false)
+  if not bwrap.found()
+    error('Bubblewrap not found. BuildStream requires Bubblewrap (bwrap) for' +
+          ' sandboxing the build environment. Install it using your package manager' +
+          ' (usually bwrap or bubblewrap)')
+  endif
+endif
+
+
+##################################################################
+# OSTree version requirements
+##################################################################
+
+REQUIRED_OSTREE = '>= 2017.8'
+
+if backend == 'linux'
+  message('Checking for OSTree @0@ with PyGObject bindings'.format(REQUIRED_OSTREE))
+  gi_check = run_command(python, '-c', 'import gi')
+  if gi_check.returncode() != 0
+    error('BuildStream requires PyGObject (aka PyGI). Install it using' +
+          ' your package manager (usually pygobject3 or python-gi).')
+  endif
+
+  ostree_version_check = run_command('meson-ostree-check')
+  if ostree_version_check.returncode() != 0
+    message = ostree_version_check.stderr().strip()
+    error(message + '\nBuildStream requires OSTree @0@ with Python bindings.'.format(REQUIRED_OSTREE) +
+          ' Install it using your package manager (usually ostree or gir1.2-ostree-1.0).')
+  else
+    ostree_version = ostree_version_check.stdout().strip()
+    if not ostree_version.version_compare(REQUIRED_OSTREE)
+      error('OSTree is too old; found version @0@ but we require @1@'.format(ostree_version, REQUIRED_OSTREE))
+    endif
+  endif
+endif
+
+
 python_name = 'python' + python_version
 python_site_packages_dir = join_paths(get_option('prefix'), get_option('libdir'), python_name, 'site-packages')
 
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..01ef12d
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('check_backend', type: 'combo', choices: ['auto', 'linux', 'unix'],
+        description: 'Check for dependencies needed for a specific backend (default: autodetect backend)')


[buildstream] 14/17: meson: Fix `ninja dist` target

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8dd53a2e7d1d8325ec48cd8f8bc1c5f081b0d32f
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Tue Dec 19 15:57:53 2017 +0000

    meson: Fix `ninja dist` target
    
    We can't detect the version using setuptools_scm when building from a
    tarball, so we fall back to the version from the meson.build file. This
    means that every release needs to update the version number in the
    meson.build file of course.
---
 meson.build | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 1536c16..d2fc27a 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('buildstream')
+project('buildstream', version: '0.1')
 
 if get_option('check_backend') == 'auto'
   platform = host_machine.system()
@@ -152,11 +152,14 @@ endif
 
 # Detect version from Git using setuptools_scm.
 package_version_result = run_command(python, '-c', 'import setuptools_scm; print(setuptools_scm.get_version())')
-if package_version_result.returncode() != 0
-  error('Failed to detect package version: @0@'.format(package_version_result.stderr().strip()))
+if package_version_result.returncode() == 0
+  package_version = package_version_result.stdout().strip()
+  message('Detected package version from Git: @0@'.format(package_version))
+else
+  message('Failed to detect package version from Git: @0@.'.format(package_version_result.stderr().strip()))
+  package_version = meson.project_version()
+  message('Using version from Meson.build: @0@.'.format(package_version))
 endif
-package_version = package_version_result.stdout().strip()
-message('Detected package version @0@'.format(package_version))
 
 
 python_name = 'python' + python_version


[buildstream] 01/17: Add Meson build instructions

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch sam/meson
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8ae7319ca7901803bb491d1ceb58a7b81edb3ee8
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Wed Dec 13 17:11:08 2017 +0000

    Add Meson build instructions
    
    The goal is to replace setuptools, primarily driven by the performance
    problems we get from the pkg_resources module at import time[1].
    
    1. See https://github.com/pypa/setuptools/issues/510
---
 buildstream/_artifactcache/meson.build   | 11 ++++++++
 buildstream/_frontend/meson.build        | 12 ++++++++
 buildstream/_fuse/meson.build            | 10 +++++++
 buildstream/_options/meson.build         | 14 ++++++++++
 buildstream/_platform/meson.build        | 10 +++++++
 buildstream/_scheduler/meson.build       | 15 ++++++++++
 buildstream/data/meson.build             |  9 ++++++
 buildstream/main.py.in                   | 30 ++++++++++++++++++++
 buildstream/meson.build                  | 47 ++++++++++++++++++++++++++++++++
 buildstream/plugins/elements/meson.build | 31 +++++++++++++++++++++
 buildstream/plugins/sources/meson.build  | 15 ++++++++++
 buildstream/sandbox/meson.build          | 12 ++++++++
 meson.build                              | 18 ++++++++++++
 13 files changed, 234 insertions(+)

diff --git a/buildstream/_artifactcache/meson.build b/buildstream/_artifactcache/meson.build
new file mode 100644
index 0000000..0c9b2d3
--- /dev/null
+++ b/buildstream/_artifactcache/meson.build
@@ -0,0 +1,11 @@
+sources = [
+    '__init__.py',
+    'artifactcache.py',
+    'ostreecache.py',
+    'pushreceive.py',
+    'tarcache.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_artifactcache'))
diff --git a/buildstream/_frontend/meson.build b/buildstream/_frontend/meson.build
new file mode 100644
index 0000000..b02ddd8
--- /dev/null
+++ b/buildstream/_frontend/meson.build
@@ -0,0 +1,12 @@
+sources = [
+    '__init__.py',
+    'complete.py',
+    'main.py',
+    'profile.py',
+    'status.py',
+    'widget.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_frontend'))
diff --git a/buildstream/_fuse/meson.build b/buildstream/_fuse/meson.build
new file mode 100644
index 0000000..d176dbd
--- /dev/null
+++ b/buildstream/_fuse/meson.build
@@ -0,0 +1,10 @@
+sources = [
+    '__init__.py',
+    'fuse.py',
+    'hardlinks.py',
+    'mount.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_fuse'))
diff --git a/buildstream/_options/meson.build b/buildstream/_options/meson.build
new file mode 100644
index 0000000..bd36ae2
--- /dev/null
+++ b/buildstream/_options/meson.build
@@ -0,0 +1,14 @@
+sources = [
+    '__init__.py',
+    'optionarch.py',
+    'optionbool.py',
+    'optioneltmask.py',
+    'optionenum.py',
+    'optionflags.py',
+    'optionpool.py',
+    'option.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_options'))
diff --git a/buildstream/_platform/meson.build b/buildstream/_platform/meson.build
new file mode 100644
index 0000000..eec17f0
--- /dev/null
+++ b/buildstream/_platform/meson.build
@@ -0,0 +1,10 @@
+sources = [
+    '__init__.py',
+    'linux.py',
+    'platform.py',
+    'unix.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_platform'))
diff --git a/buildstream/_scheduler/meson.build b/buildstream/_scheduler/meson.build
new file mode 100644
index 0000000..3400f35
--- /dev/null
+++ b/buildstream/_scheduler/meson.build
@@ -0,0 +1,15 @@
+sources = [
+    '__init__.py',
+    'buildqueue.py',
+    'fetchqueue.py',
+    'job.py',
+    'pullqueue.py',
+    'pushqueue.py',
+    'queue.py',
+    'scheduler.py',
+    'trackqueue.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', '_scheduler'))
diff --git a/buildstream/data/meson.build b/buildstream/data/meson.build
new file mode 100644
index 0000000..758445c
--- /dev/null
+++ b/buildstream/data/meson.build
@@ -0,0 +1,9 @@
+data = [
+    'build-all.sh.in',
+    'build-module.sh.in',
+    'projectconfig.yaml',
+    'userconfig.yaml',
+]
+
+install_data(data,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'data'))
diff --git a/buildstream/main.py.in b/buildstream/main.py.in
new file mode 100755
index 0000000..b4902a8
--- /dev/null
+++ b/buildstream/main.py.in
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+#  Copyright (C) 2017 Codethink Limited
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2 of the License, or (at your option) any later version.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
+#
+#  Authors:
+#        Sam Thursfield <sa...@codethink.co.uk>
+
+
+import sys
+
+PYTHON_SITE_PACKAGES_DIR = '@pythondir@'
+
+sys.path.insert(1, PYTHON_SITE_PACKAGES_DIR)
+
+import buildstream._frontend
+
+sys.exit(buildstream._frontend.cli())
diff --git a/buildstream/meson.build b/buildstream/meson.build
new file mode 100644
index 0000000..b7c7683
--- /dev/null
+++ b/buildstream/meson.build
@@ -0,0 +1,47 @@
+subdir('_artifactcache')
+subdir('data')
+subdir('_frontend')
+subdir('_fuse')
+subdir('_options')
+subdir('_platform')
+subdir('plugins/elements')
+subdir('plugins/sources')
+subdir('sandbox')
+subdir('_scheduler')
+
+sources = [
+    '__init__.py',
+    'buildelement.py',
+    '_context.py',
+    '_elementfactory.py',
+    'element.py',
+    '_exceptions.py',
+    '_loader.py',
+    '_message.py',
+    '_metaelement.py',
+    '_metasource.py',
+    '_ostree.py',
+    '_pipeline.py',
+    '_plugincontext.py',
+    'plugin.py',
+    '_profile.py',
+    '_project.py',
+    'scriptelement.py',
+    '_signals.py',
+    '_site.py',
+    '_sourcefactory.py',
+    'source.py',
+    'utils.py',
+    '_variables.py',
+    '_yaml.py',
+]
+
+main = configure_file(
+    input: 'main.py.in',
+    output: 'bst',
+    configuration: cdata,
+    install_dir: get_option('bindir'))
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream'))
diff --git a/buildstream/plugins/elements/meson.build b/buildstream/plugins/elements/meson.build
new file mode 100644
index 0000000..472a3f8
--- /dev/null
+++ b/buildstream/plugins/elements/meson.build
@@ -0,0 +1,31 @@
+sources = [
+    '__init__.py',
+    'autotools.py',
+    'autotools.yaml',
+    'cmake.py',
+    'cmake.yaml',
+    'compose.py',
+    'compose.yaml',
+    'distutils.py',
+    'distutils.yaml',
+    'import.py',
+    'import.yaml',
+    'makemaker.py',
+    'makemaker.yaml',
+    'manual.py',
+    'manual.yaml',
+    'meson.py',
+    'meson.yaml',
+    'modulebuild.py',
+    'modulebuild.yaml',
+    'pip.py',
+    'pip.yaml',
+    'qmake.py',
+    'qmake.yaml',
+    'script.py',
+    'script.yaml',
+    'stack.py',
+]
+
+install_data(sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'plugins', 'elements'))
diff --git a/buildstream/plugins/sources/meson.build b/buildstream/plugins/sources/meson.build
new file mode 100644
index 0000000..a8cc88a
--- /dev/null
+++ b/buildstream/plugins/sources/meson.build
@@ -0,0 +1,15 @@
+sources = [
+    '__init__.py',
+    'bzr.py',
+    '_downloadablefilesource.py',
+    'git.py',
+    'local.py',
+    'meson.build',
+    'ostree.py',
+    'patch.py',
+    'tar.py',
+    'zip.py',
+]
+
+install_data(sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'plugins', 'sources'))
diff --git a/buildstream/sandbox/meson.build b/buildstream/sandbox/meson.build
new file mode 100644
index 0000000..a8f3724
--- /dev/null
+++ b/buildstream/sandbox/meson.build
@@ -0,0 +1,12 @@
+sources = [
+    '__init__.py',
+    '_mounter.py',
+    '_mount.py',
+    '_sandboxbwrap.py',
+    '_sandboxchroot.py',
+    'sandbox.py',
+]
+
+install_data(
+    sources,
+    install_dir: join_paths(python_site_packages_dir, 'buildstream', 'sandbox'))
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..66a6b44
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,18 @@
+project('buildstream', version: '0.1')
+
+
+python = find_program('python3', required: true)
+
+python_version_check = run_command(python, '-c', 'import sys; sys.stdout.write("%d.%d" % (sys.version_info[0], sys.version_info[1]))')
+if python_version_check.returncode() != 0
+  error('Unable to detect Python version: ' + result.stdout() + result.stderr())
+endif
+python_version = python_version_check.stdout()
+
+python_name = 'python' + python_version
+python_site_packages_dir = join_paths(get_option('prefix'), get_option('libdir'), python_name, 'site-packages')
+
+cdata = configuration_data()
+cdata.set('pythondir', python_site_packages_dir)
+
+subdir('buildstream')