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

[buildstream] 01/03: plugins/elements/pip.py: Remove the pip build element plugin

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

github-bot pushed a commit to branch traveltissues/tmp
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit bdb6dcf787c222ce2cbb48807435f1594e83eba1
Author: Tom Pollard <to...@codethink.co.uk>
AuthorDate: Wed Jan 22 14:32:47 2020 +0000

    plugins/elements/pip.py: Remove the pip build element plugin
    
    The plugin & related tests are moved to bst-plugins-experimental,
    NEWS updated to reflect this
---
 NEWS                                         |   3 +
 doc/source/core_plugins.rst                  |   1 -
 src/buildstream/plugins/elements/pip.py      |  50 ------------
 src/buildstream/plugins/elements/pip.yaml    |  36 ---------
 tests/integration/pip_element.py             | 117 ---------------------------
 tests/integration/project/files/hello.tar.xz | Bin 628 -> 0 bytes
 6 files changed, 3 insertions(+), 204 deletions(-)

diff --git a/NEWS b/NEWS
index 95bcb2e..974e9c3 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,9 @@ API
 Plugins
 -------
 
+  o BREAKING CHANGE: pip element plugin has been moved to the
+    bst-plugins-experimental repository.
+
   o The 'git' source will now only fetch a single revision when its ref is set
     to an exact tag in git-describe format (...-0-g...).
 
diff --git a/doc/source/core_plugins.rst b/doc/source/core_plugins.rst
index e788936..b407286 100644
--- a/doc/source/core_plugins.rst
+++ b/doc/source/core_plugins.rst
@@ -32,7 +32,6 @@ Build elements
 
    elements/manual
    elements/autotools
-   elements/pip
 
 
 .. _plugins_sources:
