def test_get_build_environment(self): plugin = AutotoolsPlugin(part_name="my-part", options=lambda: None) self.assertThat( plugin.get_build_environment(), Equals({"SNAPCRAFT_AUTOTOOLS_INSTALL_PREFIX": "/"}), )
def test_get_build_packages(self): plugin = AutotoolsPlugin(part_name="my-part", options=lambda: None) self.assertThat( plugin.get_build_packages(), Equals({"autoconf", "automake", "autopoint", "gcc", "libtool"}), )
def test_get_build_packages(): plugin = AutotoolsPlugin(part_name="my-part", options=lambda: None) assert plugin.get_build_packages() == { "autoconf", "automake", "autopoint", "gcc", "libtool", }
def test_get_build_commands_with_configure_parameters(): class Options: autotools_configure_parameters = ["--with-foo=true", "--prefix=/foo"] plugin = AutotoolsPlugin(part_name="my-part", options=Options()) assert plugin.get_build_commands() == [ "[ ! -f ./configure ] && [ -f ./autogen.sh ] && env NOCONFIGURE=1 ./autogen.sh", "[ ! -f ./configure ] && [ -f ./bootstrap ] && env NOCONFIGURE=1 ./bootstrap", "[ ! -f ./configure ] && autoreconf --install", "./configure --with-foo=true --prefix=/foo", 'make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"', 'make install DESTDIR="${SNAPCRAFT_PART_INSTALL}"', ]
def test_get_build_commands(): class Options: autotools_configure_parameters = list() autotools_configure_environment = list() plugin = AutotoolsPlugin(part_name="my-part", options=Options()) assert plugin.get_build_commands() == [ "[ ! -f ./configure ] && [ -f ./autogen.sh ] && env NOCONFIGURE=1 ./autogen.sh", "[ ! -f ./configure ] && [ -f ./bootstrap ] && env NOCONFIGURE=1 ./bootstrap", "[ ! -f ./configure ] && autoreconf --install", "CC=${SNAPCRAFT_ARCH_TRIPLET}-gcc ./configure --host=${SNAPCRAFT_ARCH_TRIPLET}", 'make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"', 'make install DESTDIR="${SNAPCRAFT_PART_INSTALL}"', ]
def test_get_build_commands(self): class Options: autotools_configure_parameters = list() plugin = AutotoolsPlugin(part_name="my-part", options=Options()) self.assertThat( plugin.get_build_commands(), Equals([ "[ ! -f ./configure ] && autoreconf --install", "./configure", 'make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"', 'make install DESTDIR="${SNAPCRAFT_PART_INSTALL}"', ]), )
def test_get_build_commands_with_configflags(self): class Options: configflags = ["--with-foo=true", "--prefix=/foo"] plugin = AutotoolsPlugin(part_name="my-part", options=Options()) self.assertThat( plugin.get_build_commands(), Equals([ "[ ! -f ./configure ] && autoreconf --install", "./configure --with-foo=true --prefix=/foo", 'make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"', 'make install DESTDIR="${SNAPCRAFT_PART_INSTALL}"', ]), )
def test_get_build_commands(self): class Options: configflags = list() plugin = AutotoolsPlugin(part_name="my-part", options=Options()) self.assertThat( plugin.get_build_commands(), Equals([ "[ ! -f ./configure ] && autoreconf --install", './configure --prefix="${SNAPCRAFT_AUTOTOOLS_INSTALL_PREFIX}"', 'make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"', 'make install DESTDIR="${SNAPCRAFT_PART_INSTALL}"', ]), )
def test_schema(): assert AutotoolsPlugin.get_schema() == { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "additionalProperties": False, "properties": { "autotools-configure-parameters": { "type": "array", "uniqueItems": True, "items": { "type": "string" }, "default": [], } }, }
def test_schema(self): schema = AutotoolsPlugin.get_schema() self.assertThat( schema, Equals({ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "additionalProperties": False, "properties": { "configflags": { "type": "array", "minitems": 1, "uniqueItems": True, "items": { "type": "string" }, "default": [], } }, }), )
def test_get_build_environment(self): plugin = AutotoolsPlugin(part_name="my-part", options=lambda: None) self.assertThat(plugin.get_build_environment(), Equals(dict()))
def test_get_build_environment(): plugin = AutotoolsPlugin(part_name="my-part", options=lambda: None) assert plugin.get_build_environment() == dict()