Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
]H¡dc@s{ddlZddlZddlZdZeZdZd„Zdefd„ƒYZ	defd„ƒYZ
d	d
„ZdS(iÿÿÿÿNs0.2.1icCs$t|tƒr|S|jdƒSdS(s¬
    Keeps bytes, converts unicode into UTF-8.

    This is used for filenames, which the user may supply as unicode, but is
    always stored as bytes in the archive.
    sutf-8N(t
isinstancetbytestencode(ts((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytutf8stArInfocBsteZdZdddddd„Zed„ƒZejd„ƒZed„ƒZ	d„Z
dd„Zd„ZRS(	s
    Information on a file in an archive.

    This has the filename and all the metadata for a file in an archive.

    It is returned by :meth:`~unix_ar.ArFile.infolist()` and
    :meth:`~unix_ar.ArFile.getinfo()`, and can be passed when adding or
    extracting a file to or from the archive.

    Missing fields will be autocompleted when passed to `ArFile`, but note that
    things like `size` will be respected, allowing you to store or extract only
    part of a file.

    `ArInfo` objects returned by `ArFile` have the offset to the file in the
    archive, allowing to extract the correct one even if multiple files with
    the same name are present; if you change the `name` attribute, the initial
    file will be extracted with the new name (and new metadata).
    cCsC||_||_||_||_||_||_d|_dS(N(tnametsizetmtimetpermstuidtgidtNonetoffset(tselfRRRR	R
R((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt__init__-s						cCs|jS(N(t_name(R((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyR6scCst|ƒ|_dS(N(RR(Rtvalue((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyR:sc	Cs»tjd|ƒ\}}}}}}}t|ƒjdƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}|dkr¢tdƒ‚n|||||||ƒS(s,
        Decode the archive header.
        t16s12s6s6s8s10s2st i
is`
sInvalid file signature(tstructtunpackRtrstriptintt
ValueError(	tclstbufferRRR
RR	Rtmagic((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt
frombuffer>s
'cCs‰td„|j|j|j|j|j|jfDƒƒrItdƒ‚ndj|j	j
dƒ|j|j|j|j|jƒjdƒS(s.
        Encode as an archive header.
        css|]}|dkVqdS(N(R(t.0tf((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pys	<genexpr>ZssArInfo object has None fieldss0{0: <16}{1: <12}{2: <6}{3: <6}{4: <8o}{5: <10}`
s
iso-8859-1(tanyRRR
RR	RRtformatRtdecodeR(R((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyttobufferVs:	*c
Cs>|j|j|j|j|j|jf}td„|DƒƒsM|j|ŒS|\}}}}}}|dkrz|}nt	j
|ƒ}	|dkr¤t|ƒ}n|dkr¼|	j}n|dkrÚt
|	jƒ}n|dkrò|	j}n|dkr
|	j}n|dkr"|	j}n|j||||||ƒS(s‹
        Fill in the missing attributes from an actual file.

        This is called by `ArFile` when adding a file to the archive. If some
        attributes are missing, they have to be provided from the disk.

        If the file doesn't exist, adding will fail. There is currently no
        default values for the attributes, it is thus your responsibility to
        provide them.
        css|]}|dkVqdS(N(R(Rta((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pys	<genexpr>psN(RRRR	R
RRt	__class__RtoststatRtst_sizeRtst_mtimetst_modetst_uidtst_gid(
RtpathtattrsRRRR	R
RR&((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytupdatefromdiskcs*
	cCs@|j|j|j|j|j|j|jƒ}|j|_|S(N(R$RRRR	R
RR
(Rtmember((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt__copy__…sN(
t__name__t
__module__t__doc__RRtpropertyRtsettertclassmethodRR"R.R0(((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyRs		
"tArFilecBs’eZdZdd„Zd„Zd„Zdd„Zdd„Zd„Z	d„Z
d	„Zd
d„Zd„Z
d
d
„Zd„Zd„ZRS(s`
    An UNIX ar archive.

    This object allows you to either read or write an AR archive.
    trcCsZ||_||_|dkr+|jƒn+|dkrJ|jjdƒntdƒ‚dS(sš
        Create an `ArFile` from an opened file (in 'rb' or 'wb' mode).

        Don't use this constructor, call :func:`unix_ar.open()` instead.
        R8tws!<arch>
smode must be one of 'r' or 'w'N(t_filet_modet
_read_entriestwriteR(Rtfiletmode((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyR“s		
cCs<|jjdƒdkr'tdƒ‚ng|_i|_d}xötr7|jjdƒ}t|ƒdkrpPn¸t|ƒdkr(tj|ƒ}||_	t|jƒ|j|j
<|jj|ƒ|j}|ddkré|d7}n|d|7}|jj
|dƒ||jjƒkr(qBq(ntdƒ‚qBWdS(	Nis!<arch>
sInvalid archive signaturei<iiisTruncated archive?(R:treadRt_entriest	_name_maptTruetlenRRR
RtappendRtseekttell(RtposRR/tskip((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyR<¢s,					
	cCsh|jdkr(td|jjƒ‚n|j|krd|jdkrUtdƒ‚qdtdƒ‚ndS(NsAttempted to use a closed %sR8s Can't change a read-only archives$Can't read from a write-only archive(R:RRR$R1R;(Rt
expected_mode((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt_check»scCs|jdƒ|dkr(t|ƒ}nt|tƒsFt|ƒ}n|j|ƒ}t|dƒ}|j||ƒWdQXdS(sZ
        Add a file to the archive.

        :param name: Path to the file to be added.
        :type name: bytes | unicode
        :param arcname: Name the file will be stored as in the archive, or
            a full :class:`~unix_ar.ArInfo`. If unset, `name` will be used.
        :type arcname: None | bytes | unicode | unix_ar.ArInfo
        R9trbN(RKRRRR.t_opentaddfile(RRtarcnametfp((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytaddÅs

cCs@|jdƒt|tƒs+t|ƒ}n|jƒ}|jj|jƒƒ|dkrnt|j	dƒ}n|}x†t
d|jtƒD]o}|j
tt|j|ƒƒ}t|ƒtkrét|ƒ|j|krétdƒ‚n|jj|ƒqŠW|jddkr#|jjdƒn|dkr<|jƒndS(	s
        Add a file to the archive from a file object.

        :param name: Name the file will be stored as in the archive, or
            a full :class:`~unix_ar.ArInfo`.
        :type name: bytes | unicode | unix_ar.ArInfo
        :param fileobj: File object to read from.
        R9RLisFile changed size?iis
N(RKRRR.R:R=R"RRMRtrangeRt	CHUNKSIZER@tminRDtRuntimeErrortclose(RRtfileobjRPRHtchunk((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyRNØs"	
+cCs$|jdƒtd„|jDƒƒS(s
        Return a list of :class:`~unix_ar.ArInfo` for files in the archive.

        These objects are copy, so feel free to change them before feeding them
        to :meth:`~unix_ar.ArFile.add()` or :meth:`~unix_ar.ArFile.addfile()`.

        :rtype: [unix_ar.ArInfo]
        R8css|]}|jƒVqdS(N(R0(Rti((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pys	<genexpr>s(RKtlistRA(R((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytinfolistøs	
cCs¦|jdƒt|tƒr~|jdk	rZ|jj|jdƒtj|jjdƒƒS|j	|j
}|j|jƒSn$|j	t
|ƒ}|j|jƒSdS(s²
        Return an :class:`~unix_ar.ArInfo` for a specific file.

        This object is a copy, so feel free to change it before feeding them to
        :meth:`~unix_ar.ArFile.add()` or :meth:`~unix_ar.ArFile.addfile()`.

        :param member: Either a file name or an incomplete
            :class:`unix_ar.ArInfo` object to search for.
        :type member: bytes | unicode | unix_ar.ArInfo
        :rtype: unix_ar.ArInfo
        R8ii<N(RKRRR
RR:RFRR@RBRRAR0R(RR/tindex((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytgetinfos
cCs´t|dƒr|}nt|jdƒdƒ}|jj|jddƒxLtd|jtƒD]5}|jj	t
t|j|ƒƒ}|j|ƒq`W|jƒ|jdƒ|S(NR=t/twbi<i(
thasattrRMRR:RFR
RRRRSR@RTR=tflush(RR/R,RPRHRX((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt_extracts	"

tcCsÏ|jdƒ|j|ƒ}t|tƒrm|jdkrI|j|_n|j|jkrs|j|_qsn|}t|dƒs¿|s›tj	j
|ƒr¿tj	jt|ƒ|j
ƒ}q¿n|j||ƒS(sÅ
        Extract a single file from the archive.

        :param member: Either a file name or an :class:`unix_ar.ArInfo` object
            to extract.
        :type member: bytes | unicode | unix_ar.ArInfo
        :param path: Destination path (current directory by default). You can
            also change the `name` attribute on the `ArInfo` you pass this
            method to extract to any file name.
        :type path: bytes | unicode
        R8R=N(RKR]RRR
RRR`R%R,tisdirtjoinRRRb(RR/R,tactualmember((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytextract+s
$cCs|jdƒtdƒ‚dS(NR8s$extractfile() is not yet implemented(RKtNotImplementedError(RR/((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytextractfileEs
cCs`|jdƒxL|jjƒD];}|j|}|j|tjjt|ƒ|j	ƒƒqWdS(s¢
        Extract all the files in the archive.

        :param path: Destination path (current directory by default).
        :type path: bytes | unicode
        R8N(
RKRBtvaluesRARbR%R,ReRR(RR,R\R/((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt
extractallIs

cCs1|j|dtjƒƒ}|jdƒ|_|S(NR,R^(RgtiotBytesIOtstripR(RR/tfilelike((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pytopenXscCs>|jdk	r:|jjƒd|_d|_d|_ndS(s{
        Close this archive and the underlying file.

        No method should be called on the object after this.
        N(R:RRVRARB(R((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyRV]s

		N(R1R2R3RR<RKRRQRNR[R]RbRgRiRkRpRV(((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyR7Œs		
 					R8cCs„t|dƒrt||ƒS|dks4|dkr=d}n-|dksU|dkr^d}ntdƒ‚tt||ƒ|ƒSdS(s£
    Open an archive file.

    :param file: File name to open.
    :type file: bytes | unicode
    :param mode: Either ''r' or 'w'
    :rtype: unix_ar.ArFile
    R@R8RLR9R_smode must be one of 'r' or 'w'N(R`R7RRM(R>R?tomode((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyRpjs	
		(R%RlRt__version__RpRMRSRtobjectRR7(((sA/usr/lib/enigma2/python/Plugins/SystemPlugins/gutemine/unix_ar.pyt<module>s	
sÞ