diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-02 21:41:41 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-02 21:41:41 +0300 |
commit | a9b77304c3ad187e8982fd67d1a6406c93ab9e40 (patch) | |
tree | f7d3f9718d001ab1467dc4291df1a6369b625db6 /python/rpm/transaction.py | |
parent | 92d18d1d7139b37065ea742cfe0e8cee5e9c3500 (diff) | |
download | librpm-tizen-a9b77304c3ad187e8982fd67d1a6406c93ab9e40.tar.gz librpm-tizen-a9b77304c3ad187e8982fd67d1a6406c93ab9e40.tar.bz2 librpm-tizen-a9b77304c3ad187e8982fd67d1a6406c93ab9e40.zip |
Permit file objects and file names to ts.addInstall()
- largely removes the need for the klunky ts.hdrFromFdno()
Diffstat (limited to 'python/rpm/transaction.py')
-rw-r--r-- | python/rpm/transaction.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/python/rpm/transaction.py b/python/rpm/transaction.py index dcb28d405..9c8de0c73 100644 --- 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") |