HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/share/dh-python/dhpython/__pycache__/interpreter.cpython-35.pyc


vXN@sddlZddlZddlZddlmZmZddlmZmZm	Z	ej
dejZej
dejZ
ejdZGdddZdd	lmZdd
lmZmZdS)N)joinsplit)INTERPRETER_DIR_TPLS
PUBLIC_DIR_RE
OLD_SITE_DIRSz
    (?:\#!\s*){0,1}  # shebang prefix
    (?P<path>
        .*?/bin/.*?)?
    (?P<name>
        python|pypy)
    (?P<version>
        \d[\.\d]*)?
    (?P<debug>
        -dbg)?
    (?P<options>.*)
    am
    (?P<name>.*?)
    (?:\.
        (?P<stableabi>abi\d+)
     |(?:\.
        (?P<soabi>
            (?P<impl>cpython|pypy)
            -
            (?P<ver>\d{2})
            (?P<flags>[a-z]*)
        )?
        (?:
            (?:(?<!\.)-)?  # minus sign only if soabi is defined
            (?P<multiarch>[^/]*?)
        )?
    ))?
    (?P<debug>_d)?
    \.so$dhpythonc	@seZdZdZdZdZdZdZdZfZ	iZ
dddddddddZd	d
ZddZ
d
dZddddZdddZeddZeddZeddZeddZdddddZdddddZdd Zd!d"Zdd#d$Zdd%d&Zdd'd(Zdd)d*Zdd+d,Z dd-d.Z!ed/d0Z"ed1d2Z#dd3d4Z$d5d6Z%dd7d8Z&dd9d:d;Z'dS)<Interpretera
    :attr path: /usr/bin/ in most cases
    :attr name: pypy or python (even for python3 and python-dbg) or empty string
    :attr version: interpreter's version
    :attr debug: -dbg version of the interpreter
    :attr impl: implementation (cpytho2, cpython3 or pypy)
    :attr options: options parsed from shebang
    :type path: str
    :type name: str
    :type version: Version or None
    :type debug: bool
    :type impl: str
    :type options: tuple
    z	/usr/bin/pythonNFcCs7t}|d=|d=t|trcx|jD])}	||	dkr3t||	||	<q3Wnx|r|jddjr|rt||d<n@x=|j|j	D]&\}	}
||	dkr|
||	<qWxU|j	D]G\}	}
|
dk	rt
||	|
q|	dkrt
||	|
qWdS)Nselfvalue.r
version)locals
isinstancerkeysgetattrreplaceisdigitVersionparseitemssetattr)rrpathnamerdebugimploptionsZparamskeyvalr ,/usr/share/dh-python/dhpython/interpreter.py__init__Ss$	"zInterpreter.__init__cCs:|dkr|dkr(td||dkro|jr|jjdkr_d|jd<qd	|jd<q|dkrd|jd<na|d
kr|dk	rt|}|jr|jdkr|jdkrd|_n	d	|_|dkr|dkrn/|d
kr)t||j|<n
||j|<dS)Nrr	pypyr
zinterpreter not supported: %scpython3rcpython2rrrr)r	r#r
)rrrr)
ValueErrorrmajor__dict__rrrbool)rrrr r r!__setattr__ns*		zInterpreter.__setattr__cCs_|j}|jds"|d7}||j|j7}|jr[|ddj|j7}|S)N/ )rendswith_vstrrrr)rresultr r r!__repr__s	
	zInterpreter.__repr__cCs|j|jS)N)r/r)rr r r!__str__szInterpreter.__str__cCs|jdkr|jS|p(|jp(d}|re|sG||jkre|jdkr\dnd}n*t|tr|tddkrd}|jrdj|S|jt|S)Nr#r
r%3r(zpython{}-dbg)	rrrdefault_versionrrrformatstr)rrconsider_default_verr r r!r/s$	
zInterpreter._vstrcCsdj|j|j|S)Nz{}{})r6rr/)rrr r r!binaryszInterpreter.binarycCsdj|j|jddS)zLike binary(), but returns path to default intepreter symlink
        if version matches default one for given implementation.
        z{}{}r8T)r6rr/)rr r r!	binary_dvszInterpreter.binary_dvcCs|jrt|jSdS)N)rdefault)rr r r!r5s	zInterpreter.default_versioncCsytj|}|siS|j}d|krKt|dj|d<|ddkru|ddkrud|d<|S)a^Return dict with parsed shebang

        >>> sorted(Interpreter.parse('/usr/bin/python3.2-dbg').items())
        [('debug', '-dbg'), ('name', 'python'), ('options', ()), ('path', '/usr/bin/'), ('version', '3.2')]
        >>> sorted(Interpreter.parse('#! /usr/bin/python3.2').items())
        [('debug', None), ('name', 'python'), ('options', ()), ('path', '/usr/bin/'), ('version', '3.2')]
        >>> sorted(Interpreter.parse('/usr/bin/python3.2-dbg --foo --bar').items())
        [('debug', '-dbg'), ('name', 'python'), ('options', ('--foo', '--bar')), ('path', '/usr/bin/'), ('version', '3.2')]
        rrr	rN2)
SHEBANG_REsearch	groupdicttupler)Zshebangr0r r r!rs 
zInterpreter.parsecCst}t|d.}|jd}d|krBtdWdQRXt|djdd}|jd	std
||j|}|std
|x*|jD]\}}t	|||qW|S)z!Read file's shebang and parse it.rb`szcannot parse binary fileNzutf-8
rz#!zdoesn't look like a shebang: %s)
ropenreadr'r7r
startswithrrr)clsfpathZinterpreterfpdataZparsedrrr r r!	from_files	zInterpreter.from_filecCsyt|p|j}Wn5tk
rP}ztd|WYdd}~XnX|jdkrid}n@|td>rd|}n#|td>rd|}nd	}|rd
|}|rd||f}|S)aReturn path to site-packages directory.

        Note that returned path is not the final location of .py files

        >>> i = Interpreter('python')
        >>> i.sitedir(version='3.1')
        '/usr/lib/python3/dist-packages/'
        >>> i.sitedir(version='2.5')
        '/usr/lib/python2.5/site-packages/'
        >>> i.sitedir(version=Version('2.7'))
        '/usr/lib/python2.7/dist-packages/'
        >>> i.sitedir(version='3.1', gdb=True, package='python3-foo')
        'debian/python3-foo/usr/lib/debug/usr/lib/python3/dist-packages/'
        >>> i.sitedir(version=Version('3.2'))
        '/usr/lib/python3/dist-packages/'
        zcannot find valid version: %sNr#z/usr/lib/pypy/dist-packages/z2.6z /usr/lib/python%s/site-packages/z3.0z /usr/lib/python%s/dist-packages/z/usr/lib/python3/dist-packages/z/usr/lib/debug%szdebian/%s%s)rr	Exceptionr'r)rpackagergdberrrr r r!sitedirs #	


zInterpreter.sitedircs(yt|p|j}Wn5tk
rP}ztd|WYdd}~XnXg}xjtj|jgD]S}t|tr|j	|j
|qm||}|dk	rm|j	|qmW|rdd|D}|jjdr|j	dj
|r$fdd|D}|S)z5Return deprecated paths to site-packages directories.zcannot find valid version: %sNcSsg|]}dj|qS)z/usr/lib/debug{})r6).0ir r r!
<listcomp>s	z,Interpreter.old_sitedirs.<locals>.<listcomp>cpythonz(/usr/lib/debug/usr/lib/pyshared/python{}cs"g|]}dj|qS)zdebian/{}{})r6)rQrR)rMr r!rSs	)rrrLr'rgetrrr7appendr6rF)rrMrrNrOr0itemresr )rMr!old_sitedirss$#zInterpreter.old_sitedirscCsMt|jj|}|rI|jd}|rE|drEt|SdSdS)z]Return version assigned to site-packages path
        or True is it's unversioned public dir.rTN)rrmatchgroupsr)rrrZZversr r r!parse_public_dirs
zInterpreter.parse_public_dircsdjj}|jjkr{fddtjD}tjdjdd|D}|jj|<njj|}|j	|S)zBReturn True if path is used by another interpreter implementation.zshould_ignore_{}cs+g|]!\}}|jkr|qSr )r)rQkv)rr r!rS&s	z-Interpreter.should_ignore.<locals>.<listcomp>|css|]}dj|VqdS)z({})N)r6)rQrRr r r!	<genexpr>'sz,Interpreter.should_ignore.<locals>.<genexpr>)
r6r	__class___cacherrrecompilerr>)rrZ	cache_keyexprZregexpr )rr!
should_ignore"s%zInterpreter.should_ignorecCst|p|j}d|jkr*dnd}|tdkrJ||St|\}}|jdsu|d7}t|dd|dd
|j||fS)aGiven path to a .py file, return path to its .pyc/.pyo file.

        This function is inspired by Python 3.2's imp.cache_from_source.

        :param fpath: path to file name
        :param version: Python version

        >>> i = Interpreter('python')
        >>> i.cache_file('foo.py', Version('3.1'))
        'foo.pyc'
        >>> i.cache_file('bar/foo.py', '3.4')
        'bar/__pycache__/foo.cpython-34.pyc'
        z-Oocz3.1z.py__pycache__z
%s.%s.py%sNr$)rrrrr.r	magic_tag)rrHrZ	last_charfdirfnamer r r!
cache_file-s
zInterpreter.cache_filecCsDt|p|j}|jdkr(dS|jd|}t|S)zReturn magic number.r&r
z"import imp; print(imp.get_magic()))rrr_executeeval)rrr0r r r!magic_numberFs
zInterpreter.magic_numbercCsKt|p|j}|jjdr;|td>r;dS|jd|S)zReturn Python magic tag (used in __pycache__ dir to tag files).

        >>> i = Interpreter('python')
        >>> i.magic_tag(version='3.4')
        'cpython-34'
        rTz3.2r
z import imp; print(imp.get_tag()))rrrrFro)rrr r r!rkNs"zInterpreter.magic_tagcCsht|p|j}y#|j|dd\}}Wn)tk
rctjddddSYnX|S)zReturn multiarch tag.Nr4zcannot get multiarchexc_infoTr
)rr_get_configrLlogr)rrsoabi	multiarchr r r!rvZs#
	zInterpreter.multiarchcCsHt|p|j}|jdkrD|td?rDdj|jSdS)Nr%z3.2zabi{})rrrr6r()rrr r r!	stableabieszInterpreter.stableabicCsht|p|j}y#|j|dd\}}Wn)tk
rctjddddSYnX|S)z)Return SOABI flag (used to in .so files).Nr4zcannot get soabirrTr
)rrrsrLrtr)rrrurvr r r!ruks#
	zInterpreter.soabicCs|jdkrdSy|jd}|r0|SWn+tk
r^d}tjdddYnXdj|j}|j}|jr|d	>r|d
7}q|d7}n-|d?r|d
7}n|dkr|d7}|S)zReturn INCLUDE_DIR path.

        >>> Interpreter('python2.7').include_dir
        '/usr/include/python2.7'
        >>> Interpreter('python3.4-dbg').include_dir
        '/usr/include/python3.4dm'
        r#z/usr/lib/pypy/includer4r
zcannot get include pathrrTz/usr/include/{}z3.3_dZdmz3.2mZmu)rrsrLrtrr6rr)rr0rr r r!include_dirws(	
		





zInterpreter.include_dircCs|jdkrdS|jdd\}}|jdrP|jdd}|ri|rit||Stdj|dS)	zReturn libfoo.so file path.r#r
r$z.az.sozcannot find library file for {}N)rrsr.rrrLr6)rZlibplZ	ldlibraryr r r!library_files
zInterpreter.library_filec
Cs|r|jrdSt|p$|j}d|krQ|jdd\}}nd}tj|}|spdS|j}|dr|s|jdkrtd|dd|ddf}|drdS|d	r|jd
krdS|dr|drdSy#|j|dd
\}}Wn)t	k
rSt
jddddSYnX|drx|rx|d|krxdS|dp|}|dp|}|d}	|	jdr|	dkr|jdkr|d?s|jdkr|dkr|	dd}	|rZdj
|	|}	|r|jdko5|d>r||krdj
|	|}	n3|jdkr|dkr|rdj
|	|}	|jr|jdkr|	d7}	|	d7}	||	krdSt||	S)z2Return extension file name if file can be renamed.Nr,r
Zverz%s.%srrwrFrurvr4zcannot get soabi/multiarchrrTrmoduler%z3.2r&z2.7z{}.{}z3.3z{}-{}rxz.soi)rrrsplit
EXTFILE_REr>r?minorrrsrLrtr.rr6r)
rrmrrlinforurvZ	tmp_soabiZ
tmp_multiarchr0r r r!
check_extnamesX &
#
	 
,!

zInterpreter.check_extnamecCs`|jdkrdj|S|jdkr1dnd}dj||}|jr\|d7}|S)aASuggest binary package name with for given library name

        >>> Interpreter('python3.1').suggest_pkg_name('foo')
        'python3-foo'
        >>> Interpreter('python3.4').suggest_pkg_name('foo')
        'python3-foo'
        >>> Interpreter('python2.7-dbg').suggest_pkg_name('bar')
        'python-bar-dbg'
        r#zpypy-{}r%r3r
zpython{}-{}z-dbg)rr6r)rrrr0r r r!suggest_pkg_names

	
zInterpreter.suggest_pkg_namecCst|p|j}|jdks`|jjdri|d?rJ|d>s`|d?s`|dkrid}nd}|d7}|j||jd	}|d
|dkr|djd|d
d
|d<ytjd|d
<Wnt	k
rYnX|S)Nr#rTz2.6r3z3.1zimport sysconfig as s;z%from distutils import sysconfig as s;zrprint("__SEP__".join(i or "" for i in s.get_config_vars("SOABI", "MULTIARCH", "INCLUDEPY", "LIBPL", "LDLIBRARY")))Z__SEP__r}rz-%sr
ZDEB_HOST_MULTIARCH)
rrrrFrorrosenvironKeyError)rrcmdZ	conf_varsr r r!rss!	
"
zInterpreter._get_configTcCst|p|j}dj|j||jdd}|rb||jjkrb|jj|St|}|ddkrtj	|dt
dj||d|dj}t|dkr|d}|r||jj|<|S)	Nz
{} -c '{}''
returncoderstderrz{} failed with status code {}stdoutr})
rrr6r/rrarbexecutertrrL
splitlineslen)rZcommandrcacheoutputr0r r r!ro
s'
zInterpreter._execute)(__name__
__module____qualname____doc__rrrrrrrbr"r+r1r2r/r9propertyr:r5staticmethodrclassmethodrKrPrYr\rfrnrqrkrvrwrurzr|rrrsror r r r!r<sF	
%
 
@r)r)rr;)Zloggingrrcos.pathrrrrrrrdVERBOSEr=rZ	getLoggerrtrZdhpython.toolsrZdhpython.versionrr;r r r r!<module>s