当前位置: 首页>>代码示例>>Python>>正文


Python debfile.DebPackage类代码示例

本文整理汇总了Python中apt.debfile.DebPackage的典型用法代码示例。如果您正苦于以下问题:Python DebPackage类的具体用法?Python DebPackage怎么用?Python DebPackage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DebPackage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _test

def _test():
    """Test function"""
    import sys

    import apt
    from apt.debfile import DebPackage

    win = gtk.Window()
    apt_progress = GtkAptProgress()
    win.set_title("GtkAptProgress Demo")
    win.add(apt_progress)
    apt_progress.show()
    win.show()
    cache = apt.cache.Cache(apt_progress.open)
    pkg = cache["xterm"]
    if pkg.is_installed:
        pkg.mark_delete()
    else:
        pkg.mark_install()
    apt_progress.show_terminal(True)
    try:
        cache.commit(apt_progress.acquire, apt_progress.install)
    except Exception as exc:
        print >> sys.stderr, "Exception happened:", exc
    if len(sys.argv) > 1:
        deb = DebPackage(sys.argv[1], cache)
        deb.install(apt_progress.dpkg_install)
    win.connect("destroy", gtk.main_quit)
    gtk.main()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:29,代码来源:gtk2.py

示例2: DebFile

class DebFile():

    # the deb file which user selected
    debfile = ''

    path = ''
    name = ''
    version = ''
    installedsize = -1
    description = ''

    def __init__(self, path):
        self.debfile = DebPackage(path)
        self.get_deb_info()

        self.path = path

    # check if the deb file is installable
    def is_installable(self):
        return self.debfile.check()

    # get missing dependencies
    def get_missing_deps(self):
        return self.debfile.missing_deps

    # get deb file name, version, installedsize, description
    def get_deb_info(self):
        self.name = self.debfile._sections["Package"]
        self.version = self.debfile._sections["Version"]
        self.installedsize = int(self.debfile._sections["Installed-Size"])
        self.description = self.debfile._sections["Description"]

    # install the deb file
    def install_deb(self):
        self.debfile.install(AptProcess(self.debfile.pkgname))
开发者ID:pombredanne,项目名称:software-center,代码行数:35,代码来源:debfile.py

示例3: WriteCacheInfo

def WriteCacheInfo(p):
    if not os.path.isdir(cache_file_dir):
        if MakeDirs(cache_file_dir) is not None:
            return False
    if len(p.LocalPath) < 1:
        return False
    if apt is not None and os.path.splitext(p.LocalPath)[-1] == '.deb':
        from apt.debfile import DebPackage
        try:
            pkg = DebPackage(p.LocalPath)
        except:
            print("Exception opening file " + p.LocalPath, file=sys.stderr)
            LG().Log('ERROR',  "Exception opening file " + p.LocalPath)
            return False
        p.Name = pkg.pkgname
    elif rpm is not None and os.path.splitext(p.LocalPath)[-1] == '.rpm':
            with opened_w_error(p.LocalPath, 'r') as (F, error):
                if error:
                    print(
                        "Exception opening file " + p.LocalPath, file=sys.stderr)
                    LG().Log('ERROR',  "Exception opening file " + p.LocalPath)
                    return False
                ts = rpm.TransactionSet()
                ts.setVSFlags(-1)
                try:
                    pkg = ts.hdrFromFdno(F.fileno())
                except rpm.error, e:
                    print(repr(e))
                    LG().Log('ERROR',  repr(e))
                    pkg = None
            if pkg is None:
                return False
            p.Name = pkg.dsOfHeader().N()
开发者ID:AMDmi3,项目名称:WPSDSCLinux,代码行数:33,代码来源:nxPackage.py

示例4: IsPackageInstalled

def IsPackageInstalled(p):
    out = ''
    if p is None:
        return False, out
    if len(p.FilePath) > 0 and '://' in p.FilePath:  # its a remote - try to file get name from cache
        if ReadCacheInfo(p) is False:
            return False, out
    elif len(p.FilePath) > 0 and os.path.exists(p.FilePath) is True:  # FilePath
        if apt is not None and os.path.splitext(p.FilePath)[-1] == '.deb':
            from apt.debfile import DebPackage
            pkg = DebPackage(p.FilePath)
            p.Name = pkg.pkgname
        elif rpm is not None and os.path.splitext(p.FilePath)[-1] == '.rpm':
            with open(p.FilePath, 'r') as F:
                ts = rpm.TransactionSet()
                ts.setVSFlags(-1)
                try:
                    pkg = ts.hdrFromFdno(F.fileno())
                except rpm.error, e:
                    print(repr(e))
                    LG().Log('ERROR', repr(e))
                    pkg = None
            if pkg is None:
                return False, out
            p.Name = pkg.dsOfHeader().N()
开发者ID:AMDmi3,项目名称:WPSDSCLinux,代码行数:25,代码来源:nxPackage.py

示例5: install_debfile

 def install_debfile(self, path, kwargs=None):
     debfile = DebPackage(path)
     pkgName = debfile._sections["Package"]
     try:
         debfile.install(AptProcess(self.dbus_service,pkgName,AppActions.INSTALLDEBFILE))
     except Exception, e:
         print e
         print "install debfile err"
开发者ID:pombredanne,项目名称:software-center,代码行数:8,代码来源:apt_daemon.py

示例6: build_debian_package

def build_debian_package(package_fetcher, package_name, apt_cache, rd_obj, levels=0, get_dependencies=False):
  unstable_target_distros = { 'groovy': 'quantal', 'hydro': 'raring' }
  target_ubuntu_distro = unstable_target_distros[rd_obj._rosdistro]
  level_prefix = '--' * levels
  print("%s> Building package %s" % (level_prefix, package_name))
  deb_package_name = rd_obj.debianize_package_name(package_name)
  deb_package_version = rd_obj.get_version(package_name, full_version=True) + target_ubuntu_distro
  print("%s--> Checking if installed (%s, %s).." % (level_prefix, deb_package_name, deb_package_version)),
  if deb_package_name in apt_cache:
    installed = apt_cache[deb_package_name].installed
    if installed is not None and installed.version == deb_package_version:
      print("OK")
      print("%s is installed already - remove the package if you want to re-install." % (package_name))
      return True
  print("missing!")
  if get_dependencies:
    dependencies = package_build_order([package_name], distro_name=rd_obj._rosdistro)
    print("%s--> Checking Dependencies:" % (level_prefix))
    for dep_pkg_name in dependencies:
      if dep_pkg_name != package_name:
        print("%s---- %s....." % (level_prefix, dep_pkg_name)),
        debian_pkg_name = rd_obj.debianize_package_name(dep_pkg_name)
        if debian_pkg_name in apt_cache and apt_cache[debian_pkg_name].installed is not None:
          print(" OK! (installed version %s)" % apt_cache[debian_pkg_name].installed.version)
        else:
          print(" Needs build, building...")
          build_debian_package(package_fetcher, dep_pkg_name, apt_cache, rd_obj, levels + 1)
    print("%s<<-- Dependencies OKAY." % (level_prefix))
  print("%s>>> Build debian package %s from repo %s" % (level_prefix, deb_package_name, package_fetcher.url(package_name)))
  repo_path = package_fetcher.checkout_package(package_name)
  client = GitClient(repo_path)
  deb_package_tag = deb_package_name + '_' + rd_obj.get_version(package_name, full_version=True) + '_' + target_ubuntu_distro
  bloom_package_version = 'debian/' + deb_package_tag
  client.update(bloom_package_version)
  installed_builddeps = install_debian_build_dependencies(repo_path)
  if not installed_builddeps:
    raise RosGitBuildError("%s!!! Error building %s from %s: Can't install build-dependencies!" % (level_prefix, deb_package_name, package_fetcher.url(package_name)))
  (returncode, result, message) = run_shell_command('debuild clean', repo_path, shell=True, show_stdout=False)
  if returncode != 0:
    raise RosGitBuildError("%s!!! Error building %s from %s: %s \n %s" % (level_prefix, deb_package_name, package_fetcher.url(package_name), 'debuild clean', message))
  (returncode, result, message) = run_shell_command('debuild binary', repo_path, shell=True, show_stdout=False)
  if returncode != 0:
    raise RosGitBuildError("%s!!! Error building %s from %s: %s \n %s" % (level_prefix, deb_package_name, package_fetcher.url(package_name), 'debuild binary', message))
  deb_files = glob.glob(os.path.join(repo_path, '..', '%s*.deb' % (deb_package_name + '_' + rd_obj.get_version(package_name, full_version=True))))
  if len(deb_files) > 0:
    # install the deb
    from apt.debfile import DebPackage
    deb_pkg = DebPackage(deb_files[0])
    deb_pkg.check()
    packages_needed = ' '.join(deb_pkg.missing_deps)
    (returncode, result, message) = run_shell_command('sudo apt-get -y install %s' % packages_needed, shell=True, show_stdout=True)
    if returncode != 0:
      raise RosGitBuildError("%s!!! Error building %s: can't install dependent packages %s" % (level_prefix, deb_package_name, packages_needed))
    (returncode, result, message) = run_shell_command('sudo dpkg -i %s' % deb_files[0], shell=True, show_stdout=True)
    if returncode != 0:
      raise RosGitBuildError("%s!!! Error building %s from %s: %s \n %s" % (level_prefix, deb_package_name, package_fetcher.url(package_name), 'debuild binary', message))
  else:
    raise RosGitBuildError("%s!!! Can't find a built debian package for %s after the build!" % (level_prefix, deb_package_name))
