mirror of
https://github.com/python/cpython.git
synced 2024-11-27 03:45:08 +08:00
Use splitlines() in stead of split() to split lines, and added a method
shortdescription() so the code to split off the first line of the description isn't all over the place.
This commit is contained in:
parent
19c0d943e9
commit
2a97dcce09
@ -391,6 +391,7 @@ class PimpPackage:
|
||||
def version(self): return self._dict.get('Version')
|
||||
def flavor(self): return self._dict.get('Flavor')
|
||||
def description(self): return self._dict['Description'].strip()
|
||||
def shortdescription(self): return self.description().splitlines()[0]
|
||||
def homepage(self): return self._dict.get('Home-page')
|
||||
def downloadURL(self): return self._dict.get('Download-URL')
|
||||
|
||||
@ -500,7 +501,7 @@ class PimpPackage:
|
||||
if not pkg:
|
||||
descr = "Requires unknown %s"%name
|
||||
else:
|
||||
descr = pkg.description()
|
||||
descr = pkg.shortdescription()
|
||||
rv.append((pkg, descr))
|
||||
return rv
|
||||
|
||||
@ -825,7 +826,7 @@ def _run(mode, verbose, force, args, prefargs):
|
||||
for pkgname in args:
|
||||
pkg = db.find(pkgname)
|
||||
if pkg:
|
||||
description = pkg.description().split('\r\n')[0]
|
||||
description = pkg.shortdescription()
|
||||
pkgname = pkg.fullname()
|
||||
else:
|
||||
description = 'Error: no such package'
|
||||
@ -837,7 +838,7 @@ def _run(mode, verbose, force, args, prefargs):
|
||||
except KeyError:
|
||||
pass
|
||||
description = pkg.description()
|
||||
description = '\n\t\t\t\t\t'.join(description.split('\r\n'))
|
||||
description = '\n\t\t\t\t\t'.join(description.splitlines())
|
||||
print "\tDescription:\t%s" % description
|
||||
elif mode =='status':
|
||||
if not args:
|
||||
|
@ -385,7 +385,7 @@ class PackageBrowser(PimpInterface):
|
||||
self.w.install_button.enable(installed != "yes" or self.w.force_button.get())
|
||||
self.w.homepage_button.enable(not not self.packages[sel].homepage())
|
||||
description = self.packages[sel].description()
|
||||
description = description.split('\r\n')
|
||||
description = description.splitlines()
|
||||
description = '\r'.join(description)
|
||||
self.w.description.set(description)
|
||||
self.w.verbose_button.enable(1)
|
||||
|
Loading…
Reference in New Issue
Block a user