summaryrefslogtreecommitdiff
path: root/python/rpm/__init__.py.in
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-05-18 19:03:36 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-09 12:26:41 +0300
commit987bd509c0686535e6fd80e813b22746e53abfa8 (patch)
tree1218b8de8eca7ee794210dcba14f3c97b5f69124 /python/rpm/__init__.py.in
parent48b41d2b2627d07d68b0de842c655468a63c3335 (diff)
downloadlibrpm-tizen-987bd509c0686535e6fd80e813b22746e53abfa8.tar.gz
librpm-tizen-987bd509c0686535e6fd80e813b22746e53abfa8.tar.bz2
librpm-tizen-987bd509c0686535e6fd80e813b22746e53abfa8.zip
Python module: rename .py files to .in
In order to make them modifiable by autotools.
Diffstat (limited to 'python/rpm/__init__.py.in')
-rw-r--r--python/rpm/__init__.py.in84
1 files changed, 84 insertions, 0 deletions
diff --git a/python/rpm/__init__.py.in b/python/rpm/__init__.py.in
new file mode 100644
index 000000000..d868d19fa
--- /dev/null
+++ b/python/rpm/__init__.py.in
@@ -0,0 +1,84 @@
+r"""RPM Module
+
+This module enables you to manipulate rpms and the rpm database.
+
+"""
+
+import warnings
+import os
+from rpm._rpm import *
+from rpm.transaction import *
+import rpm._rpm as _rpm
+_RPMVSF_NODIGESTS = _rpm._RPMVSF_NODIGESTS
+_RPMVSF_NOHEADER = _rpm._RPMVSF_NOHEADER
+_RPMVSF_NOPAYLOAD = _rpm._RPMVSF_NOPAYLOAD
+_RPMVSF_NOSIGNATURES = _rpm._RPMVSF_NOSIGNATURES
+
+__version__ = _rpm.__version__
+__version_info__ = tuple(__version__.split('.'))
+
+# try to import build bits but dont require it
+try:
+ from rpm._rpmb import *
+except ImportError:
+ pass
+
+# try to import signing bits but dont require it
+try:
+ from rpm._rpms import *
+except ImportError:
+ pass
+
+# backwards compatibility + give the same class both ways
+ts = TransactionSet
+
+def headerLoad(*args, **kwds):
+ warnings.warn("Use rpm.hdr() instead.", DeprecationWarning, stacklevel=2)
+ return hdr(*args, **kwds)
+
+def _doHeaderListFromFD(rpm_fd, retrofit):
+ hlist = []
+ while 1:
+ try:
+ h = hdr(rpm_fd)
+ if retrofit:
+ h.convert(HEADERCONV_RETROFIT_V3)
+ hlist.append(h)
+ except _rpm.error:
+ break
+
+ return hlist
+
+def readHeaderListFromFD(file_desc, retrofit = True):
+ if not isinstance(file_desc, fd):
+ file_desc = fd(file_desc)
+ return _doHeaderListFromFD(file_desc, retrofit)
+
+def readHeaderListFromFile(path, retrofit = True):
+ f = fd(path)
+ hlist = _doHeaderListFromFD(f, retrofit)
+ f.close()
+ return hlist
+
+def readHeaderFromFD(file_desc):
+ if not isinstance(file_desc, fd):
+ file_desc = fd(file_desc)
+ try:
+ offset = file_desc.tell()
+ h = hdr(file_desc)
+ except (_rpm.error, IOError):
+ offset = None
+ h = None
+
+ return (h, offset)
+
+def signalsCaught(siglist):
+ caught = []
+ for sig in siglist:
+ if signalCaught(sig):
+ caught.append(sig)
+
+ return caught
+
+def dsSingle(TagN, N, EVR = "", Flags = RPMSENSE_ANY):
+ return ds((N, EVR, Flags), TagN)