ó >ìˆUc@sDddlZddlZddlZddlZddljjZddljjZ ddl m Z m Z dej fd„ƒYZdej fd„ƒYZdej fd„ƒYZd ej fd „ƒYZd ej fd „ƒYZd ejfd„ƒYZdejfd„ƒYZejdƒZejdƒZd„ZdS(iÿÿÿÿN(t PD_LOCAL_PATHt PD_PROTO_DIRtPythonModuleMissingPathcBs eZdZd„Zd„ZRS(snException that is raised when a module reports a module as a dependency without a path to that module.cCs#tj|ƒ||_||_dS(N(t Exceptiont__init__tnamet localpath(tselfRR((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR)s  cCstdƒ|jS(Ns>Could not find the file for %(name)s imported in %(localpath)s(t_t__dict__(R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyt__str__.s (t__name__t __module__t__doc__RR (((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR%s tPythonMismatchedVersioncBs eZdZd„Zd„ZRS(sException that is raised when a module is installed into a path associated with a known version of python (/usr/lib/python2.7 for example) but has a different version of python specified in its #! line (#!/usr/bin/python3.4 for example).cCs(||_||_||_||_dS(N(tinst_vtdecl_vtlptip(Rtinstalled_versiontdeclared_versiont local_filetinstalled_path((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR9s   cCstdƒ|jS(Ns»The file to be installed at %(ip)s declares a python version of %(decl_v)s. However, the path suggests that the version should be %(inst_v)s. The text of the file can be found at %(lp)s(RR (R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR @s (R R R RR (((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR3s tPythonSyntaxErrorcBs eZdZd„Zd„ZRS(s[Exception that is raised when a python file to be analyzed contains a syntax error.cCs=||_||_|j|_|j|_t|ƒ|_dS(N(RRtlinenotlinetoffsettcoltstrttxt(Rts_errRR((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyRKs     cCstdƒ|jS(NsþThe file to be installed at %(ip)s appears to be a python file but contains a syntax error that prevents it from being analyzed. The text of the file can be foundat %(lp)s. The error happened on line %(line)s at offset %(col)s. The problem was: %(txt)s(RR (R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR Rs (R R R RR (((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyRGs tPythonSubprocessErrorcBs eZdZd„Zd„ZRS(sThis exception is raised when the subprocess created to analyze the module using a different version of python exits with an error code.cCs||_||_||_dS(N(trctcmdterr(RR R!R"((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR^s  cCstdƒ|jS(NsLThe command %(cmd)s exited with return code %(rc)s and this message: %(err)s(RR (R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR cs (R R R RR (((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyRZs tPythonSubprocessBadLinecBs eZdZd„Zd„ZRS(sgThis exception is used when the output from the subprocess does not follow the expected format.cCsdj|ƒ|_||_dS(Ns (tjointlinesR!(RR!R%((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyRlscCstdƒ|jS(NsVThe command %(cmd)s produced the following lines which cannot be understood: %(lines)s(RR (R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR ps (R R R RR (((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR#hs tPythonUnspecifiedVersioncBs eZdZd„Zd„ZRS(s°This exception is used when an executable file starts with #!/usr/bin/python and is not installed into a location from which its python version may be inferred.cCs||_||_dS(N(RR(RRR((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyRzs cCstdƒ|jS(NsThe file to be installed in %(ip)s does not specify a specific version of python either in its installed path nor in its text. Such a file cannot be analyzed for dependencies since the version of python it will be used with is unknown. The text of the file is here: %(lp)s.(RR (R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR ~s (R R R RR (((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR&us tPythonDependencycBs eZdZd„Zd„ZRS(sRClass representing the dependency created by importing a module in python.cCs&tjj||||||dƒdS(Ntpython(tbasetPublishingDependencyR(Rtactiont base_namest run_pathstpkg_varst proto_dir((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR‹scCs d|j|j|j|jfS(NsPythonDep(%s, %s, %s, %s)(R+R,R-R.(R((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyt__repr__s (R R R RR0(((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyR'‡s s>^\#\!\s*/usr/bin/([^/]+/)?python(?P\d+)\.(?P\d+)s.^usr/lib/python(?P\d+)\.(?P\d+)/c$ Cs||jt}g}g}d}d}d} d} d} d} d} t|ƒ}d}d}tjdd!\} } tj|jdƒ}|r®|jdƒ}|jdƒ} nd}|rót j|ƒ}|ró|jdƒ} |jdƒ} qón|r¡|rW|rW| |ks| | krW|j t d|| fd| | f||jdƒƒn|rl|}| }q¶|r| }| }q¶|j t ||jdƒƒn|r¶|}| }n|dksÎ|dkrÛ||ifSt |ƒ}t |ƒ}| |krY| |krYtjtjj|jdƒd|ƒ}yÄ|j|ƒ}xntg|D]'}t|jƒƒt|jƒf^qRƒD]2\}}|j t|||||jtƒƒq€W|jƒ\}}x+|D]#}|j t||jtƒƒqÏWWnRtk r,}|j t||jd|ƒƒn tk rK}|j |ƒnX||ifStjjtƒ}tjj |dƒ}d ||f|tjj|jdƒ|g}|rÅ|j!|ƒny%t"j#|d t"j$d t"j$ƒ}Wn;tk r'}gt%dd j |ƒt&|ƒƒgifSX|j'ƒ\} }!|j(rk|j t%|j(d j |ƒ|!ƒƒng}"xÓ| j)ƒD]Å}#|#j*ƒ}#|#j+d ƒryt,|#dƒ\}}Wntk rÙ|"j |#ƒqCX|j t|||||jtƒƒq~|#j+dƒr6|j t|#d|jtƒƒq~|"j |#ƒq~W|"ro|j t-d j |ƒ|"ƒƒn||ifS(sAnalyze the file delivered by the action for any python dependencies. The 'action' parameter contain the action which delivers the file. The 'pkg_vars' parameter contains the variants against which the action's package was published. The 'script_path' parameter is None of the file is not executable, or is the path for the binary which is used to execute the file. The 'run_paths' parameter is a list of paths that should be searched for modules. iitpathtmajortminors%s.%sR-sdepthlimitedmf.pys python%s.%ststdouttstderrt sDEP isERR N(.tattrsRtNonetbooltsyst version_infot py_lib_retmatchtgroupt py_bin_retappendRR&tintt modulefindertDepthLimitedModuleFindertosR1tdirnamet run_scripttsetttupletget_file_namestdirsR'Rtany_missing_maybeRt SyntaxErrorRRt__file__R$textendt subprocesstPopentPIPERRt communicatet returncodet splitlineststript startswithtevalR#($R+R.t script_pathR-Rtdepsterrst path_versiont dir_majort dir_minort file_majort file_minort cur_majort cur_minort executabletanalysis_majortanalysis_minort install_matcht script_matchtmftloaded_modulestmtnamesRJtmissingtmaybeRtetroot_dirt exec_fileR!tsptoutR"t bad_linestl((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pytprocess_python_dependencies˜sÆ#             ">        "(RDtreROR:tpkg.flavor.basetflavorR)tpkg.flavor.depthlimitedmftdepthlimitedmfRBt pkg.portableRRtDependencyAnalysisErrorRRRRR#R*R&R'tcompileR?R<Rt(((s7/usr/lib/python2.7/vendor-packages/pkg/flavor/python.pyts"