Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/dist.pyc


'Nc	@sdZddlmZmZmZmZddlmZddlm	Z	ddl
mZddlZddl
Z
ddlZddlZddd	d
ddd
ddg	ZdefdYZdZdZddZdddddddgZdddd d!gZd"Zd#Zddd$Zddddd%Zd&d'Zd(ejfd)YZd*ejfd+YZd,ejfd-YZd.ejfd/YZ eed0Z!e!Z"d1Z#dS(2sm
Distutils convenience functionality.

Don't use this outside of Twisted.

Maintainer: Christopher Armstrong
i(t
build_scriptstinstall_datat	build_exttbuild_py(tCompileError(tcore(t	ExtensionNtconchtloretmailtnamestnewstpairtrunnertwebtwordstConditionalExtensioncBseZdZdZRS(sj
    An extension module that will only be compiled if certain conditions are
    met.

    @param condition: A callable of one argument which returns True or False to
        indicate whether the extension should be built. The argument is an
        instance of L{build_ext_twisted}, which has useful methods for checking
        things about the platform.
    cOs/|jdd|_tj|||dS(Nt	conditioncSstS(N(tTrue(tbuilder((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt<lambda>$s(tpopRRt__init__(tselftargstkwargs((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR#s(t__name__t
__module__t__doc__R(((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyRs	cKstjt|S(s^
    An alternative to distutils' setup() which is specially designed
    for Twisted subprojects.

    Pass twisted_subproject=projname if you want package and data
    files to automatically be found for you.

    @param conditionalExtensions: Extensions to optionally build.
    @type conditionalExtensions: C{list} of L{ConditionalExtension}
    (Rtsetuptget_setup_args(tkw((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR)scsd|krdtjdkr0tdn|d}tjjd|}t|dd|d<t||d<d|d	}tjj|r|jd
gj	|j
ddd nt|dd|d
<|d=n[d|kr<g}x#|dD]}|j	d|qW|jd
gj||d=nd|krit
d6td6|d<tjd dkrt|dd<qnd|kr|d|d=d|kr|d<ndtffdY}||jdid<n|S(Nttwisted_subprojectttwistedt.sCSorry, you need to run setup.py from the toplevel source directory.tparenttpackagestversionstwisted/plugins/twisted_s.pyt
py_modulest/it
data_filestpluginsstwisted.plugins.tcmdclassRRiiiRtconditionalExtensionstext_modulestmy_build_extcseZZRS((RRR+((t
extensions(s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR-hsR(iii(tostlistdirtRuntimeErrortpathtjointgetPackagest
getVersiontexistst
setdefaulttappendtreplacetgetDataFilestextendtinstall_data_twistedtbuild_scripts_twistedtsystversion_infotbuild_py_twistedtbuild_ext_twisted(RtprojnametprojdirtpluginR&tplgR-((R.s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR7sB



	
R!cCsd|dkr$tjj|d}ntjj||d}idd6}t|||djS(s
    Extract the version number for a given project.

    @param proj: the name of the project. Examples are "core",
    "conch", "words", "mail".

    @rtype: str
    @returns: The version number of the project, as a string like
    "2.0.0".
    Rs_version.pysNothing to see hereRR%(R/R2R3texecfiletbase(tprojRGtvfiletns((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR5ns

s{arch}tCVSs
.cvsignoret_darcstRCStSCCSs.svns	*.py[cdo]s*.s[ol]s.#*s*~s*.pycCsvg|D]}|tkr|^q}xJtD]B}g|D]/}tj||r9|jdr9|^q9}q,W|S(sO
    Given a list of file names, return those names that should be copied.
    s.py(t
EXCLUDE_NAMEStEXCLUDE_PATTERNStfnmatchtendswith(R
tntpattern((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt_filterNamess


 cCstjj|}tjj|}|j|ru|t|}|jtjrb|d}ntjj||Std||fdS(s
    Gets 'relativee' relative to 'basepath'.

    i.e.,

    >>> relativeTo('/home/', '/home/radix/')
    'radix'
    >>> relativeTo('.', '/home/radix/Projects/Twisted') # curdir is /home/radix
    'Projects/Twisted'

    The 'relativee' must be a child of 'basepath'.
    is%s is not a subpath of %sN(R/R2tabspatht
startswithtlentsepR3t
ValueError(RGt	relativeetbasepathtrelative((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt
relativeTos

cCs|p	d}|pg}g}xtj|D]\}}}g}x*tD]"}||krJ|j|qJqJWx*|D]"}	|	|krw|j|	qwqwWx!t|D]}
|j|
qW|r.|jt||g|D]$}
t|tjj||
^qfq.q.W|S(s
    Get all the data files that should be included in this distutils Project.

    'dname' should be the path to the package that you're distributing.

    'ignore' is a list of sub-packages to ignore.  This facilitates
    disparate package hierarchies.  That's a fancy way of saying that
    the 'twisted' package doesn't want to include the 'twisted.conch'
    package, so it will pass ['conch'] as the value.

    'parent' is necessary if you're distributing a subpackage like
    twisted.conch.  'dname' should point to 'twisted/conch' and 'parent'
    should point to 'twisted'.  This ensures that your data_files are
    generated correctly, only using relative paths for the first element
    of the tuple ('twisted/conch/*').
    The default 'parent' is the current working directory.
    R"(	R/twalkROtremoveRUR8R^R2R3(tdnametignoreR#tresultt	directorytsubdirectoriest	filenamestresultfilestexnametigtfilename((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR:s$

9c

CsI|p	d}g}|r$|g}ntjj|}|p?g}||krRgS|dkrgg}n|dkr|g}ntj|}g|D]}tjj||^q}	d|kr#|j|||gxIttjj|	D]/}
t	|
d||gd|d|d|qWng|D]}dj|^q*}|S(	s
    Get all packages which are under dname. This is necessary for
    Python 2.2's distutils. Pretty similar arguments to getDataFiles,
    including 'parent'.
    ts__init__.pytpkgnametresultsRbR#R"N(
R/R2tbasenametNoneR0R3R8tfiltertisdirR4(
RaRlRmRbR#tprefixtbnametsubfilestxtabssubfilestsubdirRctres((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR4s,		("RkcCstjj|d|}tjj|sXtjj|d}tjj|sXgSntj|}x3dddgD]"}||krw|j|qwqwWttjjg|D]}tjj||^qS(s
    Returns a list of scripts for a Twisted subproject; this works in
    any of an SVN checkout, a project-specific tarball.
    tbins.svns_preamble.pys
_preamble.pyc(R/R2R3RqR0R`Rptisfile(RBtbasedirt	scriptdirtthingiestspecialExclusionRu((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt
getScriptssR@cBseZdZdZRS(sr
    Changes behavior in Python 2.2 to support simultaneous specification of
    `packages' and `py_modules'.
    cCsI|jr|jn|jr,|jn|j|jdddS(Ntinclude_bytecodei(R&t
build_modulesR$tbuild_packagestbyte_compiletget_outputs(R((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pytruns
	
	
(RRRR(((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR@	sR=cBseZdZdZRS(s2Renames scripts so they end with '.py' on Windows.cCstjj|tjdks#dSxtj|jD]}tjj|j|}|jds6ytj	|dWn)t
k
r}|jddkrqnXtj||dq6q6WdS(Ntnts.pyisNo such file or directory(
RRR/tnameR0t	build_dirR2R3RRtunlinktEnvironmentErrorRtrename(Rtftfpathte((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyRs(RRRR(((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR=sR<cBseZdZdZRS(s>I make sure data files are installed in the package directory.cCs$|jddtjj|dS(Ntinstalltinstall_libtinstall_dir(RR(tset_undefined_optionsRtfinalize_options(R((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR,s	(RRRR(((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyR<*sRAcBs;eZdZdZdZdZdZdZRS(sb
    Allow subclasses to easily detect and customize Extensions to
    build at install-time.
    cCstjdkrdg|_n	g|_g|jD]}|j|r1|^q1|_x$|jD]}|jj|jq_WdS(s
        Prepare the C{self.extensions} attribute (used by
        L{build_ext.build_ext}) by checking which extensions in
        L{conditionalExtensions} should be built.  In addition, if we are
        building on NT, define the WIN32 macro to 1.
        RtWIN32iN(Ri(R/Rt
define_macrosR+RR.R;(RRutext((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pytprepare_extensions:s	cCs|jtjj|dS(sT
        Check to see which extension modules to build and then build them.
        N(RRtbuild_extensions(R((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyRLs
cCs:x3dD]+}ytj|Wqtk
r1qXqWdS(Ns
conftest.cs
conftest.osconftest.obj(s
conftest.cs
conftest.osconftest.obj(R/RR(RRj((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt_remove_conftestTs


cCsrtdd}zQ|j||jy|jjdgddWntk
rZtSXtSWd|jXdS(Ns
conftest.ctwt
output_dirRk(	topentwritetclosetcompilertcompileRtFalseRR(Rtcontenttconftest((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt_compile_helper\s


cCs(|jjd|d|jd|S(s
        Check if the given header can be included by trying to compile a file
        that contains only an #include line.
        schecking for %s ...is#include <%s>
(RtannounceR(Rtheader_name((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt
_check_headerks(RRRRRRRR(((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyRA4s				cCsty|jdkSWnYtk
roy |j\}}}|dkSWntk
rWnXd|jkrktStSXdS(s
    Checks if this implementation is CPython.

    On recent versions of Python, will use C{platform.python_implementation}.
    On 2.5, it will try to extract the implementation from sys.subversion. On
    older versions (currently the only supported older version is 2.4), checks
    if C{__pypy__} is in C{sys.modules}, since PyPy is the implementation we
    really care about. If it isn't, assumes CPython.

    This takes C{sys} and C{platform} kwargs that by default use the real
    modules. You shouldn't care about these -- they are for testing purposes
    only.

    @return: C{False} if the implementation is definitely not CPython, C{True}
        otherwise.
    tCPythont__pypy__N(tpython_implementationtAttributeErrort
subversiontmodulesRR(R>tplatformtimplementationt_((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt
_checkCPythonus

cCs
|jdS(s
    Checks if the header for building epoll (C{sys/epoll.h}) is available.

    @return: C{True} if the header is available, C{False} otherwise.
    ssys/epoll.h(R(R((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt	_hasEpolls($Rtdistutils.commandRRRRtdistutils.errorsRt	distutilsRtdistutils.coreRRQR/RR>ttwisted_subprojectsRRRR5RORPRUR^RoR:R4RR@R=R<RARt
_isCPythonR(((s7/usr/lib/python2.7/dist-packages/twisted/python/dist.pyt<module>s<"			7		'
A#