Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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"))
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"))
def test_unsupported_base_raises(self):
self.assertRaises(
errors.PluginBaseError,
python.PythonPlugin,
"test-part",
self.options,
self.project,
)
def test_unsupported_base_raises(self):
self.assertRaises(
errors.PluginBaseError,
dotnet.DotNetPlugin,
"test-part",
self.options,
self.project,
)
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)
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)
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"),
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)