开发者ID:garyservin,项目名称:ros-debuild-install,代码行数:58,代码来源:ros_gbp_build_debians.py

示例7: IsPackageInstalled

def IsPackageInstalled(p):
    out = ''
    if p is None:
        return False, out
    if len(p.FilePath) > 0 and '://' in p.FilePath:  # its a remote - try to file get name from cache
        if ReadCacheInfo(p) is False:
            return False, out
    elif len(p.FilePath) > 0 and os.path.exists(p.FilePath) is True:  # FilePath
        if apt is not None and os.path.splitext(p.FilePath)[-1] == '.deb':
            from apt.debfile import DebPackage
            pkg = DebPackage(p.FilePath)
            p.Name = pkg.pkgname
        elif rpm is not None and os.path.splitext(p.FilePath)[-1] == '.rpm':
            with open(p.FilePath, 'r') as F:
                ts = rpm.TransactionSet()
                ts.setVSFlags(-1)
                try:
                    pkg = ts.hdrFromFdno(F.fileno())
                except rpm.error as e:
                    print(repr(e))
                    LG().Log('ERROR', repr(e))
                    pkg = None
            if pkg is None:
                return False, out
            p.Name = pkg.dsOfHeader().N()
    if len(p.Name) < 1:
        return False, out

    if p.PackageGroup is True:
        if p.cmds[p.PackageManager]['stat_group'] is not None:
            cmd = p.cmds[p.PackageManager]['stat_group'] + '"' + p.Name + '"'
        else:
            print('ERROR.  PackageGroup is not valid for ' +
                  p.PackageManager, file=sys.stdout)
            LG().Log(
                'ERROR', 'ERROR.  PackageGroup is not valid for ' + p.PackageManager)
            return False, out
    else:
        cmd = 'LANG=en_US.UTF8 ' + p.cmds[p.PackageManager]['stat'] + p.Name
    code, out = RunGetOutput(cmd, False)
    if p.PackageGroup is True:  # implemented for YUM only.
        if 'Installed' in out:
            return True, out
        else:
            return False, out
    # regular packages
    print('check installed:' + out)
    LG().Log('INFO',  'check installed:' + out)
    if code is 0:
        if 'deinstall' in out or 'not-installed' in out:
            code = 1
    if code is not int(p.ReturnCode):
        return False, out
    return True, out
开发者ID:andschwa,项目名称:PowerShell-DSC-for-Linux,代码行数:54,代码来源:nxPackage.py

示例8: main

def main(package):
    cache = apt.Cache()
    debfile = DebPackage(package, cache=cache)
    if debfile.check():
        show_dependencies(debfile)
        prompt = "Do you want to continue [Y/n]? "
        choice = input(prompt)
        if "y" == choice.lower() or not choice:
            try:
                cache.commit(apt.progress.text.AcquireProgress())
            except apt.cache.FetchFailedException as e:
                print(e)
        else:
            print("Abort.")
开发者ID:pombredanne,项目名称:wajig,代码行数:14,代码来源:debfile-deps.py

