summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2020-05-08 20:10:25 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2020-05-11 13:29:55 +0000
commit68cbdc527010b716561d7523c63d7b15757dcd1c (patch)
tree0c4e89d2604d5014d3069c1aa3e652c18251a519
parent615682352e4dfdbecbfb389860983060116c34eb (diff)
downloadbuildstream-bschubert/remove-pip-element.tar.gz
pip.py: Remove the pip element, it is in experimentalbschubert/remove-pip-element
The pip element was copied already to bst-plugins-experimental. We don't need to have two copies of it.
-rw-r--r--NEWS6
-rw-r--r--doc/source/core_plugins.rst1
-rw-r--r--src/buildstream/plugins/elements/pip.py51
-rw-r--r--src/buildstream/plugins/elements/pip.yaml36
-rw-r--r--tests/integration/pip_element.py117
5 files changed, 6 insertions, 205 deletions
diff --git a/NEWS b/NEWS
index 0b6882dc8..f7e79b13d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,12 @@ Format
source/element overrides section (See issue #1291)
+Plugins
+-------
+
+ o The `pip` element has been removed. Please use the one from bst-plugins-experimental
+
+
==================
buildstream 1.93.3
==================
diff --git a/doc/source/core_plugins.rst b/doc/source/core_plugins.rst
index e7889362b..b40728669 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 5f805f460..000000000
--- a/src/buildstream/plugins/elements/pip.py
+++ /dev/null
@@ -1,51 +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):
- # pylint: disable=attribute-defined-outside-init
-
- BST_MIN_VERSION = "2.0"
-
- # 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)