diff --git a/src/buildstream/plugins/elements/pip.py b/src/buildstream/plugins/elements/pip.py
deleted file mode 100644
index 9330374..0000000
--- a/src/buildstream/plugins/elements/pip.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#  Copyright (C) 2017 Mathieu Bridon
-#
-#  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:
-#        Mathieu Bridon <bo...@daitauha.fr>
-
-"""
-pip - Pip build element
-=======================
-A :mod:`BuildElement <buildstream.buildelement>` implementation for installing
-Python modules with pip
-
-The pip default configuration:
-  .. literalinclude:: ../../../src/buildstream/plugins/elements/pip.yaml
-     :language: yaml
-
-See :ref:`built-in functionality documentation <core_buildelement_builtins>` for
-details on common configuration options for build elements.
-"""
-
-from buildstream import BuildElement, SandboxFlags
-
-
-# Element implementation for the 'pip' kind.
-class PipElement(BuildElement):
-    # Supports virtual directories (required for remote execution)
-    BST_VIRTUAL_DIRECTORY = True
-
-    # Enable command batching across prepare() and assemble()
-    def configure_sandbox(self, sandbox):
-        super().configure_sandbox(sandbox)
-        self.batch_prepare_assemble(SandboxFlags.ROOT_READ_ONLY, collect=self.get_variable("install-root"))
-
-
-# Plugin entry point
-def setup():
-    return PipElement
diff --git a/src/buildstream/plugins/elements/pip.yaml b/src/buildstream/plugins/elements/pip.yaml
deleted file mode 100644
index 294d4ad..0000000
--- a/src/buildstream/plugins/elements/pip.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-# Pip default configurations
-
-variables:
-
-  pip: pip
-  pip-flags: |
-    %{pip} install --no-deps --root=%{install-root} --prefix=%{prefix}
-  pip-install-package: |
-    %{pip-flags} %{conf-root}
-  pip-download-dir: |
-    .bst_pip_downloads
-  pip-install-dependencies: |
-    if [ -e %{pip-download-dir} ]; then %{pip-flags} %{pip-download-dir}/*; fi
-
-config:
-
-  configure-commands: []
-  build-commands: []
-
-  # Commands for installing the software into a
-  # destination folder
-  #
-  install-commands:
-  - |
-    %{pip-install-package}
-  - |
-    %{pip-install-dependencies}
-
-  # Commands for stripping debugging information out of
-  # installed binaries
-  #
-  strip-commands:
-  - |
-    %{strip-binaries}
-  - |
-    %{fix-pyc-timestamps}
diff --git a/tests/integration/pip_element.py b/tests/integration/pip_element.py
deleted file mode 100644
index bfc4f80..0000000
--- a/tests/integration/pip_element.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# Pylint doesn't play well with fixtures and dependency injection from pytest
-# pylint: disable=redefined-outer-name
-
-import os
-
-import pytest
-
-from buildstream import _yaml
-
-from buildstream.testing import cli_integration as cli  # pylint: disable=unused-import
-from buildstream.testing.integration import assert_contains
-from buildstream.testing._utils.site import HAVE_SANDBOX
-
-from tests.testutils import setup_pypi_repo  # pylint: disable=unused-import
-
-
-pytestmark = pytest.mark.integration
-
-
-DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project")
-
-
-@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
-def test_pip_build(cli, datafiles):
-    project = str(datafiles)
-    checkout = os.path.join(cli.directory, "checkout")
-    element_path = os.path.join(project, "elements")
-    element_name = "pip/hello.bst"
-
-    element = {
-        "kind": "pip",
-        "variables": {"pip": "pip3"},
-        "depends": [{"filename": "base.bst"}],
-        "sources": [
-            {
-                "kind": "tar",
-                "url": "file://{}/files/hello.tar.xz".format(project),
-                "ref": "ad96570b552498807abec33c06210bf68378d854ced6753b77916c5ed517610d",
-            }
-        ],
-    }
-    os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
-    _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
-
-    result = cli.run(project=project, args=["build", element_name])
-    assert result.exit_code == 0
-
-    result = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout])
-    assert result.exit_code == 0
-
-    assert_contains(checkout, ["/usr", "/usr/lib", "/usr/bin", "/usr/bin/hello", "/usr/lib/python3.6"])
-
-
-# Test running an executable built with pip
-@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
-def test_pip_run(cli, datafiles):
-    # Create and build our test element
-    test_pip_build(cli, datafiles)
-
-    project = str(datafiles)
-    element_name = "pip/hello.bst"
-
-    result = cli.run(project=project, args=["shell", element_name, "/usr/bin/hello"])
-    assert result.exit_code == 0
-    assert result.output == "Hello, world!\n"
-
-
-@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
-def test_pip_element_should_install_pip_deps(cli, datafiles, setup_pypi_repo):
-    project = str(datafiles)
-    elements_path = os.path.join(project, "elements")
-    element_name = "pip/hello.bst"
-
-    # check that exotically named packages are imported correctly
-    myreqs_packages = "alohalib"
-    dependencies = ["app2", "app.3", "app-4", "app_5", "app.no.6", "app-no-7", "app_no_8"]
-    mock_packages = {myreqs_packages: {package: {} for package in dependencies}}
-
-    # set up directories
-    pypi_repo = os.path.join(project, "files", "pypi-repo")
-    os.makedirs(pypi_repo, exist_ok=True)
-    os.makedirs(os.path.dirname(os.path.join(elements_path, element_name)), exist_ok=True)
-    setup_pypi_repo(mock_packages, pypi_repo)
-
-    # create pip element
-    element = {
-        "kind": "pip",
-        "variables": {"pip": "pip3"},
-        "depends": [{"filename": "base.bst"}],
-        "sources": [
-            {
-                "kind": "tar",
-                "url": "file://{}/files/hello.tar.xz".format(project),
-                # FIXME: remove hardcoded ref once issue #1010 is closed
-                "ref": "ad96570b552498807abec33c06210bf68378d854ced6753b77916c5ed517610d",
-            },
-            {"kind": "pip", "url": "file://{}".format(os.path.realpath(pypi_repo)), "packages": [myreqs_packages],},
-        ],
-    }
-    _yaml.roundtrip_dump(element, os.path.join(elements_path, element_name))
-
-    result = cli.run(project=project, args=["source", "track", element_name])
-    assert result.exit_code == 0
-
-    result = cli.run(project=project, args=["build", element_name])
-    assert result.exit_code == 0
-
-    # get installed packages in sandbox
-    installed_packages = set(
-        cli.run(project=project, args=["shell", element_name, "pip3", "freeze"]).output.split("\n")
-    )
-    # compare with packages that are expected to be installed
-    pip_source_packages = {package.replace("_", "-") + "==0.1" for package in dependencies + [myreqs_packages]}
-    assert pip_source_packages.issubset(installed_packages)
diff --git a/tests/integration/project/files/hello.tar.xz b/tests/integration/project/files/hello.tar.xz
deleted file mode 100644
index 72ec9b3..0000000
Binary files a/tests/integration/project/files/hello.tar.xz and /dev/null differ