示例9: install_deps

    def install_deps(self, path, kwargs=None):
        debfile = DebPackage(path)
        pkgName = debfile._sections["Package"]
        debfile.check()
        deps = debfile.missing_deps

        if(len(deps) > 0):
            self.cache.open()
            for pkgn in deps:
                pkg = self.get_pkg_by_name(pkgn)
                pkg.mark_install()

            try:
                self.cache.commit(FetchProcess(self.dbus_service, pkgName, AppActions.INSTALLDEPS), AptProcess(self.dbus_service, pkgName, AppActions.INSTALLDEPS))
            except Exception, e:
                print e
                print "install err"
开发者ID:pombredanne,项目名称:software-center,代码行数:17,代码来源:apt_daemon.py

示例10: WriteCacheInfo

def WriteCacheInfo(p):
    if not os.path.isdir(cache_file_dir):
        if MakeDirs(cache_file_dir) is not None:
            return False
    if len(p.LocalPath) < 1:
        return False
    if apt is not None and os.path.splitext(p.LocalPath)[-1] == '.deb':
        from apt.debfile import DebPackage
        try:
            pkg = DebPackage(p.LocalPath)
        except:
            print("Exception opening file " + p.LocalPath, file=sys.stderr)
            LG().Log('ERROR',  "Exception opening file " + p.LocalPath)
            return False
        p.Name = pkg.pkgname
    elif rpm is not None and os.path.splitext(p.LocalPath)[-1] == '.rpm':
        with opened_w_error(p.LocalPath, 'r') as (F, error):
            if error:
                print("Exception opening file " + p.LocalPath, file=sys.stderr)
                LG().Log('ERROR',  "Exception opening file " + p.LocalPath)
                return False
            ts = rpm.TransactionSet()
            ts.setVSFlags(-1)
            try:
                pkg = ts.hdrFromFdno(F.fileno())
            except rpm.error as e:
                print(repr(e))
                LG().Log('ERROR',  repr(e))
                pkg = None
        if pkg is None:
            return False
        p.Name = pkg.dsOfHeader().N()
    if len(p.Name) < 1:
        return False
    cache_file_path = cache_file_dir + '/' + os.path.basename(p.LocalPath)
    with opened_w_error(cache_file_path, 'w+') as (F, error):
        if error:
            print("Exception creating cache file " + cache_file_path + " Error Code: " +
                  str(error.errno) + " Error: " + error.strerror, file=sys.stderr)
            LG().Log('ERROR',  "Exception creating cache file " + cache_file_path +
                     " Error Code: " + str(error.errno) + " Error: " + error.strerror)
            return False
        F.write(p.Name + '\n')
        F.close()
    return True
开发者ID:andschwa,项目名称:PowerShell-DSC-for-Linux,代码行数:45,代码来源:nxPackage.py

示例11: installdeb

 def installdeb(self, pkg):
     """
     Install the Debian package.
     
     :param pkg: The path to the package to install
     :type  pkg: str
     """
     
     # Get the DebPackage object and the filename
     dpkg     = DebPackage(filename=pkg, cache=self.cache)
     pkg_name = basename(pkg)
         
     # Look for package conflicts
     if not dpkg.check_conflicts():
         self.feedback.block(dpkg.conflicts, 'CONFLICT')
         self.feedback.error('Cannot install package <{0}>, conflicts with:'.format(pkg_name))
         return False
     
     # Get any version in cache
     cache_version = dpkg.compare_to_version_in_cache()
     action        = 'Installed'
     
     # Not installed
     if cache_version == dpkg.VERSION_NONE:
         self.feedback.info('Package <{0}> not installed'.format(pkg_name))
         
     # Upgrading
     if cache_version == dpkg.VERSION_OUTDATED:
         self.feedback.info('Package <{0}> outdated, upgrading'.format(pkg_name))
         action = 'Updated'
         
     # Same version
     if cache_version == dpkg.VERSION_SAME:
         return self.feedback.info('Package <{0}> already installed'.format(pkg_name))
     
     # Installed is newer
     if cache_version == dpkg.VERSION_NEWER:
         return self.feedback.info('Package <{0}> has newer version installed'.format(pkg_name))
         
     # Install the package
     dpkg.install()
     self.feedback.success('{0}: {1}'.format(action, pkg_name))
开发者ID:pombredanne,项目名称:lense-devtools,代码行数:42,代码来源:dpkg.py

示例12: __init__

    def __init__(self, db, doc=None, application=None):
        super(AppDetailsDebFile, self).__init__(db, doc, application)
        if doc:
            raise DebFileOpenError("AppDetailsDebFile: doc must be None.")

        self._error = None
        self._deb = None

        # check errors before creating the DebPackage
        if not os.path.exists(self._app.request):
            self._error = _("Not found")
            self._error_not_found = utf8(_(u"The file \u201c%s\u201d "
                "does not exist.")) % utf8(self._app.request)
        elif not is_deb_file(self._app.request):
            self._error = _("Not found")
            self._error_not_found = utf8(_(u"The file \u201c%s\u201d "
                "is not a software package.")) % utf8(self._app.request)

        if self._error is not None:
            return

        try:
            with ExecutionTime("create DebPackage"):
                # Cache() used to be faster here than self._cache._cache
                # but that is no longer the case with the latest apt
                self._deb = DebPackage(self._app.request, self._cache._cache)
        except:
            # deb files which are corrupt
            self._error = _("Internal Error")
            self._error_not_found = utf8(_(u"The file \u201c%s\u201d "
                "could not be opened.")) % utf8(self._app.request)
            return

        if self.pkgname and self.pkgname != self._app.pkgname:
            # this happens when the deb file has a quirky file name
            self._app.pkgname = self.pkgname

            # load pkg cache
            self._pkg = None
            if (self._app.pkgname in self._cache and
                    self._cache[self._app.pkgname].candidate):
                self._pkg = self._cache[self._app.pkgname]
            # load xapian document
            self._doc = None
            try:
                self._doc = self._db.get_xapian_document(
                    self._app.appname, self._app.pkgname)
            except:
                pass

        # check deb and set failure state on error
        with ExecutionTime("AppDetailsDebFile._deb.check()"):
            if not self._deb.check():
                self._error = self._deb._failure_string.strip()
开发者ID:pombredanne,项目名称:shop,代码行数:54,代码来源:debfile.py

示例13: __init__

    def __init__(self, db, doc=None, application=None):
        super(AppDetailsDebFile, self).__init__(db, doc, application)
        if doc:
            raise ValueError("doc must be None for deb files")

        try:
            # for some reason Cache() is much faster than "self._cache._cache"
            # on startup
            with ExecutionTime("create DebPackage"):
                self._deb = DebPackage(self._app.request, Cache())
        except:
            self._deb = None
            self._pkg = None
            if not os.path.exists(self._app.request):
                self._error = _("Not found")
                self._error_not_found = utf8(_(u"The file \u201c%s\u201d does not exist.")) % utf8(self._app.request)
            else:
                mimetype = guess_type(self._app.request)
                if mimetype[0] != "application/x-debian-package":
                    self._error =  _("Not found")
                    self._error_not_found = utf8(_(u"The file \u201c%s\u201d is not a software package.")) % utf8(self._app.request)
                else:
                    # deb files which are corrupt
                    self._error =  _("Internal Error")
                    self._error_not_found = utf8(_(u"The file \u201c%s\u201d could not be opened.")) % utf8(self._app.request)
            return

        if self.pkgname and self.pkgname != self._app.pkgname:
            # this happens when the deb file has a quirky file name
            self._app.pkgname = self.pkgname

            # load pkg cache
            self._pkg = None
            if (self._app.pkgname in self._cache and 
                self._cache[self._app.pkgname].candidate):
                self._pkg = self._cache[self._app.pkgname]
            # load xapian document
            self._doc = None
            try:
                self._doc = self._db.get_xapian_document(
                    self._app.appname, self._app.pkgname)
            except:
                pass

        # check deb and set failure state on error
        with ExecutionTime("AppDetailsDebFile._deb.check()"):
            if not self._deb.check():
                self._error = self._deb._failure_string
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:48,代码来源:debfile.py

示例14: get_changelog


