Your IP : 172.28.240.42


Current Path : /usr/share/python/debpython/
Upload File :
Current File : //usr/share/python/debpython/pydist.pyc


JQc@s/ddlmZddlZddlZddlZddlmZmZmZddl	m
Z
mZddlm
Z
mZmZddlmZejeZejdZejdejZejd	ejZd
Zeddd
dZddZdZdZdZ dZ!dS(i(twith_statementN(texiststisdirtjoin(tPIPEtPopen(tvreprtgetvertget_requested_versions(tmemoizes/.*?/usr/lib/python(\d.\d+)/(site|dist)-packagess
    (?P<name>[A-Za-z][A-Za-z0-9_.]*)             # Python distribution name
    \s*
    (?P<vrange>(?:-?\d\.\d+(?:-(?:\d\.\d+)?)?)?) # version range
    \s*
    (?P<dependency>(?:[a-z][^;]*)?)              # Debian dependency
    (?:  # optional upstream version -> Debian version translator
        ;\s*
        (?P<standard>PEP386)?                    # PEP-386 mode
        \s*
        (?P<rules>s/.*)?                         # translator rules
    )?
    s
    (?P<name>[A-Za-z][A-Za-z0-9_.]*)     # Python distribution name
    \s*
    (?P<enabled_extras>(?:\[[^\]]*\])?)  # ignored for now
    \s*
    (?:  # optional minimum/maximum version
        (?P<operator><=?|>=?|==|!=)
        \s*
        (?P<version>(\w|[-.])+)
    )?
    cCst|y}xo|D]g}|jd}|jds|rGqntj|stjd|jddd|tSqWWdQXt	S(s Check if pydist file looks good.s
t#s"invalid pydist data in file %s: %st/iiN(
topentstript
startswitht	PYDIST_REtmatchtlogterrortrsplittFalsetTrue(tfpathtfptline((s%/usr/share/python/debpython/pydist.pytvalidate<s
	s/usr/share/python/dist/sdebian/pydist-overridess/usr/share/python/dist_fallbackc
st|r|g}ng}trS|jfdtjDnt|ro|j|ni}x|D]}t|}x|D]}|jd}|jds|rqnt	j
|}|std||fn|j}t
|d}	t|d|d<|dj|d<|d	r_|d	jd
|d	<n
g|d	<|j|	gj|qWWdQXq|W|S(s5Load iformation about installed Python distributions.c3s|]}t|VqdS(N(R(t.0ti(tdname(s%/usr/share/python/debpython/pydist.pys	<genexpr>Sss
R
sinvalid pydist line: %s (in %s)tnametvrangetversionst
dependencytrulest;N(RRtextendtostlistdirtappendRR
RRtsearcht	Exceptiont	groupdictt	safe_nameRtsplitt
setdefault(
Rtfnametfbnametto_checktresultRRRtdistR((Rs%/usr/share/python/debpython/pydist.pytloadJs4)



'cCstjd||rt|ndt|trCt|}ntjdj	|j
\}}t||}t}t
j	|}|stjdtd|n|j}|d}|j|j}|raxx|D]m}|r||jd|krqn|ds%dS|djdr@|dS|d	rR|dS|dSqWnd
tt|}|rd|t|f}n
d|}tjd
|td|dtdtdt}	|	j\}
}|	jdkrtt}xC|
jdD]2}
|
js$qn|j|
jddqWt|dkrgtjd|q|j Sntjd||t!|}tj"d||t||S(Ns-trying to guess dependency for %s (python=%s)s([^><= \[]+)(.*)s[please ask dh_python2 author to fix REQUIRES_RE or your upstream author to fix requires.txtsrequirement is not valid: %sRRR t)tversions'*/%s-?*\.egg-info's"%s | grep '/python%s/\|/pyshared/'s$%s | grep '/python2\../\|/pyshared/'sinvoking dpkg -S %ss/usr/bin/dpkg -S %stshelltstdouttstderris
t:is,more than one package name found for %s dists'dpkg -S did not find package for %s: %ssCannot find installed package that provides %s. Using %s as package name. Please add "%s correct_package_name" line to debian/pydist-overrides to override it if this is incorrect.(#RtdebugRtNonet
isinstancet
basestringRtretcompileRtgroupsR*R2tREQUIRES_REtinfoR(R)tgettlowertendswitht	ci_regexpRRRtcommunicatet
returncodetsetR+R
taddtlenRtpoptsensible_pnametwarn(treqR4Rtresttdatatreq_dicttdetailstitemtquerytprocessR6R7R0Rtpname((s%/usr/share/python/debpython/pydist.pytguess_dependencyms`	$	






	
	c	Cstj|}|r'|jd}nd}g}t}}g}t|d}g|jD]}|j^qb}	x|	D]}
|
s|
jdr|j	|
qn|
jdrt
}n|r|j	|
qnt|
|}|r.|j	|d|
jkrt
}q;|j	|
q|j	|
qWWdQX|r}t|d}|j
d|DWdQXn|S(NitrR
t[t
setuptoolstwcss|]}|dVqdS(s
N((RR((s%/usr/share/python/debpython/pydist.pys	<genexpr>s(t
PUBLIC_DIR_RERtgroupR:RRt	readlinesR
RR&RRWRCt
writelines(R-t
public_dirtverR0tmodifiedtoptional_sectiont	processedRRtlinesRR ((s%/usr/share/python/debpython/pydist.pytparse_pydeps:
%

	

	 cCstjdjd|jS(sEmulate distribute's safe_name.s[^A-Za-z0-9.]+t_(R=R>tsubRC(R((s%/usr/share/python/debpython/pydist.pyR*scCsBt|jdd}|jdr4|d}nd|jS(s(Guess Debian package name from Egg name.Rgt-spython-is	python-%s(R*treplaceRRC(tegg_name((s%/usr/share/python/debpython/pydist.pyRLs
cCsdjd|jDS(s'Return case insensitive dpkg -S regexp.tcss7|]-}|jr+d|j|fn|VqdS(s[%s%s]N(tisalphatupper(RR((s%/usr/share/python/debpython/pydist.pys	<genexpr>s(RRC(R((s%/usr/share/python/debpython/pydist.pyREs("t
__future__RtloggingR$R=tos.pathRRRt
subprocessRRtdebpython.versionRRRtdebpython.toolsR	t	getLoggert__name__RR>R\tVERBOSERR@RR2R:RWRfR*RLRE(((s%/usr/share/python/debpython/pydist.pyt<module>s,
	!G	&