Python distutils.command.build_scripts.first_line_re 模块,pattern() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用distutils.command.build_scripts.first_line_re.pattern()

项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:Callandtext    作者:iaora    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:NeuroMobile    作者:AndrewADykman    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:python_ddd_flask    作者:igorvinnicius    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:Flask-SocketIO    作者:cutedogspark    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:youtube-trending-music    作者:ishan-nitj    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:compatify    作者:hatooku    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:compatify    作者:hatooku    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:ropi    作者:ThumbGen    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def _adjust_header(type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        clean_header = new_header[2:-1].strip('"')
        if sys.platform == 'win32' and not os.path.exists(clean_header):
            # the adjusted version doesn't exist, so return the original
            return orig_header
        return new_header
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def get_script_header(script_text, executable=sys_executable, wininst=False):
    """Create a #! line, getting options (if any) from script_text"""
    from distutils.command.build_scripts import first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    if not isinstance(first_line_re.pattern, str):
        first_line_re = re.compile(first_line_re.pattern.decode())

    first = (script_text+'\n').splitlines()[0]
    match = first_line_re.match(first)
    options = ''
    if match:
        options = match.group(1) or ''
        if options: options = ' '+options
    if wininst:
        executable = "python.exe"
    else:
        executable = nt_quote_arg(executable)
    hdr = "#!%(executable)s%(options)s\n" % locals()
    if not isascii(hdr):
        # Non-ascii path to sys.executable, use -x to prevent warnings
        if options:
            if options.strip().startswith('-'):
                options = ' -x'+options.strip()[1:]
            # else: punt, we can't do it, let the warning happen anyway
        else:
            options = ' -x'
    executable = fix_jython_executable(executable, options)
    hdr = "#!%(executable)s%(options)s\n" % locals()
    return hdr
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
def _first_line_re():
    """
    Return a regular expression based on first_line_re suitable for matching
    strings.
    """
    if isinstance(first_line_re.pattern, str):
        return first_line_re

    # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
    return re.compile(first_line_re.pattern.decode())
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
def _adjust_header(cls, type_, orig_header):
        """
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        """
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header