示例#1
0
    def clear(self):
        if self.hmmcmd_temp_dir is not None and pisdir(self.hmmcmd_temp_dir):
            try:
                shutil.rmtree(self.hmmcmd_temp_dir)
            except OSError as err:
                print(
                    f"Warning: OS error while removing {self.hmmcmd_temp_dir}",
                    file=sys.stderr)
                print(f"OS error: {err}", file=sys.stderr)

        if self.phmmer_temp_dir is not None and pisdir(self.phmmer_temp_dir):
            try:
                shutil.rmtree(self.phmmer_temp_dir)
            except OSError as err:
                print(
                    f"Warning: OS error while removing {self.phmmer_temp_dir}",
                    file=sys.stderr)
                print(f"OS error: {err}", file=sys.stderr)

        # Shutdown server, If a temp local server was set up
        if (self.setup_type == SETUP_TYPE_EGGNOG or self.setup_type
                == SETUP_TYPE_CUSTOM) and self.scantype == SCANTYPE_MEM:
            for dbpath, port, master_pid, workers_pids in self.servers:
                shutdown_server_by_pid(master_pid, workers_pids)
            self.servers = []

        return
示例#2
0
 def clear(self):
     if self.outdir is not None and pisdir(self.outdir):
         try:
             shutil.rmtree(self.outdir)
         except OSError as err:
             print(f"Warning: OS error while removing {self.outdir}",
                   file=sys_stderr)
             print(f"OS error: {err}", file=sys_stderr)
     return
示例#3
0
文件: extract.py 项目: qnap-dev/qdk2
    def run(self):
        directory = pjoin(self._args.directory)

        if pexists(directory) and not pisdir(directory):
            error('{} is not directory'.format(directory))
            return -1
        if not pexists(self._args.file) and pisdir(self._args.file):
            error('{} is not file'.format(self._args.file))
            return -1
        if not pexists(directory):
            makedirs(directory)
        if self._args.as_qpkg:
            self.extract_qpkg(self._args.file, directory)
        elif self._args.as_image:
            self.extract_image(self._args.file, directory)
        elif self._args.file.endswith('.img'):
            self.extract_image(self._args.file, directory)
        elif self._args.file.endswith('.qpkg'):
            self.extract_qpkg(self._args.file, directory)
        else:
            error('Unknown file suffix. Speicify --qpkg or --image')
            return -1
        return 0
示例#4
0
    def run(self):
        directory = pjoin(self._args.directory)

        if pexists(directory) and not pisdir(directory):
            error('{} is not directory'.format(directory))
            return -1
        if not pexists(self._args.file) and pisdir(self._args.file):
            error('{} is not file'.format(self._args.file))
            return -1
        if not pexists(directory):
            makedirs(directory)
        if self._args.as_qpkg:
            self.extract_qpkg(self._args.file, directory)
        elif self._args.as_image:
            self.extract_image(self._args.file, directory)
        elif self._args.file.endswith('.img'):
            self.extract_image(self._args.file, directory)
        elif self._args.file.endswith('.qpkg'):
            self.extract_qpkg(self._args.file, directory)
        else:
            error('Unknown file suffix. Speicify --qpkg or --image')
            return -1
        return 0