コード例 #1
0
    def __init__(self, directory_path, *args):
        """See Task.__init__"""
        super().__init__()
        self.directory_path = xtask.parse_path(directory_path)

        self.args = []
        for arg in args:
            arg = xtask.task_variables_to_value(arg)
            self.args.append(arg)
コード例 #2
0
    def start(self, process_name, *args):
        """Starts a process."""
        if Process.is_running(process_name):
            self._error("Process '{}' is already running".format(process_name))
            return False

        if len(args) < 2:
            self._error("'directory' and 'command' arguments not given but mandatory")
            return False

        directory_path = xtask.parse_path(args[0])

        if not directory_path.exists():
            self._error("Location {} does not exist".format(directory_path))
            return False

        command = args[1]
        args = list(args[2:])

        if command.startswith("."):
            command_path = directory_path / command
            if not command_path.exists():
                self._error("Cannot find command {}".format(command_path))
            else:
                command = str(command_path)
        elif pexpect.which(command) is None:
            self._error("Unknown command '{}'".format(command))
            return False

        try:
            self._info(
                "Starting process '{}' by calling '{} {}' in directory {}".format(
                    process_name, command, " ".join(args), directory_path
                )
            )
            process = pexpect.spawn(command, args, cwd=directory_path, timeout=5)
            Process._processes[process_name] = process
        except Exception:
            self._exception(
                "Something went wrong while starting process '{}'".format(process_name)
            )
            return False

        return True
コード例 #3
0
 def __init__(self, directory_path):
     """See `Task.__init__`."""
     super().__init__()
     self.directory_path = xtask.parse_path(directory_path)
コード例 #4
0
 def __init__(self, file_path):
     """See `Task.__init__`."""
     super().__init__()
     self.file_path = xtask.parse_path(file_path)
コード例 #5
0
 def __init__(self, directory_path, target_directory_path):
     """See `Task.__init__`"""
     super().__init__()
     self.directory_path = xtask.parse_path(directory_path)
     self.target_directory_path = xtask.parse_path(target_directory_path)
コード例 #6
0
 def __init__(self, repo_link, repo_path):
     """See `Task.__init__`"""
     super().__init__()
     self.repo_link = repo_link
     self.repo_path = xtask.parse_path(repo_path)
コード例 #7
0
 def __init__(self, repo_path):
     """See Task.__init__"""
     super().__init__()
     self.repo_path = xtask.parse_path(repo_path)
コード例 #8
0
ファイル: CopyResource.py プロジェクト: XanX3601/xinstall
 def __init__(self, resource_name, destination_path):
     """See `Task.__init__`"""
     super().__init__()
     self.resource_name = resource_name
     self.destination_path = xtask.parse_path(destination_path)
コード例 #9
0
 def __init__(self, tarfile_path, extract_path):
     """See `Task.__init__`."""
     super().__init__()
     self.tarfile_path = xtask.parse_path(tarfile_path)
     self.extract_path = xtask.parse_path(extract_path)
コード例 #10
0
ファイル: SymLink.py プロジェクト: XanX3601/xinstall
 def __init__(self, link_location, link_target):
     """See `Task.__init__`."""
     super().__init__()
     self.link_location = xtask.parse_path(link_location)
     self.link_target = xtask.parse_path(link_target)