How to use the pybombs.utils.subproc.monitor_process function in PyBOMBS

To help you get started, we’ve selected a few PyBOMBS 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 gnuradio / pybombs / pybombs / commands / digraph.py View on Github external
rec = recipe.get_recipe(pkg, fail_easy=True)
            if rec is None:
                continue
            for dep in rec.depends:
                if dep in packages:
                    f.write(" {pkg} -> {dep}\n".format(
                        pkg=pkg_safe,
                        dep=dep.replace("-", "_")
                    ))
        f.write("}\n")
        f.close()
        self.log.debug("{0} written".format(dotfile))
        if pngfile is None:
            return
        self.log.info("Creating png file {0}".format(pngfile))
        subproc.monitor_process(
            ['dot', dotfile, '-Tpng', '-o{0}'.format(pngfile)],
            env=os.environ,
        )
github gnuradio / pybombs / pybombs / fetchers / svn.py View on Github external
def fetch_url(self, url, dest, dirname, args=None):
        """
        - url: SVN repo url
        - dest: src dir
        - dirname: Put the result into a dir with this name, it'll be a subdir of dest
        - args: Additional args to pass to the actual fetcher
        """
        args = args or {}
        svn_cmd = ['svn', 'co']
        if args.get('svnrev') is not None:
            svn_cmd.append('-r')
            svn_cmd.append(args.get('svnrev'))
        svn_cmd.append(url)
        svn_cmd.append(dirname)
        subproc.monitor_process(
            args=svn_cmd,
            #o_proc=foo, # FIXME
            throw_ex=True,
        )
        return True
github gnuradio / pybombs / pybombs / fetchers / git.py View on Github external
# with the remote branch
            git_cmds = [
                ['git', 'fetch', '--tags', '--all', '--prune'],
                ['git', 'checkout', '--force', args.get('gitbranch')],
                ['git', 'reset', '--hard', '@{u}'],
            ]
        else:
            # Without a git rev, all we can do is try and pull
            git_cmds = [
                ['git', 'pull', '--rebase'],
            ]
        git_cmds.append(['git', 'submodule', 'update', '--recursive'])
        o_proc = None
        for cmd in git_cmds:
            try:
                if subproc.monitor_process(args=cmd, o_proc=o_proc, throw_ex=True) != 0:
                    self.log.error("Could not run command `{0}`".format(" ".join(cmd)))
                    return False
            except Exception:
                self.log.error("Could not run command `{0}`".format(" ".join(cmd)))
                raise PBException("git commands failed.")
        self.log.trace("Switching cwd back to: {0}".format(cwd))
        os.chdir(cwd)
        return True
github gnuradio / pybombs / pybombs / packagers / source.py View on Github external
def make(self, recipe, try_again=False):
        """
        Build this recipe.
        If try_again is set, it will assume the build failed before
        and we're trying to run it again. In this case, reduce the
        makewidth to 1 and show the build output.
        """
        self.log.debug("Building recipe {0}".format(recipe.id))
        self.log.debug("In cwd - {0}".format(os.getcwd()))
        o_proc = None
        if self.log.getEffectiveLevel() >= pb_logging.DEBUG and not try_again and not recipe.make_interactive:
            o_proc = output_proc.OutputProcessorMake(preamble="Building:    ")
        cmd = recipe.var_replace_all(self.get_command('make', recipe))
        cmd = self.filter_cmd(cmd, recipe, 'make_filter')
        if subproc.monitor_process(cmd, shell=True, o_proc=o_proc) == 0:
            self.log.debug("Make successful")
            return True
        # OK, something bad happened.
        if try_again == False:
            recipe.vars['makewidth'] = '1'
            self.make(recipe, try_again=True)
        else:
            self.log.error("Build failed. See output above for error messages.")
            raise PBException("Build failed.")