Commit bf591ade authored by Chandan Singh's avatar Chandan Singh Committed by Chandan Singh
Browse files

Derive import plugin from Element instead of BuildElement

The `import` element is not really a build element. The main purpose of
the `BuildElement` class is to allow users to run `build-commands`,
`install-commands` etc. But, `import` does not run such commands.
Moreover, we already override all the methods provided by
`BuildElement`. So it only makes it confusing to have it derived from
`BuildElement` class when it is not a build element.

So, derive it from the base `Element` class instead.
parent d114a6bd
Loading
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -28,17 +28,14 @@ some configuration data.
The empty configuration is as such:
  .. literalinclude:: ../../../buildstream/plugins/elements/import.yaml
     :language: yaml

See :ref:`built-in functionality documentation <core_buildelement_builtins>` for
details on common configuration options for build elements.
"""

import os
from buildstream import Element, BuildElement, ElementError
from buildstream import Element, ElementError


# Element implementation for the 'import' kind.
class ImportElement(BuildElement):
class ImportElement(Element):
    # pylint: disable=attribute-defined-outside-init

    # This plugin has been modified to avoid the use of Sandbox.get_directory
@@ -93,10 +90,6 @@ class ImportElement(BuildElement):
        # And we're done
        return '/output'

    def prepare(self, sandbox):
        # We inherit a non-default prepare from BuildElement.
        Element.prepare(self, sandbox)

    def generate_script(self):
        build_root = self.get_variable('build-root')
        install_root = self.get_variable('install-root')