当前位置: 首页>>代码示例>>Python>>正文


Python EntryPoint.parse_map方法代码示例

本文整理汇总了Python中pkg_resources.EntryPoint.parse_map方法的典型用法代码示例。如果您正苦于以下问题:Python EntryPoint.parse_map方法的具体用法?Python EntryPoint.parse_map怎么用?Python EntryPoint.parse_map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pkg_resources.EntryPoint的用法示例。


在下文中一共展示了EntryPoint.parse_map方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from pkg_resources import EntryPoint [as 别名]
# 或者: from pkg_resources.EntryPoint import parse_map [as 别名]
def run(self):
        """
        Generate man pages for the scripts defined in distutils setup().

        The cli application is gathered from the setuptools setup()
        function in setup.py.

        The generated man pages are written to files in the directory given
        by ``--target``.
        """
        eps = EntryPoint.parse_map(self.distribution.entry_points or '')

        if 'console_scripts' not in eps or not eps['console_scripts']:
            raise DistutilsSetupError('No entry points defined in setup()')

        console_scripts = [(k, v) for k, v in eps['console_scripts'].items()]
        # FIXME: create own setup() attribute for CLI script configuration
        for name, entry_point in console_scripts:
            self.announce('Load entry point {0}'.format(name), level=2)
            cli = entry_point.resolve()
            self.announce('Generate man pages for {0}'.format(name), level=2)
            write_man_pages(name, cli, version=self.version, target_dir=self.target) 
开发者ID:click-contrib,项目名称:click-man,代码行数:24,代码来源:man_pages.py

示例2: gen_header

# 需要导入模块: from pkg_resources import EntryPoint [as 别名]
# 或者: from pkg_resources.EntryPoint import parse_map [as 别名]
def gen_header(self):
        epm = EntryPoint.parse_map(self.distribution.entry_points or '')
        ep = epm.get('setuptools.installation', {}).get('eggsecutable')
        if ep is None:
            return 'w'  # not an eggsecutable, do it the usual way.

        if not ep.attrs or ep.extras:
            raise DistutilsSetupError(
                "eggsecutable entry point (%r) cannot have 'extras' "
                "or refer to a module" % (ep,)
            )

        pyver = sys.version[:3]
        pkg = ep.module_name
        full = '.'.join(ep.attrs)
        base = ep.attrs[0]
        basename = os.path.basename(self.egg_output)

        header = (
            "#!/bin/sh\n"
            'if [ `basename $0` = "%(basename)s" ]\n'
            'then exec python%(pyver)s -c "'
            "import sys, os; sys.path.insert(0, os.path.abspath('$0')); "
            "from %(pkg)s import %(base)s; sys.exit(%(full)s())"
            '" "$@"\n'
            'else\n'
            '  echo $0 is not the correct name for this egg file.\n'
            '  echo Please rename it back to %(basename)s and try again.\n'
            '  exec false\n'
            'fi\n'
        ) % locals()

        if not self.dry_run:
            mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run)
            f = open(self.egg_output, 'w')
            f.write(header)
            f.close()
        return 'a' 
开发者ID:jpush,项目名称:jbox,代码行数:40,代码来源:bdist_egg.py

示例3: gen_header

# 需要导入模块: from pkg_resources import EntryPoint [as 别名]
# 或者: from pkg_resources.EntryPoint import parse_map [as 别名]
def gen_header(self):
        epm = EntryPoint.parse_map(self.distribution.entry_points or '')
        ep = epm.get('setuptools.installation',{}).get('eggsecutable')
        if ep is None:
            return 'w'  # not an eggsecutable, do it the usual way.

        if not ep.attrs or ep.extras:
            raise DistutilsSetupError(
                "eggsecutable entry point (%r) cannot have 'extras' "
                "or refer to a module" % (ep,)
            )

        pyver = sys.version[:3]
        pkg = ep.module_name
        full = '.'.join(ep.attrs)
        base = ep.attrs[0]
        basename = os.path.basename(self.egg_output)

        header = (
            "#!/bin/sh\n"
            'if [ `basename $0` = "%(basename)s" ]\n'
            'then exec python%(pyver)s -c "'
            "import sys, os; sys.path.insert(0, os.path.abspath('$0')); "
            "from %(pkg)s import %(base)s; sys.exit(%(full)s())"
            '" "$@"\n'
            'else\n'
            '  echo $0 is not the correct name for this egg file.\n'
            '  echo Please rename it back to %(basename)s and try again.\n'
            '  exec false\n'
            'fi\n'

        ) % locals()

        if not self.dry_run:
            mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run)
            f = open(self.egg_output, 'w')
            f.write(header)
            f.close()
        return 'a' 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:41,代码来源:bdist_egg.py

示例4: _read_entry_points

# 需要导入模块: from pkg_resources import EntryPoint [as 别名]
# 或者: from pkg_resources.EntryPoint import parse_map [as 别名]
def _read_entry_points(ep_contents):
    ep_map = EntryPoint.parse_map(ep_contents)

    for _, epgroup in ep_map.iteritems():
        for epname, ep in epgroup.iteritems():
            epgroup[epname] = str(ep)

    return ep_map 
开发者ID:PaloAltoNetworks,项目名称:minemeld-core,代码行数:10,代码来源:manager.py

示例5: get_wex_entry_points_from_cwd

# 需要导入模块: from pkg_resources import EntryPoint [as 别名]
# 或者: from pkg_resources.EntryPoint import parse_map [as 别名]
def get_wex_entry_points_from_cwd():
    try:
        with open(os.path.join(os.getcwd(), 'entry_points.txt')) as txt:
            entry_point_map = EntryPoint.parse_map(txt.read())
        entry_points = dict((str(ep), ep)
                            for ep in entry_point_map.get(GROUP, {}).values())
        if os.getcwd() not in sys.path:
            sys.path.insert(0, os.getcwd())
    except IOError as exc:
        if exc.errno != errno.ENOENT:
            raise
        entry_points = {}

    return entry_points 
开发者ID:eBay,项目名称:wextracto,代码行数:16,代码来源:entrypoints.py

示例6: gen_header

# 需要导入模块: from pkg_resources import EntryPoint [as 别名]
# 或者: from pkg_resources.EntryPoint import parse_map [as 别名]
def gen_header(self):
        epm = EntryPoint.parse_map(self.distribution.entry_points or '')
        ep = epm.get('setuptools.installation', {}).get('eggsecutable')
        if ep is None:
            return 'w'  # not an eggsecutable, do it the usual way.

        if not ep.attrs or ep.extras:
            raise DistutilsSetupError(
                "eggsecutable entry point (%r) cannot have 'extras' "
                "or refer to a module" % (ep,)
            )

        pyver = '{}.{}'.format(*sys.version_info)
        pkg = ep.module_name
        full = '.'.join(ep.attrs)
        base = ep.attrs[0]
        basename = os.path.basename(self.egg_output)

        header = (
            "#!/bin/sh\n"
            'if [ `basename $0` = "%(basename)s" ]\n'
            'then exec python%(pyver)s -c "'
            "import sys, os; sys.path.insert(0, os.path.abspath('$0')); "
            "from %(pkg)s import %(base)s; sys.exit(%(full)s())"
            '" "$@"\n'
            'else\n'
            '  echo $0 is not the correct name for this egg file.\n'
            '  echo Please rename it back to %(basename)s and try again.\n'
            '  exec false\n'
            'fi\n'
        ) % locals()

        if not self.dry_run:
            mkpath(os.path.dirname(self.egg_output), dry_run=self.dry_run)
            f = open(self.egg_output, 'w')
            f.write(header)
            f.close()
        return 'a' 
开发者ID:ali5h,项目名称:rules_pip,代码行数:40,代码来源:bdist_egg.py


注:本文中的pkg_resources.EntryPoint.parse_map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。