<commit_before>'''
Module for creating entry points and scripts for PyPI packages.
'''

from __future__ import absolute_import, division, print_function

import re
import os
import sys
import shutil
from os.path import dirname, isdir, join

import conda.config as cc

from conda_build.config import config


PY_TMPL = """\
if __name__ == '__main__':
    import sys
    from %s import %s

    sys.exit(%s())
"""

bin_dirname = 'Scripts' if sys.platform == 'win32' else 'bin'

entry_pat = re.compile('\s*([\w\-\.]+)\s*=\s*([\w.]+):(\w+)\s*$')


def iter_entry_points(items):
    for item in items:
        m = entry_pat.match(item)
        if m is None:
            sys.exit("Error cound not match entry point: %r" % item)
        yield m.groups()


def create_entry_point(path, module, func):
    pyscript = PY_TMPL % (module, func, func)
    if sys.platform == 'win32':
        with open(path + '-script.py', 'w') as fo:
            fo.write(pyscript)
        shutil.copyfile(join(dirname(__file__), 'cli-%d.exe' % cc.bits),<commit_msg>fix #251: support entry points with dots<commit_after>'''
Module for creating entry points and scripts for PyPI packages.
'''

from __future__ import absolute_import, division, print_function

import re
import os
import sys
import shutil
from os.path import dirname, isdir, join

import conda.config as cc

from conda_build.config import config


PY_TMPL = """\
if __name__ == '__main__':
    import sys
    import %(module)s

    sys.exit(%(module)s.%(func)s())
"""

bin_dirname = 'Scripts' if sys.platform == 'win32' else 'bin'

entry_pat = re.compile('\s*([\w\-\.]+)\s*=\s*([\w.]+):([\w.]+)\s*$')


def iter_entry_points(items):
    for item in items:
        m = entry_pat.match(item)
        if m is None:
            sys.exit("Error cound not match entry point: %r" % item)
        yield m.groups()


def create_entry_point(path, module, func):
    pyscript = PY_TMPL % {'module': module, 'func': func}
    if sys.platform == 'win32':
        with open(path + '-script.py', 'w') as fo:
            fo.write(pyscript)
        shutil.copyfile(join(dirname(__file__), 'cli-%d.exe' % cc.bits),
{'fraction_non_alphanumeric': 0.15063350539652745, 'fraction_numerical': 0.005161895823557016, 'mean_word_length': 3.2134387351778657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4701426', 'n_tokens_mistral': 746, 'n_tokens_neox': 729, 'n_words': 210}