HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/share/python/debpython/tools.pyc
�
}k^c@�s�ddlmZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
ddlmZddlmZmZddlmZmZmZeje�Zejd	�Zejd
�Zejd�Zejdeej�Zejd
eej�Z de"d�Z#d�Z$d�Z%dd�Z&d�Z'd�Z(d�Z)de*fd��YZ+d�Z,d�Z-dS(i����(twith_statementN(tdumps(tglob(texiststisdirtjointsplit(trmtree(tPIPEtPopen(t
RANGE_PATTERNtgetvertget_requested_versionss/(.*?)(-py\d\.\d(?:-[^.]*)?)?(\.egg-info|\.pth)$sA^#!\s*(.*?/bin/.*?)(python(2\.\d+)?(?:-dbg)?)(?:\s(.*))?[$\r\n].*sNEEDED.*libpython(\d\.\d)s�
    (?P<pattern>.+?)  # file pattern
    (?:\s+  # optional Python module name:
    (?P<module>[A-Za-z][A-Za-z0-9_.]*)?
    )?
    \s*  # optional version range:
    (?P<vrange>%s)?$
s^
    (?P<pattern>.+?)  # file pattern
    \s*  # optional version range:
    (?P<vrange>%s)?$
cC�s�t|t�r1td�|jd�D��}n|d	krJd|}n
d|}|rgd|}n|r�d||f}n|S(
s�Return path to site-packages directory.

    >>> sitedir((2, 5))
    '/usr/lib/python2.5/site-packages/'
    >>> sitedir((2, 7), 'python-foo', True)
    'debian/python-foo/usr/lib/debug/usr/lib/python2.7/dist-packages/'
    cs�s|]}t|�VqdS(N(tint(t.0ti((s$/usr/share/python/debpython/tools.pys	<genexpr>>st.iis#/usr/lib/python%d.%d/dist-packages/s#/usr/lib/python%d.%d/site-packages/s/usr/lib/debug%ssdebian/%s%s(ii(t
isinstancet
basestringttupleR(tversiontpackagetgdbtpath((s$/usr/share/python/debpython/tools.pytsitedir5s"


cC�si|jd�}|jd�}x&|d|dkrF|d=|d=q!Wdjdgt|�d|�S(s~Return relative path.

    >>> relpath('/usr/share/python-foo/foo.py', '/usr/bin/foo', )
    '../share/python-foo/foo.py'
    t/is..i(RRtlen(ttargettlinktttl((s$/usr/share/python/debpython/tools.pytrelpathMs
cC�stjt||�|�S(sCreate relative symlink.(tostsymlinkR(RR((s$/usr/share/python/debpython/tools.pytrelative_symlinkZsc	C�s`y?t|��}|j�}WdQX|s>tjd|�dSWn"tk
rctjd|�tSXtj	|d�}|s�dS|s|j
�\}}}}|dkr�d|}n|dkr�d}n|d	kr�d}n|r|r|d
|7}qn|r\tjd||d�t|d��)}|jd
|�|j
|d�WdQXntS(smNormalize file's shebang.

    :param replacement: new shebang command (path to interpreter and options)
    Ns$fix_shebang: ignoring empty file: %sscannot open %sis/usr/bins/usr/bin/%stpythons/usr/bin/python2tpython2s %ssreplacing shebang in %s (%s)tws#! %s
i(topent	readlinestlogtdebugtNonetIOErrorterrortFalset
SHEBANG_REtmatchtgroupstinfotwritet
writelinestTrue(	tfpathtreplacementtfptfcontentR/RtinterpreterRtargv((s$/usr/share/python/debpython/tools.pytfix_shebang_s8

		cC�s�y�t|��~}|jd�}tj|�}|s:dS|j�}|dd!dkr�|dr{|dt|d�fS|ddfSWdQXWn!tk
r�tj	d|�nXdS(spCheck file's shebang.

    :rtype: tuple
    :returns: pair of Python interpreter string and Python version
    i iiiNscannot open %s(NN(
R&treadR.R/R*R0RR+R(R,(R5R7tdataR/tres((s$/usr/share/python/debpython/tools.pyt
shebang2pyver�s

cC�sXd|}t|dtdt�}tj|jj��}|rTt|j�d�SdS(shReturn libpython version file is linked to or None.

    :rtype: tuple
    :returns: Python version
    sreadelf -Wd '%s'tstdouttshelliN(	R	RR4tSHAREDLIB_REtsearchR@R<RR0(R5tcmdtprocessR/((s$/usr/share/python/debpython/tools.pytso2pyver�s

cC�sGtj|�}|rC|jd�dk	rCdj|jdd��S|S(sRemove Python version and platform name from Egg files/dirs.

    >>> clean_egg_name('python_pipeline-0.1.3_py3k-py3.1.egg-info')
    'python_pipeline-0.1.3_py3k.egg-info'
    >>> clean_egg_name('Foo-1.2-py2.7-linux-x86_64.egg-info')
    'Foo-1.2.egg-info'
    itiiN(t
EGGnPTH_RER/tgroupR*R(tnameR/((s$/usr/share/python/debpython/tools.pytclean_egg_name�stmemoizecB�seZd�Zd�ZRS(cC�s||_i|_dS(N(tfunctcache(tselfRM((s$/usr/share/python/debpython/tools.pyt__init__�s	cO�sHt||f�}||jkr=|j||�|j|<n|j|S(N(RRNRM(ROtargstkwargstkey((s$/usr/share/python/debpython/tools.pyt__call__�s(t__name__t
__module__RPRT(((s$/usr/share/python/debpython/tools.pyRL�s	cC�s�t}d|}t|�s |St|�}x�tj|dd�D]m}|sB|jd�rdqBntj|�}|s�t}t	j
d||�qBn|j�}|dr�|djdd�|d<n|t|d	�@}|s�t	j
d
||�qBnt|d�}|s7t}t	jd||d�qBnxu|D]m}	|	jd
�}	|dr}t|dt|	�d�}
n"|	jd�r�|	d}
n|	}
x	|D]}tt||�|
�}t|�d}
t|
�sytj|
�Wqtk
rt	jd|
�tSXnt|�rfytj|�Wqftk
rbt}t	jd|�q�qfXnytj|	|�Wq�tk
r�t}t	jd|	|
�q�Xq�Wq>WqBW|S(sDInstall local files listed in pkg.pyinstall files as public modules.s./debian/%s.pyinstalltencodingsutf-8t#s#%s.pyinstall: unrecognized line: %stmoduleRRtvranges.%s.pyinstall: no matching versions for line %stpatterns %s.pyinstall: file not found: %ss/.isdebian/iiscannot create %s directoryscannot replace %s filescannot copy %s file to %s(R4RRtcodecsR&t
startswitht
INSTALL_RER/R-R(twarnt	groupdicttreplaceR)RR,tlstripRRRR tmakedirst	ExceptiontremoveR(RRZtstatustsrcfpathtversionstlinetdetailstmyverstfilesR5tdstnameRtdstfpathtdstdir((s$/usr/share/python/debpython/tools.pyt	pyinstall�sr
	

	
	

 





#c	C�s�t}d|}t|�s |St|�}x�tj|dd�D]�}|sB|jd�rdqBntj|�}|s�t}t	j
d||�qBn|j�}|t|d�@}|s�t	jd||�qBnx�|D]�}t
t||�|d�}	|	s't	jd	|||d�q�nx�|	D]�}
t|
�rzyt|
�Wq�tk
rv}t}t	j|�q�Xq.ytj|
�Wq.ttfk
r�}t}t	j|�q.Xq.Wq�WqBW|S(
s2Remove public modules listed in pkg.pyremove file.s./debian/%s.pyremoveRWsutf-8RXs"%s.pyremove: unrecognized line: %sRZs-%s.pyremove: no matching versions for line %sR[s/%s.pyremove: nothing to remove: python%d.%d, %s(R4RRR\R&R]t	REMOVE_RER/R-R(R_R`R)RRRRRdR,R ReR+tOSError(RRZRfRgRhRiRjRkRRlR5te((s$/usr/share/python/debpython/tools.pytpyremovesN
	
	

	
(.t
__future__RR\tloggingR tretcPickleRRtos.pathRRRRtshutilRt
subprocessRR	tdebpython.versionR
RRt	getLoggerRUR(tcompileRHR.RBtVERBOSER^RqR*R-RRR"R;R?RFRKtobjectRLRpRt(((s$/usr/share/python/debpython/tools.pyt<module>s8"	
	&				?