ok
Direktori : /lib64/python2.7/Tools/scripts/ |
Current File : //lib64/python2.7/Tools/scripts/pysource.pyo |
� �fc @ s� d Z d Z d d d d g Z d d l Z d d l Z e j d � Z e Z d � Z d � Z d � Z d � Z d � Z e d d � Z e d k r� x e d g � D] Z e GHq� Wd GHx% e d g d e �D] Z e GHq� Wn d S( sC List python source files. There are three functions to check whether a file is a Python source, listed here with increasing complexity: - has_python_ext() checks whether a file name ends in '.py[w]'. - look_like_python() checks whether the file is not binary and either has the '.py[w]' extension or the first line contains the word 'python'. - can_be_compiled() checks whether the file can be compiled by compile(). The file also must be of appropriate size - not bigger than a megabyte. walk_python_files() recursively lists all Python files under the given directories. s Oleg Broytmann, Georg Brandlt has_python_extt looks_like_pythont can_be_compiledt walk_python_filesi����Ns [ --]c C s t r | GHn d S( N( t debug( t msg( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyt print_debug s c C s� y t j | � j } Wn( t k r@ } t d | | f � d SX| d k re t d | | f � d Sy t | d � SWn( t k r� } t d | | f � d SXd S( Ns %s: permission denied: %si s! %s: the file is too big: %d bytest rUs %s: access denied: %si ( t ost statt st_sizet OSErrorR t Nonet opent IOError( t fullpatht sizet err( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyt _open! s c C s | j d � p | j d � S( Ns .pys .pyw( t endswith( R ( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyR 2 s c C s� t | � } | d k r t S| j � } | j � t j | � rS t d | � t S| j d � sq | j d � ru t Sd | k r� t St S( Ns %s: appears to be binarys .pys .pywt python( R R t Falset readlinet closet binary_ret searchR R t True( R t infilet line( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyR 5 s c C su t | � } | d k r t S| j � } | j � y t | | d � Wn( t k rp } t d | | f � t SXt S( Nt execs %s: cannot compile: %s( R R R t readR t compilet ExceptionR R ( R R t codeR ( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyR J s c c s" | d k r g } n x| D]� } t d | � t j j | � rY | | � r| Vqq t j j | � rt d � x� t j | � D]� \ } } } x* | D]"