#.........这里部分代码省略.........
        else:
            source_is_cache = uri.startswith(self.apt_cache_path)
            if _DEBUG: print("Using cached package:" if source_is_cache else
                "Downloading: %s (%.2f MB)" % (uri, r.length / self.MB))
            try:
                if not source_is_cache:
                    # download stream to temporary file
                    tmpFile = tempfile.NamedTemporaryFile(prefix="apt-changelog-")
                    if self.interactive and r.length:
                        # download chunks with progress indicator
                        recv_length = 0
                        blocks = 60
                        for data in r.iter_content(chunk_size=16384):
                            recv_length += len(data)
                            tmpFile.write(data)
                            recv_pct = recv_length / r.length
                            recv_blocks = int(blocks * recv_pct)
                            print("\r[%(progress)s%(spacer)s] %(percentage).1f%%" %
                                {
                                    "progress": "=" * recv_blocks,
                                    "spacer":  " " * (blocks - recv_blocks),
                                    "percentage": recv_pct * 100
                                }, end="", flush=True)
                        # clear progress bar when done
                        print("\r" + " " * (blocks + 10), end="\r", flush=True)
                    else:
                        # no content-length or non-interactive, download in one go
                        # up to the configured max_download_size, ask only when
                        # exceeded
                        r.raw.decode_content = True
                        size = 0
                        size_exceeded = False
                        while True:
                            buf = r.raw.read(16*1024)
                            if not size_exceeded:
                                size += len(buf)
                                if size > self.max_download_size:
                                    if not self.user_confirm(self.max_download_size_msg_unknown):
                                        r.close()
                                        tmpFile.close()
                                        return ""
                                    else:
                                        size_exceeded = True
                            if not buf:
                                break
                            tmpFile.write(buf)
                    r.close()
                    tmpFile.seek(0)
                if uri.endswith(".deb"):
                    # process .deb file
                    if source_is_cache:
                        f = uri
                    else:
                        f = tmpFile.name
                        # We could copy the downloaded .deb files to the apt
                        # cache here but then we'd need to run the script elevated:
                        # shutil.copy(f, self.apt_cache_path + os.path.basename(uri))
                    deb = DebPackage(f)
                    changelog_file = self.get_changelog_from_filelist(deb.filelist)
                    if changelog_file:
                        changelog = deb.data_content(changelog_file)
                        if changelog.startswith('Automatically decompressed:'):
                            changelog = changelog[29:]
                    else:
                        raise ValueError('Malformed Debian package')
                elif uri.endswith(".diff.gz"):
                    # Ubuntu partner repo has .diff.gz files,
                    # we can extract a changelog from that
                    data = gzip.open(tmpFile.name, "r").read().decode('utf-8')
                    additions = data.split("+++")
                    for addition in additions:
                        lines = addition.split("\n")
                        if "/debian/changelog" in lines[0]:
                            for line in lines[2:]:
                                if line.startswith("+"):
                                    changelog += "%s\n" % line[1:]
                                else:
                                    break
                    if not changelog:
                        raise ValueError('No changelog in .diff.gz')
                else:
                    # process .tar.xz file
                    with tarfile.open(fileobj=tmpFile, mode="r:xz") as tar:
                        changelog_file = self.get_changelog_from_filelist(
                            [s.name for s in tar.getmembers() if s.type in (b"0", b"2")])
                        if changelog_file:
                            changelog = tar.extractfile(changelog_file).read().decode()
                        else:
                            raise ValueError('No changelog in source package')
            except Exception as e:
                _generic_exception_handler(e)
                self.exit_on_fail(520)
            if 'tmpFile' in vars():
                try:
                    tmpFile.close()
                except Exception as e:
                    _generic_exception_handler(e)

        # ALL DONE
        return changelog
开发者ID:linuxmint,项目名称:mint-common,代码行数:101,代码来源:apt_changelog.py

示例15: GtkAptProgress

    from apt.debfile import DebPackage

    win = gtk.Window()
    apt_progress = GtkAptProgress()
    win.set_title("GtkAptProgress Demo")
    win.add(apt_progress)
    apt_progress.show()
    win.show()
    cache = apt.cache.Cache(apt_progress.open)
    pkg = cache["xterm"]
    if pkg.is_installed:
        pkg.mark_delete()
    else:
        pkg.mark_install()
    apt_progress.show_terminal(True)
    try:
        cache.commit(apt_progress.acquire, apt_progress.install)
    except Exception, exc:
        print >> sys.stderr, "Exception happened:", exc
    if len(sys.argv) > 1:
        deb = DebPackage(sys.argv[1], cache)
        deb.install(apt_progress.dpkg_install)
    win.connect("destroy", gtk.main_quit)
    gtk.main()


if __name__ == "__main__":
    _test()

# vim: ts=4 et sts=4
开发者ID:AbyssSong,项目名称:python-apt,代码行数:30,代码来源:gtk2.py


注:本文中的apt.debfile.DebPackage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。