Viewing File: /usr/lib/python3.6/site-packages/pip/_vendor/distlib/__pycache__/scripts.cpython-36.opt-1.pyc

3

ajx;@sddlmZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZddl
mZmZmZmZmZejeZdjZejdZd	Zd
dZGdd
d
eZdS))BytesION)	sysconfigdetect_encodingZipFile)finder)FileOperatorget_export_entryconvert_pathget_executablein_venva
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 <assemblyIdentity version="1.0.0.0"
 processorArchitecture="X86"
 name="%s"
 type="win32"/>

 <!-- Identify the application security requirements. -->
 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
 <security>
 <requestedPrivileges>
 <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
 </requestedPrivileges>
 </security>
 </trustInfo>
</assembly>s^#!.*pythonw?[0-9.]*([ 	].*)?$a|# -*- coding: utf-8 -*-
if __name__ == '__main__':
    import sys, re

    def _resolve(module, func):
        __import__(module)
        mod = sys.modules[module]
        parts = func.split('.')
        result = getattr(mod, parts.pop(0))
        for p in parts:
            result = getattr(result, p)
        return result

    try:
        sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])

        func = _resolve('%(module)s', '%(func)s')
        rc = func() # None interpreted as 0
    except Exception as e:  # only supporting Python >= 2.6
        sys.stderr.write('%%s\n' %% e)
        rc = 1
    sys.exit(rc)
cCsZd|krV|jdrD|jdd\}}d|krV|jdrVd||f}n|jdsVd|}|S)N z
/usr/bin/env r"z%s "%s"z"%s")
startswithsplit)
executableenvZ_executabler/usr/lib/python3.6/scripts.py_enquote_executableBs

rc@seZdZdZeZdZd%ddZddZe	j
jd	rBd
dZdd
Z
d&ddZddZeZddZddZd'ddZddZeddZejddZejdksejd	krejdkrdd Zd(d!d"Zd)d#d$ZdS)*ScriptMakerz_
    A class to copy or create scripts from source scripts or callable
    specifications.
    NTFcCsz||_||_||_d|_d|_tjdkp:tjdko:tjdk|_t	d|_
