summaryrefslogtreecommitdiff
path: root/filter.py
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-14 19:36:26 -0600
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-14 19:52:32 -0600
commitf923ab304017a71136642ed7b9780441edcaf441 (patch)
tree7fb5b5d6e3a40436bc3bf6537da5d42469781f4d /filter.py
parente5b869eade3fbf47cf9ac1b7c6be34dfee14b2c1 (diff)
* TestCase for pkginfo_from_rsync_output
* Corrected __eq__ method in Package class * Corrected pkginfo_from_rsync_output
Diffstat (limited to 'filter.py')
-rw-r--r--filter.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/filter.py b/filter.py
index ad3b33d..55ab94a 100644
--- a/filter.py
+++ b/filter.py
@@ -38,26 +38,28 @@ def pkginfo_from_rsync_output(rsync_output):
Returns:
----------
package_list -> tuple Contains Package objects. """
- package_list=list()
def package_or_link(line):
""" Take info out of filename """
location_field = 4
- pkginfo_from_filename(line.rsplit()[location_field])
+ return pkginfo_from_filename(line.rsplit()[location_field])
def do_nothing():
- pass
+ """"""
options = { "d": do_nothing,
"l": package_or_link,
"-": package_or_link,
" ": do_nothing}
+
+ package_list=list()
- for line in rsync_output.split("\n"):
- if ".pkg.tar" in line:
- pkginfo=options[line[0]](line)
- if pkginfo_:
- package_list.append(pkginfo)
+ lines=[x for x in rsync_output.split("\n") if ".pkg.tar" in x]
+
+ for line in lines:
+ pkginfo=options[line[0]](line)
+ if pkginfo:
+ package_list.append(pkginfo)
return tuple(package_list)