Python setuptools 模块,compat() 实例源码

我们从Python开源项目中,提取了以下48个代码示例,用于说明如何使用setuptools.compat()

项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:PDF_text_extract    作者:theemadnes    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:Callandtext    作者:iaora    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:python_ddd_flask    作者:igorvinnicius    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:OneClickDTU    作者:satwikkansal    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:Flask-SocketIO    作者:cutedogspark    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:youtube-trending-music    作者:ishan-nitj    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:compatify    作者:hatooku    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:compatify    作者:hatooku    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:ropi    作者:ThumbGen    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:twitter_word_count    作者:prrateekk    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:Hawkeye    作者:tozhengxq    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:tf_aws_ecs_instance_draining_on_scale_in    作者:terraform-community-modules    | 项目源码 | 文件源码
def _render(items):
        cmdline = subprocess.list2cmdline(items)
        return '#!' + cmdline + '\n'

# For pbr compat; will be removed in a future version.
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:PDF_text_extract    作者:theemadnes    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a configparser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, configparser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = configparser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except configparser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Callandtext    作者:iaora    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:NeuroMobile    作者:AndrewADykman    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:python_ddd_flask    作者:igorvinnicius    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:OneClickDTU    作者:satwikkansal    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            # byte.
            if sys.version_info >= (2, 6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Flask-SocketIO    作者:cutedogspark    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:youtube-trending-music    作者:ishan-nitj    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:compatify    作者:hatooku    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:compatify    作者:hatooku    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:ropi    作者:ThumbGen    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:micro-blog    作者:nickChenyx    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            # byte.
            if sys.version_info >= (2, 6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:twitter_word_count    作者:prrateekk    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Hawkeye    作者:tozhengxq    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:Alfred    作者:jkachhadia    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:BD_T2    作者:jfmolano1587    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename,'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended-12)

        from setuptools.compat import StringIO, ConfigParser
        import struct
        tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None     # not a valid tag

        f.seek(prepended-(12+cfglen))
        cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
        try:
            part = f.read(cfglen)
            # part is in bytes, but we need to read up to the first null
            #  byte.
            if sys.version_info >= (2,6):
                null_byte = bytes([0])
            else:
                null_byte = chr(0)
            config = part.split(null_byte, 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()
项目:tf_aws_ecs_instance_draining_on_scale_in    作者:terraform-community-modules    | 项目源码 | 文件源码
def extract_wininst_cfg(dist_filename):
    """Extract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    """
    f = open(dist_filename, 'rb')
    try:
        endrec = zipfile._EndRecData(f)
        if endrec is None:
            return None

        prepended = (endrec[9] - endrec[5]) - endrec[6]
        if prepended < 12:  # no wininst data here
            return None
        f.seek(prepended - 12)

        from setuptools.compat import StringIO, ConfigParser
        import struct

        tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
        if tag not in (0x1234567A, 0x1234567B):
            return None  # not a valid tag

        f.seek(prepended - (12 + cfglen))
        cfg = ConfigParser.RawConfigParser(
            {'version': '', 'target_version': ''})
        try:
            part = f.read(cfglen)
            # Read up to the first null byte.
            config = part.split(b'\0', 1)[0]
            # Now the config is in bytes, but for RawConfigParser, it should
            #  be text, so decode it.
            config = config.decode(sys.getfilesystemencoding())
            cfg.readfp(StringIO(config))
        except ConfigParser.Error:
            return None
        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
            return None
        return cfg

    finally:
        f.close()