summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-06-01 20:03:43 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-06-01 20:03:43 (GMT)
commit2a97dcce090b5713f16521c73b20ad6604938770 (patch)
tree712d05ff6e382c1b8b4094e9caf2b9428b4b6c1a /Lib
parent19c0d943e952b57ded7c7dbad228092b347649b2 (diff)
downloadcpython-2a97dcce090b5713f16521c73b20ad6604938770.zip
cpython-2a97dcce090b5713f16521c73b20ad6604938770.tar.gz
cpython-2a97dcce090b5713f16521c73b20ad6604938770.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/plat-mac/pimp.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/plat-mac/pimp.py b/Lib/plat-mac/pimp.py
index 8a0533e..c26ecc9 100644
--- a/Lib/plat-mac/pimp.py
+++ b/Lib/plat-mac/pimp.py
@@ -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: