コード例 #1
0
ファイル: pm_pacman.py プロジェクト: sevensky/ajenti
    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
コード例 #2
0
    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
コード例 #3
0
ファイル: pm_apt.py プロジェクト: balchjd/ajenti
    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
コード例 #4
0
ファイル: pm_pacman.py プロジェクト: Carolusian/ajenti
    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
コード例 #5
0
    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
コード例 #6
0
ファイル: pm_pacman.py プロジェクト: surjit/ajenti_cp
    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
コード例 #7
0
ファイル: pm_apt.py プロジェクト: balchjd/ajenti
    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
コード例 #8
0
 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
コード例 #9
0
 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
コード例 #10
0
ファイル: pm_yum.py プロジェクト: AlexSnet/ajenti
 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
コード例 #11
0
ファイル: pm_yum.py プロジェクト: AlexSnet/ajenti
 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
コード例 #12
0
ファイル: pm_urpmi.py プロジェクト: AojiaoZero/ajenti
 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
コード例 #13
0
    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
コード例 #14
0
ファイル: pm_apt.py プロジェクト: AlexSnet/ajenti
    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
コード例 #15
0
ファイル: pm_apt.py プロジェクト: balchjd/ajenti
    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
コード例 #16
0
ファイル: pm_apt.py プロジェクト: balchjd/ajenti
    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
コード例 #17
0
 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
コード例 #18
0
ファイル: pm_apt.py プロジェクト: paimpozhil/ajenti
    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
コード例 #19
0
ファイル: pm_urpmi.py プロジェクト: AojiaoZero/ajenti
 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
コード例 #20
0
ファイル: pm_pacman.py プロジェクト: surjit/ajenti_cp
    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(' ')

                p = PackageInfo()
                p.name = sn[0]
                p.state = 'i' if subprocess.call(['pacman', '-Q', p.name]) == 0 else 'r'
                p.version = sn[1]

                r.append(p)

        return r
コード例 #21
0
ファイル: pm_pacman.py プロジェクト: Carolusian/ajenti
    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
コード例 #22
0
ファイル: pm_apt.py プロジェクト: paimpozhil/ajenti
    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
コード例 #23
0
ファイル: pm_apt.py プロジェクト: paimpozhil/ajenti
    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
コード例 #24
0
ファイル: pm_pacman.py プロジェクト: surjit/ajenti_cp
    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
コード例 #25
0
ファイル: main.py プロジェクト: dchusovitin/ajenti
 def intent_install(self, package):
     # self.activate()
     p = PackageInfo()
     p.name, p.action = package, "i"
     self.run([p])
コード例 #26
0
ファイル: main.py プロジェクト: surjit/ajenti_cp
 def intent_install(self, package):
     p = PackageInfo()
     p.name, p.action = package, 'i'
     self.run([p])
コード例 #27
0
 def intent_install(self, package):
     self.activate()
     p = PackageInfo()
     p.name, p.action = package, 'i'
     self.mgr.do([p])
コード例 #28
0
ファイル: main.py プロジェクト: rockworldmi/ajenti
 def intent_install(self, package):
     self.activate()
     p = PackageInfo()
     p.name, p.action = package, 'i'
     self.mgr.do([p])
コード例 #29
0
ファイル: main.py プロジェクト: CodeOneTwo/ajenti
 def intent_install(self, package):
     p = PackageInfo()
     p.name, p.action = package, 'i'
     self.run([p])