我正在优化 install_remove_pane.py 。在晚上五点之前你不要改噢

在 2010年7月30日 下午1:16,Haofu Han <[email protected]>写道:

> 好呀
>
> 在 2010年7月30日 下午12:16,Homer Xing <[email protected]>写道:
>
>> APT类的apt_cache是apt.cache.Cache对象。因此我想  dump_apt_summary 可以简化,
>>
>>      @classmethod
>>      def get_pkg_summary(cls, name):
>> -        if not isinstance(name,str) or not name in cls.__set2:
>> -            return ''
>> -        import subprocess, os
>> -        path =
>> os.path.dirname(os.path.abspath(__file__))+'/support/dump_apt_pkg_summary.py
>> %s' % name
>> -        task = subprocess.Popen(['python', path],
>> -            stdout=subprocess.PIPE,
>> -            )
>> -        for line in task.stdout:
>> -            summary = line[:-1]
>> -            task.wait()
>> -            return summary
>> -        return ''
>> +        assert isinstance(name, str) and name
>> +        cls.refresh_cache()
>> +        return cls.apt_cache[name].summary
>>
>> 你觉得如何呢?
>>
>> Homer
>>
>> _______________________________________________
>> Mailing list: 
>> https://launchpad.net/~ailurus<https://launchpad.net/%7Eailurus>
>> Post to     : [email protected]
>> Unsubscribe : 
>> https://launchpad.net/~ailurus<https://launchpad.net/%7Eailurus>
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
_______________________________________________
Mailing list: https://launchpad.net/~ailurus
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~ailurus
More help   : https://help.launchpad.net/ListHelp

回复