projects
/
platform
/
upstream
/
rpm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
92d18d1
)
Permit file objects and file names to ts.addInstall()
author
Panu Matilainen
<pmatilai@redhat.com>
Fri, 2 Oct 2009 18:41:41 +0000
(21:41 +0300)
committer
Panu Matilainen
<pmatilai@redhat.com>
Fri, 2 Oct 2009 18:41:41 +0000
(21:41 +0300)
- largely removes the need for the klunky ts.hdrFromFdno()
python/rpm/transaction.py
patch
|
blob
|
history
diff --git
a/python/rpm/transaction.py
b/python/rpm/transaction.py
index
dcb28d4
..
9c8de0c
100644
(file)
--- a/
python/rpm/transaction.py
+++ b/
python/rpm/transaction.py
@@
-44,7
+44,16
@@
class TransactionSet(_rpm.ts):
else:
return tuple(keys)
- def addInstall(self, header, key, how="u"):
+ def addInstall(self, item, key, how="u"):
+ if isinstance(item, str):
+ f = file(item)
+ header = self.hdrFromFdno(f)
+ f.close()
+ elif isinstance(item, file):
+ header = self.hdrFromFdno(item)
+ else:
+ header = item
+
if not how in ['u', 'i']:
raise ValueError, 'how argument must be "u" or "i"'
upgrade = (how == "u")