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


Python api.PackageInfo类代码示例

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


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

示例1: search

    def search(self, query):
        try:
            out_s = subprocess.check_output(['pacman', '-Ss', query])
        except subprocess.CalledProcessError as cpe:
            self.context.notify('info', _('No search results found'))
            logging.info('No search results found')
            out_s = ''

        r = []
        for l in out_s.split('\n'):
            s = l.split('/')
            if len(s) == 2 and not(s[0].startswith('  ')):
                sn = s[1].split(' ')
                pkg = sn[0]

                p = PackageInfo()
                p.name = sn[0]

                pkg_installed = True
                try:
                    out_i = subprocess.check_output(['pacman', '-Q', p.name])
                except subprocess.CalledProcessError as cpe:
                    p.state = 'r'
                    pkg_installed = False

                if pkg_installed:
                    p.state = 'i'

                p.version = sn[1]
                r.append(p)

        return r
开发者ID:sevensky,项目名称:ajenti,代码行数:32,代码来源:pm_pacman.py

示例2: _parse_asv

    def _parse_asv(self, d):
        r = []
        for l in d.split('\n'):
            s = l.split('/')
            if len(s) == 0 or not s[0]:
                continue

            p = PackageInfo()
            p.name = s[0]
            r.append(p)
        return r
开发者ID:balchjd,项目名称:ajenti,代码行数:11,代码来源:pm_apt.py

示例3: search

    def search(self, query):
        out_s = subprocess.check_output(['apt-cache', 'search', query])
        r = []
        for l in out_s.split('\n'):
            s = filter(None, l.split(' '))
            if len(s) == 0:
                continue

            p = PackageInfo()
            p.name = s[0]
            p.state = 'i' if p.name in self.all_dict else 'r'
            p.description = ' '.join(s[2:])
            r.append(p)
        return r
开发者ID:balchjd,项目名称:ajenti,代码行数:14,代码来源:pm_apt.py

示例4: _parse_upgradeable

    def _parse_upgradeable(self, d):
        r = []
        for l in d.split('\n'):
            s = l.split(' ')
            if len(s) == 1:
                continue

            p = PackageInfo()
            p.action = 'i'

            p.name = s[0]
            p.version = s[1]
            r.append(p)
        return r
开发者ID:Carolusian,项目名称:ajenti,代码行数:14,代码来源:pm_pacman.py

示例5: _parse_yum

 def _parse_yum(self, ss):
     r = []
     for s in ss.splitlines():
         s = s.split()
         try:
             if s[0] == '':
                 continue
             else:
                 p = PackageInfo()
                 p.name = s[0]
                 p.state = 'i'
                 r.append(p)
             if len(r.keys()) > 250:
                 break
         except:
             pass
     return r
开发者ID:AlexSnet,项目名称:ajenti,代码行数:17,代码来源:pm_yum.py

示例6: search

 def search(self, query):
     out_s = subprocess.check_output(['yum', '-C', '-q', '-d0', '-e0', 'search', query])
     r = []
     for l in out_s.split('\n'):
         s = l.split()
         if len(s) < 2:
             continue
         if s[0].startswith('====') or s[0] == ':':
             continue
         else:
             p = PackageInfo()
             p.name = s[0]
             p.state = 'r'
             if p.name in self.all_dict and self.all_dict[p.name].state == 'i':
                 p.state = 'i'
             r.append(p)
     return r
开发者ID:AlexSnet,项目名称:ajenti,代码行数:17,代码来源:pm_yum.py

示例7: _parse_urpmi

 def _parse_urpmi(self, ss):
     r = []
     for s in ss.splitlines():
         s = s.strip().rsplit("-", 2)
         if len(s) != 3:
             continue
         try:
             p = PackageInfo()
             p.name = s[0]
             p.version = "-".join(s[1:])
             p.state = 'i'
             r.append(p)
             if len(r.keys()) > 2500:
                 break
         except:
             pass
     return r
