3 Jf @sdZddlZddlTddlTddljZejZejZejZejZej Z e e j dZ y ddl TWnek rrYnXy ddlTWnek rYnXeZddZddZdd d Zdd d ZddZddZdefddZdS)aKRPM Module This module enables you to manipulate rpms and the rpm database. The rpm base module provides the main starting point for accessing RPM from Python. For most usage, call the TransactionSet method to get a transaction set (rpmts). For example: import rpm ts = rpm.TransactionSet() The transaction set will open the RPM database as needed, so in most cases, you do not need to explicitly open the database. The transaction set is the workhorse of RPM. You can open another RPM database, such as one that holds all packages for a given Linux distribution, to provide packages used to solve dependencies. To do this, use the following code: rpm.addMacro('_dbpath', '/path/to/alternate/database') solvets = rpm.TransactionSet() solvets.openDB() rpm.delMacro('_dbpath') # Open default database ts = rpm.TransactionSet() This code gives you access to two RPM databases through two transaction sets (rpmts): ts is a transaction set associated with the default RPM database and solvets is a transaction set tied to an alternate database, which is very useful for resolving dependencies. N)*.cOstjdtddt||S)z"DEPRECATED! Use rpm.hdr() instead.zUse rpm.hdr() instead.) stacklevel)warningswarnDeprecationWarninghdr)argskwdsr /usr/lib64/python3.6/__init__.py headerLoadAsrc CsLg}xBy$t|}|r|jt|j|Wqtjk rBPYqXqW|S)N)r ZconvertZHEADERCONV_RETROFIT_V3append_rpmerror)Zrpm_fdretrofithlisthr r r _doHeaderListFromFDGs  rTcCst|tst|}t||S)N) isinstancefdr) file_descrr r r readHeaderListFromFDUs rcCst|}t||}|j|S)N)rrclose)pathrfrr r r readHeaderListFromFile[s rc CsRt|tst|}y|j}t|}Wn"tjtfk rHd}d}YnX||fS)zReturn (header, pos_before_hdr)N)rrtellr rrIOError)roffsetrr r r readHeaderFromFDbs   r!cCs(g}x|D]}t|r |j|q W|S)z)Returns list of signals that were caught.)Z signalCaughtr)ZsiglistZcaughtZsigr r r signalsCaughtps  r"cCst|||f|S)z~ Creates a single entry dependency set (ds) dsSingle(RPMTAG_CONFLICTNAME, "rpm") corresponds to "Conflicts: rpm" )Zds)ZTagNNZEVRZFlagsr r r dsSinglezsr%)T)T)__doc__rZrpm._rpmZrpm.transactionrZ_RPMVSF_NODIGESTSZ_RPMVSF_NOHEADERZ_RPMVSF_NOPAYLOADZ_RPMVSF_NOSIGNATURES __version__tuplesplitZ__version_info__Z rpm._rpmb ImportErrorZ rpm._rpmsZTransactionSetZtsrrrrr!r"Z RPMSENSE_ANYr%r r r r #s4