How to use the snapcraft.internal.errors.PluginBaseError function in snapcraft

To help you get started, we’ve selected a few snapcraft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github snapcore / snapcraft / tests / unit / plugins / test_kbuild.py View on Github external
def test_unsupported_base(self):
        project = snapcraft.project.Project(
            snapcraft_yaml_file_path=self.make_snapcraft_yaml(
                textwrap.dedent(
                    """\
                    name: test-snap
                    base: unsupported-base
                    """
                )
            )
        )

        raised = self.assertRaises(
            errors.PluginBaseError,
            kbuild.KBuildPlugin,
            "test-part",
            self.options,
            project,
        )

        self.assertThat(raised.part_name, Equals("test-part"))
        self.assertThat(raised.base, Equals("unsupported-base"))
github snapcore / snapcraft / tests / unit / plugins / test_autotools.py View on Github external
def test_unsupported_base(self):
        project = snapcraft.project.Project(
            snapcraft_yaml_file_path=self.make_snapcraft_yaml(
                textwrap.dedent(
                    """\
                    name: cmake-snap
                    base: unsupported-base
                    """
                )
            )
        )

        raised = self.assertRaises(
            errors.PluginBaseError,
            autotools.AutotoolsPlugin,
            "test-part",
            self.options,
            project,
        )

        self.assertThat(raised.part_name, Equals("test-part"))
        self.assertThat(raised.base, Equals("unsupported-base"))
github snapcore / snapcraft / tests / unit / plugins / test_python.py View on Github external
def test_unsupported_base_raises(self):
        self.assertRaises(
            errors.PluginBaseError,
            python.PythonPlugin,
            "test-part",
            self.options,
            self.project,
        )
github snapcore / snapcraft / tests / unit / plugins / test_dotnet.py View on Github external
def test_unsupported_base_raises(self):
        self.assertRaises(
            errors.PluginBaseError,
            dotnet.DotNetPlugin,
            "test-part",
            self.options,
            self.project,
        )
github snapcore / snapcraft / snapcraft / plugins / plainbox_provider.py View on Github external
def _setup_base_tools(self, base):
        if base in ("core", "core16", "core18"):
            self.stage_packages.extend(
                ["python3-pip", "python3-wheel", "python3-setuptools"]
            )
            self.build_packages.append("intltool")
        else:
            raise errors.PluginBaseError(part_name=self.name, base=base)
github snapcore / snapcraft / snapcraft / plugins / go.py View on Github external
def _setup_base_tools(self, go_channel: str, base: Optional[str]) -> None:
        if go_channel:
            self.build_snaps.append("go/{}".format(go_channel))
        elif base in ("core", "core16", "core18"):
            self.build_packages.append("golang-go")
        else:
            raise errors.PluginBaseError(part_name=self.name, base=base)
github snapcore / snapcraft / snapcraft / plugins / ant.py View on Github external
def _create_symlinks(self):
        base = self.project.info.get_build_base()
        if base not in ("core18", "core16", "core"):
            raise errors.PluginBaseError(part_name=self.name, base=base)

        os.makedirs(os.path.join(self.installdir, "bin"), exist_ok=True)
        java_bin = glob(
            os.path.join(
                self.installdir,
                "usr",
                "lib",
                "jvm",
                "java-{}-openjdk-*".format(self._java_version),
                "bin",
                "java",
            )
        )[0]
        os.symlink(
            os.path.relpath(java_bin, os.path.join(self.installdir, "bin")),
            os.path.join(self.installdir, "bin", "java"),
github snapcore / snapcraft / snapcraft / plugins / scons.py View on Github external
def _setup_base_tools(self, base):
        if base in ("core", "core16", "core18"):
            self.build_packages.append("scons")
        else:
            raise errors.PluginBaseError(part_name=self.name, base=base)