Beispiel #1
0
    def cmdline(
        self,
        target: Optional[Union[str, List[str]]] = None,
        jobs: Optional[int] = None,
        exec_dir: Optional[str] = None,
        timeout: Optional[float] = None,
    ) -> Dict[str, Union[List[str], dict]]:
        """Return the make command line.

        :param target: optional target or list of targets to use
            (use default_target if None)
        :param jobs: see __init__ documentation
        :param exec_dir: see __init__ documentation
        :param timeout: timeout to pass to ex.Run

        :return: a dictionary with the following keys
           - cmd: containing the command line to pass to gnatpython.ex.Run
           - options: options to pass to gnatpython.ex.Run
        """
        cmd_arg_list = ["make"]

        if self.makefile is not None:
            cmd_arg_list += ["-f", unixpath(self.makefile)]

        cmd_arg_list += [
            "-j",
            "%s" % str(jobs) if jobs is not None else str(self.jobs)
        ]

        for key in self.var_list:
            cmd_arg_list.append("{}={}".format(key, self.var_list[key]))

        if target is None:
            target = self.default_target

        if target is not None:
            if isinstance(target, list):
                cmd_arg_list += target
            else:
                cmd_arg_list.append(target)

        options = {"cwd": exec_dir or self.exec_dir, "timeout": timeout}

        return {
            "cmd":
            parse_command(command=cmd_arg_list,
                          build_space=self.anod_instance.build_space),
            "options":
            options,
        }
Beispiel #2
0
    def cmdline(self):
        """Return the configure command line.

        :return: a dictionary with the following keys
           - cmd: containing the command line to pass to gnatpython.ex.Run
           - options: options to pass to gnatpython.ex.Run
        :rtype: dict

        If CONFIG_SHELL environment variable is set, the configure will be
        called with this shell.
        """
        cmd = []
        if "CONFIG_SHELL" in os.environ:
            cmd.append(os.environ["CONFIG_SHELL"])

        # Compute the relative path for configure
        configure_path = unixpath(
            os.path.relpath(os.path.join(self.src_dir, "configure"),
                            self.exec_dir))

        # In case the configure is run from its location ensure to
        # add ./ as . is not necessary in PATH.
        if configure_path == "configure":
            configure_path = "./configure"
        cmd += [configure_path]
        cmd += self.args

        if self.target is not None:
            cmd.append("--target=" + self.target)

        if self.host is not None:
            cmd.append("--host=" + self.host)

        if self.build is not None:
            cmd.append("--build=" + self.build)

        cmd_options = {
            "cwd": self.exec_dir,
            "ignore_environ": False,
            "env": self.env
        }

        return {
            "cmd":
            parse_command(command=cmd,
                          build_space=self.anod_instance.build_space),
            "options":
            cmd_options,
        }
Beispiel #3
0
    def cmdline(self, target=None, jobs=None, exec_dir=None, timeout=None):
        """Return the make command line.

        :param target: the target to use (use default_target if None)
        :type target: str | None
        :param jobs: see __init__ documentation
        :type jobs: int | None
        :param exec_dir: see __init__ documentation
        :type exec_dir: str | None
        :param timeout: timeout to pass to ex.Run
        :type timeout: int | None

        :return: a dictionary with the following keys
           - cmd: containing the command line to pass to gnatpython.ex.Run
           - options: options to pass to gnatpython.ex.Run
        :rtype: dict
        """
        cmd_arg_list = ["make"]

        if self.makefile is not None:
            cmd_arg_list += ["-f", unixpath(self.makefile)]

        cmd_arg_list += [
            "-j",
            "%s" % str(jobs) if jobs is not None else str(self.jobs)
        ]

        for key in self.var_list:
            cmd_arg_list.append("%s=%s" % (key, self.var_list[key]))

        if target is None:
            target = self.default_target

        if target is not None:
            if isinstance(target, list):
                cmd_arg_list += target
            else:
                cmd_arg_list.append(target)

        options = {"cwd": exec_dir or self.exec_dir, "timeout": timeout}

        return {
            "cmd":
            parse_command(command=cmd_arg_list,
                          build_space=self.anod_instance.build_space),
            "options":
            options,
        }
    def cmdline(self, target=None, jobs=None, exec_dir=None, timeout=None):
        """Return the make command line.

        :param target: the target to use (use default_target if None)
        :type target: str | None
        :param jobs: see __init__ documentation
        :type jobs: int | None
        :param exec_dir: see __init__ documentation
        :type exec_dir: str | None
        :param timeout: timeout to pass to ex.Run
        :type timeout: int | None

        :return: a dictionary with the following keys
           - cmd: containing the command line to pass to gnatpython.ex.Run
           - options: options to pass to gnatpython.ex.Run
        :rtype: dict
        """
        cmd_arg_list = ['make']

        if self.makefile is not None:
            cmd_arg_list += ['-f', unixpath(self.makefile)]

        cmd_arg_list += [
            '-j', '%s' % str(jobs) if jobs is not None else str(self.jobs)]

        for key in self.var_list:
            cmd_arg_list.append("%s=%s" % (key, self.var_list[key]))

        if target is None:
            target = self.default_target

        if target is not None:
            if isinstance(target, list):
                cmd_arg_list += target
            else:
                cmd_arg_list.append(target)

        options = {
            'cwd': exec_dir or self.exec_dir,
            'timeout': timeout}

        return {
            'cmd': parse_command(
                command=cmd_arg_list,
                build_space=self.anod_instance.build_space),
            'options': options}
Beispiel #5
0
    def cmdline(self):
        """Return the configure command line.

        :return: a dictionary with the following keys
           - cmd: containing the command line to pass to gnatpython.ex.Run
           - options: options to pass to gnatpython.ex.Run
        :rtype: dict

        If CONFIG_SHELL environment variable is set, the configure will be
        called with this shell.
        """
        cmd = []
        if 'CONFIG_SHELL' in os.environ:
            cmd.append(os.environ['CONFIG_SHELL'])
        cmd += [
            unixpath(
                os.path.relpath(os.path.join(self.src_dir, 'configure'),
                                self.exec_dir))
        ]
        cmd += self.args

        if self.target is not None:
            cmd.append('--target=' + self.target)

        if self.host is not None:
            cmd.append('--host=' + self.host)

        if self.build is not None:
            cmd.append('--build=' + self.build)

        cmd_options = {
            'cwd': self.exec_dir,
            'ignore_environ': False,
            'env': self.env
        }

        return {
            'cmd':
            parse_command(command=cmd,
                          build_space=self.anod_instance.build_space),
            'options':
            cmd_options
        }
    def cmdline(self):
        """Return the configure command line.

        :return: a dictionary with the following keys
           - cmd: containing the command line to pass to gnatpython.ex.Run
           - options: options to pass to gnatpython.ex.Run
        :rtype: dict

        If CONFIG_SHELL environment variable is set, the configure will be
        called with this shell.
        """
        cmd = []
        if 'CONFIG_SHELL' in os.environ:
            cmd.append(os.environ['CONFIG_SHELL'])
        cmd += [unixpath(os.path.relpath(
            os.path.join(self.src_dir, 'configure'), self.exec_dir))]
        cmd += self.args

        if self.target is not None:
            cmd.append('--target=' + self.target)

        if self.host is not None:
            cmd.append('--host=' + self.host)

        if self.build is not None:
            cmd.append('--build=' + self.build)

        cmd_options = {'cwd': self.exec_dir,
                       'ignore_environ': False,
                       'env': self.env}

        return {
            'cmd': parse_command(
                command=cmd,
                build_space=self.anod_instance.build_space),
            'options': cmd_options}