We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Entry point pattern doesn't match entrypoints:with.dots
Hi,

Could you please have a look to this. I define entry point as

``` python
entry_points={
    'console_scripts': [
        'poultry = poultry.main:dispatcher.dispatch',
    ],
},
```

https://github.com/dimazest/poultry/blob/e0f39277f0a219a4d3cd461b69ce5dd4422fc9dd/setup.py#L62

which entry point pattern at  https://github.com/conda/conda-build/blob/master/conda_build/scripts.py#L27 doesn't match.

Thanks.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conda_build/scripts.py`
Content:
```
1 '''
2 Module for creating entry points and scripts for PyPI packages.
3 '''
4 
5 from __future__ import absolute_import, division, print_function
6 
7 import re
8 import os
9 import sys
10 import shutil
11 from os.path import dirname, isdir, join
12 
13 import conda.config as cc
14 
15 from conda_build.config import config
16 
17 
18 PY_TMPL = """\
19 if __name__ == '__main__':
20     import sys
21     from %s import %s
22 
23     sys.exit(%s())
24 """
25 
26 bin_dirname = 'Scripts' if sys.platform == 'win32' else 'bin'
27 
28 entry_pat = re.compile('\s*([\w\-\.]+)\s*=\s*([\w.]+):(\w+)\s*$')
29 
30 
31 def iter_entry_points(items):
32     for item in items:
33         m = entry_pat.match(item)
34         if m is None:
35             sys.exit("Error cound not match entry point: %r" % item)
36         yield m.groups()
37 
38 
39 def create_entry_point(path, module, func):
40     pyscript = PY_TMPL % (module, func, func)
41     if sys.platform == 'win32':
42         with open(path + '-script.py', 'w') as fo:
43             fo.write(pyscript)
44         shutil.copyfile(join(dirname(__file__), 'cli-%d.exe' % cc.bits),
45                         path + '.exe')
46     else:
47         with open(path, 'w') as fo:
48             fo.write('#!%s\n' % config.build_python)
49             fo.write(pyscript)
50         os.chmod(path, int('755', 8))
51 
52 
53 def create_entry_points(items):
54     if not items:
55         return
56     bin_dir = join(config.build_prefix, bin_dirname)
57     if not isdir(bin_dir):
58         os.mkdir(bin_dir)
59     for cmd, module, func in iter_entry_points(items):
60         create_entry_point(join(bin_dir, cmd), module, func)
61 
62 
63 def prepend_bin_path(env, prefix, prepend_prefix=False):
64     env['PATH'] = join(prefix, bin_dirname) + os.pathsep + env['PATH']
65     if sys.platform == "win32":
66         env['PATH'] = join(prefix, "Library", "bin") + os.pathsep + env['PATH']
67     if prepend_prefix:
68         env['PATH'] = prefix + os.pathsep + env['PATH']
69     return env
70
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conda_build/scripts.py b/conda_build/scripts.py
--- a/conda_build/scripts.py
+++ b/conda_build/scripts.py
@@ -18,14 +18,14 @@
 PY_TMPL = """\
 if __name__ == '__main__':
     import sys
-    from %s import %s
+    import %(module)s
 
-    sys.exit(%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*$')
+entry_pat = re.compile('\s*([\w\-\.]+)\s*=\s*([\w.]+):([\w.]+)\s*$')
 
 
 def iter_entry_points(items):
@@ -37,7 +37,7 @@
 
 
 def create_entry_point(path, module, func):
-    pyscript = PY_TMPL % (module, func, func)
+    pyscript = PY_TMPL % {'module': module, 'func': func}
     if sys.platform == 'win32':
         with open(path + '-script.py', 'w') as fo:
             fo.write(pyscript)

{"golden_diff": "diff --git a/conda_build/scripts.py b/conda_build/scripts.py\n--- a/conda_build/scripts.py\n+++ b/conda_build/scripts.py\n@@ -18,14 +18,14 @@\n PY_TMPL = \"\"\"\\\n if __name__ == '__main__':\n     import sys\n-    from %s import %s\n+    import %(module)s\n \n-    sys.exit(%s())\n+    sys.exit(%(module)s.%(func)s())\n \"\"\"\n \n bin_dirname = 'Scripts' if sys.platform == 'win32' else 'bin'\n \n-entry_pat = re.compile('\\s*([\\w\\-\\.]+)\\s*=\\s*([\\w.]+):(\\w+)\\s*$')\n+entry_pat = re.compile('\\s*([\\w\\-\\.]+)\\s*=\\s*([\\w.]+):([\\w.]+)\\s*$')\n \n \n def iter_entry_points(items):\n@@ -37,7 +37,7 @@\n \n \n def create_entry_point(path, module, func):\n-    pyscript = PY_TMPL % (module, func, func)\n+    pyscript = PY_TMPL % {'module': module, 'func': func}\n     if sys.platform == 'win32':\n         with open(path + '-script.py', 'w') as fo:\n             fo.write(pyscript)\n", "issue": "Entry point pattern doesn't match entrypoints:with.dots\nHi,\n\nCould you please have a look to this. I define entry point as\n\n``` python\nentry_points={\n    'console_scripts': [\n        'poultry = poultry.main:dispatcher.dispatch',\n    ],\n},\n```\n\nhttps://github.com/dimazest/poultry/blob/e0f39277f0a219a4d3cd461b69ce5dd4422fc9dd/setup.py#L62\n\nwhich entry point pattern at  https://github.com/conda/conda-build/blob/master/conda_build/scripts.py#L27 doesn't match.\n\nThanks.\n\n", "before_files": [{"content": "'''\nModule for creating entry points and scripts for PyPI packages.\n'''\n\nfrom __future__ import absolute_import, division, print_function\n\nimport re\nimport os\nimport sys\nimport shutil\nfrom os.path import dirname, isdir, join\n\nimport conda.config as cc\n\nfrom conda_build.config import config\n\n\nPY_TMPL = \"\"\"\\\nif __name__ == '__main__':\n    import sys\n    from %s import %s\n\n    sys.exit(%s())\n\"\"\"\n\nbin_dirname = 'Scripts' if sys.platform == 'win32' else 'bin'\n\nentry_pat = re.compile('\\s*([\\w\\-\\.]+)\\s*=\\s*([\\w.]+):(\\w+)\\s*$')\n\n\ndef iter_entry_points(items):\n    for item in items:\n        m = entry_pat.match(item)\n        if m is None:\n            sys.exit(\"Error cound not match entry point: %r\" % item)\n        yield m.groups()\n\n\ndef create_entry_point(path, module, func):\n    pyscript = PY_TMPL % (module, func, func)\n    if sys.platform == 'win32':\n        with open(path + '-script.py', 'w') as fo:\n            fo.write(pyscript)\n        shutil.copyfile(join(dirname(__file__), 'cli-%d.exe' % cc.bits),\n                        path + '.exe')\n    else:\n        with open(path, 'w') as fo:\n            fo.write('#!%s\\n' % config.build_python)\n            fo.write(pyscript)\n        os.chmod(path, int('755', 8))\n\n\ndef create_entry_points(items):\n    if not items:\n        return\n    bin_dir = join(config.build_prefix, bin_dirname)\n    if not isdir(bin_dir):\n        os.mkdir(bin_dir)\n    for cmd, module, func in iter_entry_points(items):\n        create_entry_point(join(bin_dir, cmd), module, func)\n\n\ndef prepend_bin_path(env, prefix, prepend_prefix=False):\n    env['PATH'] = join(prefix, bin_dirname) + os.pathsep + env['PATH']\n    if sys.platform == \"win32\":\n        env['PATH'] = join(prefix, \"Library\", \"bin\") + os.pathsep + env['PATH']\n    if prepend_prefix:\n        env['PATH'] = prefix + os.pathsep + env['PATH']\n    return env\n", "path": "conda_build/scripts.py"}], "after_files": [{"content": "'''\nModule for creating entry points and scripts for PyPI packages.\n'''\n\nfrom __future__ import absolute_import, division, print_function\n\nimport re\nimport os\nimport sys\nimport shutil\nfrom os.path import dirname, isdir, join\n\nimport conda.config as cc\n\nfrom conda_build.config import config\n\n\nPY_TMPL = \"\"\"\\\nif __name__ == '__main__':\n    import sys\n    import %(module)s\n\n    sys.exit(%(module)s.%(func)s())\n\"\"\"\n\nbin_dirname = 'Scripts' if sys.platform == 'win32' else 'bin'\n\nentry_pat = re.compile('\\s*([\\w\\-\\.]+)\\s*=\\s*([\\w.]+):([\\w.]+)\\s*$')\n\n\ndef iter_entry_points(items):\n    for item in items:\n        m = entry_pat.match(item)\n        if m is None:\n            sys.exit(\"Error cound not match entry point: %r\" % item)\n        yield m.groups()\n\n\ndef create_entry_point(path, module, func):\n    pyscript = PY_TMPL % {'module': module, 'func': func}\n    if sys.platform == 'win32':\n        with open(path + '-script.py', 'w') as fo:\n            fo.write(pyscript)\n        shutil.copyfile(join(dirname(__file__), 'cli-%d.exe' % cc.bits),\n                        path + '.exe')\n    else:\n        with open(path, 'w') as fo:\n            fo.write('#!%s\\n' % config.build_python)\n            fo.write(pyscript)\n        os.chmod(path, int('755', 8))\n\n\ndef create_entry_points(items):\n    if not items:\n        return\n    bin_dir = join(config.build_prefix, bin_dirname)\n    if not isdir(bin_dir):\n        os.mkdir(bin_dir)\n    for cmd, module, func in iter_entry_points(items):\n        create_entry_point(join(bin_dir, cmd), module, func)\n\n\ndef prepend_bin_path(env, prefix, prepend_prefix=False):\n    env['PATH'] = join(prefix, bin_dirname) + os.pathsep + env['PATH']\n    if sys.platform == \"win32\":\n        env['PATH'] = join(prefix, \"Library\", \"bin\") + os.pathsep + env['PATH']\n    if prepend_prefix:\n        env['PATH'] = prefix + os.pathsep + env['PATH']\n    return env\n", "path": "conda_build/scripts.py"}]}