summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2020-01-22 14:32:47 +0000
committerTom Pollard <tom.pollard@codethink.co.uk>2020-01-22 14:32:47 +0000
commit6d6fd48d6e8bb55daba8ed401e42179bfc175a00 (patch)
tree3b62503e3551a93dd6bd65aab26314cb887ed64a
parentbf5f20704831f58d7ced04e960ca8f7b97c6736c (diff)
downloadbuildstream-tpollard/pip-element.tar.gz
plugins/elements/pip.py: Remove the pip build element plugintpollard/pip-element
The plugin & related tests are moved to bst-plugins-experimental, NEWS updated to reflect this
-rw-r--r--NEWS6
-rw-r--r--doc/source/core_plugins.rst1
-rw-r--r--src/buildstream/plugins/elements/pip.py50
-rw-r--r--src/buildstream/plugins/elements/pip.yaml36
-rw-r--r--tests/integration/pip_element.py117
-rw-r--r--tests/integration/project/files/hello.tar.xzbin628 -> 0 bytes
6 files changed, 6 insertions, 204 deletions
diff --git a/NEWS b/NEWS
index 6b6766961..edbf858b7 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@
(unreleased)
============
+Plugins
+-------
+
+ o BREAKING CHANGE: pip element plugin has been moved to the
+ bst-plugins-experimental repository.
+
==================
buildstream 1.93.0
diff --git a/doc/source/core_plugins.rst b/doc/source/core_plugins.rst
index 70691672b..f21ed89e4 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 93303748d..000000000
--- 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 <bochecha@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 294d4ad9a..000000000
--- 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 bfc4f8098..000000000
--- 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 72ec9b399..000000000
--- a/tests/integration/project/files/hello.tar.xz
+++ /dev/null
Binary files differ