|pRt||_tjdkprtjdkortjdk|_
dS)NFposixjavaX.Ynt)rr)
source_dir
target_dir
add_launchersforceclobberosname_nameset_modesetvariantsr_fileop_is_nt)selfrrrdry_runZfileoprrr__init__[s

zScriptMaker.__init__cCs@|jddr<|jr<tjj|\}}|jdd}tjj||}|S)NguiFpythonZpythonw)getr(r!pathrreplacejoin)r)roptionsZdnfnrrr_get_alternate_executableks
z%ScriptMaker._get_alternate_executablercCsLy"t|}|jddkSQRXWn$ttfk
rFtjd|dSXdS)zl
            Determine if the specified executable is a script
            (contains a #! line)
            z#!NzFailed to open %sF)openreadOSErrorIOErrorloggerwarning)r)rfprrr	_is_shellss
zScriptMaker._is_shellcCsD|j|r*ddl}|jjjddkr<|Sn|jjdr<|Sd|S)Nrzos.nameZLinuxz
jython.exez/usr/bin/env %s)r=rZlangZSystemZgetPropertylowerendswith)r)rrrrr_fix_jython_executables
z"ScriptMaker._fix_jython_executablecCsdd}|jr|j}d}n^tjs&t}nNtrLtjjtjddtj	d}n(tjjtj	ddtj	dtj	df}|r|j
||}tjj
d	r|j|}tjj|}|rt|}|jd
}tjdkrd|krd
|kr|d7}d||d}y|jd
Wn"tk
rtd|YnX|d
kr`y|j|Wn&tk
r^td||fYnX|S)NTFscriptszpython%sEXEBINDIRz
python%s%sVERSIONrzutf-8Zcliz	-X:Framesz
-X:FullFramess
 -X:Framess#!
z,The shebang (%r) is not decodable from utf-8z?The shebang (%r) is not decodable from the script encoding (%r))rris_python_buildrrr!r/r1get_pathget_config_varr4sysplatformrr@normcaserencodedecodeUnicodeDecodeError
ValueError)r)encodingpost_interpr2Zenquotershebangrrr_get_shebangsL



zScriptMaker._get_shebangcCs|jt|j|jdS)N)modulefunc)script_templatedictprefixsuffix)r)entryrrr_get_script_texts
zScriptMaker._get_script_textcCstjj|}|j|S)N)r!r/basenamemanifest)r)Zexenamebaserrrget_manifestszScriptMaker.get_manifestcCs|jo
|j}tjjd}|s*|||}n^|dkr>|jd}n
|jd}t}	t|	d}
|
jd|WdQRX|	j	}||||}xd|D]Z}tj
j|j|}
|rrtj
j
|
\}}|jdr|}
d|
}
y|jj|
|Wntk
rntjdd	|
}tj
j|r tj|tj|
||jj|
|tjd
ytj|Wntk
rhYnXYnXnp|jr|
jd|rd|
|f}
tj
j|
r|jrtjd
|
q|jj|
||jr|jj|
g|j|
qWdS)Nzutf-8pytwz__main__.pyz.pyz%s.exez:Failed to write executable - trying to use .deleteme logicz%s.deletemez0Able to replace executable using .deleteme logic.z%s.%szSkipping existing file %s)rr(r!lineseprM
_get_launcherrrZwritestrgetvaluer/r1rsplitextrr'Zwrite_binary_file	Exceptionr:r;existsremoverenamedebugr?r r$set_executable_modeappend)r)namesrSZscript_bytes	filenamesextZuse_launcherreZlauncherstreamZzfZzip_datar"outnameneZdfnamerrr
_write_scriptsT




zScriptMaker._write_scriptcCsd}|r0|jdg}|r0ddj|}|jd}|jd||d}|j|jd}|j}t}	d|jkrp|	j|d|jkr|	jd	|t	j
d
fd|jkr|	jd|t	j
dd
f|r|jddrd}
nd}
|j|	||||
dS)NrAZinterpreter_argsz %sr
zutf-8)r2rXz%s%srzX.Yz%s-%sr,Fpywra)r.r1rMrTr\r"r%r&addrJversionrw)r)r[rqr2rRargsrSscriptr"Zscriptnamesrrrrr_make_scripts(




zScriptMaker._make_scriptcCsd}tjj|jt|}tjj|jtjj|}|jrX|jj	||rXt
jd|dSyt|d}Wn t
k
r|js~d}YnLX|j}|st
jd|j|dStj|jdd}|rd}|jdpd	}|s|r|j|jj|||jr|jj|g|j|nt
jd
||j|jjst|j\}	}
|jd|j|	|}d|krbd
}nd}tjj|}
|j|
g||j |||r|jdS)NFznot copying %s (up-to-date)rbz"%s: %s is an empty file (skipping)s
rFTrrAzcopying and adjusting %s -> %srspythonwrzra)!r!r/r1rr
rr]rr'Znewerr:rmr6r9r*readliner;Zget_command_name
FIRST_LINE_REmatchr0groupcloseZ	copy_filer$rnroinforseekrTrwr7)r)r~rqZadjustrtfZ
first_linerrRrQlinesrSrrrurrr_copy_scriptsR



zScriptMaker._copy_scriptcCs|jjS)N)r'r*)r)rrrr*JszScriptMaker.dry_runcCs||j_dS)N)r'r*)r)valuerrrr*NsrcCsHtjddkrd}nd}d||f}tjddd}t|j|j}|S)	NPZ64Z32z%s%s.exerdrr)structcalcsize__name__rsplitrfindbytes)r)Zkindbitsr"Zdistlib_packageresultrrrrfVszScriptMaker._get_launchercCs6g}t|}|dkr"|j||n|j|||d|S)a
        Make a script.

        :param specification: The specification, which is either a valid export
                              entry specification (to make a script from a
                              callable) or a filename (to make a script by
                              copying from a source location).
        :param options: A dictionary of options controlling script generation.
        :return: A list of all absolute pathnames written to.
        N)r2)r	rr)r)
specificationr2rqr[rrrmakedszScriptMaker.makecCs(g}x|D]}|j|j||q
W|S)z
        Take a list of specifications and make scripts from them,
        :param specifications: A list of specifications.
        :return: A list of all absolute pathnames written to,
        )extendr)r)Zspecificationsr2rqrrrr
make_multiplews
zScriptMaker.make_multiple)TFN)rAN)N)N)N)r
__module____qualname____doc__SCRIPT_TEMPLATErWrr+r4rJrKrr=r@rTr\_DEFAULT_MANIFESTr^r`rwrrpropertyr*setterr!r"r#rfrrrrrrrRs,

82
4
r)iorZloggingr!rerrJcompatrrrZ	resourcesrutilrr	r
rrZ	getLoggerrr:striprcompilerrrobjectrrrrr<module>s


Back to Directory File Manager