开发者ID:AojiaoZero,项目名称:ajenti,代码行数:17,代码来源:pm_urpmi.py

示例8: _parse_dpkg

    def _parse_dpkg(self, d):
        r = []
        for l in d.split('\n'):
            s = filter(None, l.split(' '))
            if len(s) == 0:
                continue

            p = PackageInfo()
            if s[0][0] == 'i':
                p.state = 'i'
            else:
                continue

            p.name = s[1]
            p.version = s[2]
            p.description = ' '.join(s[3:])
            r.append(p)
        return r
开发者ID:balchjd,项目名称:ajenti,代码行数:18,代码来源:pm_apt.py

示例9: _parse_apt

    def _parse_apt(self, d):
        r = []
        for l in d.split('\n'):
            s = filter(None, l.split(' '))
            if len(s) == 0:
                continue

            p = PackageInfo()
            if s[0] == 'Inst':
                p.action = 'i'
            elif s[0] in ['Remv', 'Purg']:
                p.action = 'r'
            else:
                continue
            p.name = s[1]
            p.version = s[2].strip('[]')
            r.append(p)
        return r
开发者ID:balchjd,项目名称:ajenti,代码行数:18,代码来源:pm_apt.py

示例10: search

    def search(self, query):
        out_s = subprocess.check_output(['apt-show-versions', '-a', '-R', query])
        r = []
        found = {}
        for l in out_s.split('\n'):
            s = l.split()
            if len(s) < 4:
                continue

            p = PackageInfo()
            p.name = s[0]
            p.state = 'i' if p.name in self.all_dict else 'r'
            p.version = s[1]

            if not p.name in found or found[p.name] < p.version:
                r.append(p)
                found[p.name] = p.version
        return r
开发者ID:AlexSnet,项目名称:ajenti,代码行数:18,代码来源:pm_apt.py

示例11: search

 def search(self, query):
     if query.strip() == "":
         return []
     try:
         out_s = subprocess.check_output([
             'urpmq', "-Y",
             "--summary", query
         ])
     except subprocess.CalledProcessError as e:
         return []
     
     r = []
     for l in out_s.split('\n'):
         s = l.strip().split(":", 1)
         if len(s) != 2:
             continue
         summary_list = s[1].rsplit("(",1)
         if len(summary_list) != 2:
             continue
         p = PackageInfo()
         p.name = s[0].strip()
         p.summary = summary_list[0].strip()
         p.version = summary_list[1].rsplit(")",1)[0].strip()
         p.state = 'r'
         if p.name in self.all_dict and self.all_dict[p.name].state == 'i':
             p.state = 'i'
         r.append(p)
     return r
开发者ID:AojiaoZero,项目名称:ajenti,代码行数:28,代码来源:pm_urpmi.py

示例12: _parse_all_installed

    def _parse_all_installed(self, d):
        r = []

        lines = d.splitlines()
        infos = ['\n'.join(lines[i:i+2]) for i in range(0, len(lines), 2)]

        for info in infos:
            s = info.split('\n')
            if len(s) == 0:
                continue

            package = s[0].split(' ')

            p = PackageInfo()
            p.state = 'i'

            p.name = package[0]
            p.version = package[1]

            s[1].lstrip().rstrip()
            p.description = ' '.join(s[1])

            r.append(p)
        return r
开发者ID:Carolusian,项目名称:ajenti,代码行数:24,代码来源:pm_pacman.py

示例13: intent_install

 def intent_install(self, package):
     p = PackageInfo()
     p.name, p.action = package, 'i'
     self.run([p])
开发者ID:CodeOneTwo,项目名称:ajenti,代码行数:4,代码来源:main.py

示例14: intent_install

 def intent_install(self, package):
     self.activate()
     p = PackageInfo()
     p.name, p.action = package, 'i'
     self.mgr.do([p])
开发者ID:rockworldmi,项目名称:ajenti,代码行数:5,代码来源:main.py


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