def cleanup(context, config, execute):
    LOGGER.debug("Running cleanup...")

    for command in config.get("commands", []):
        command = helpers.update_command(context, command)
        execute(command)

    if os.path.exists(context["checkinstall_deb_path"]):
        os.remove(context["checkinstall_deb_path"])

    LOGGER.debug("Finished running cleanup.")
def prepare(context, config, execute):
    build_requires = config.get("build_requires", [])
    if "checkinstall" not in build_requires:
        build_requires.insert(0, "checkinstall")

    LOGGER.debug(
        "Installing {} build requirements...".format(len(build_requires)))
    if build_requires:
        execute("apt-get update")
        command = "apt-get install -y " + " ".join(map(
            lambda x: "{}", build_requires))
        execute(command, *build_requires)

    LOGGER.debug("Finished installing build requirements.")

    for command in config.get("commands", []):
        command = helpers.update_command(context, command)
        execute(command)
Example #3
0
 def test_update_command(self):
     context = {"foo": "bar", "bar": "baz"}
     command = "do $C:FOO with $C:BAR and $PATH"
     output = update_command(context, command)
     self.assertEqual("do bar with baz and /tmp", output)