We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
AppVeyor: Commit message with braces -> failed build
https://ci.appveyor.com/project/mpi4py/mpi4py/build/2.0.0a0-13/job/0q0w2g5o32qk3m94#L522

PS: I got a warning about conda-build being outdated. Isn't `conda update --all` supposed to update it? Maybe conflicting versions with dependencies?


--- 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/windows.py`
Content:
```
1 from __future__ import absolute_import, division, print_function
2 
3 import os
4 import sys
5 import shutil
6 from os.path import dirname, isdir, isfile, join, exists
7 
8 import conda.config as cc
9 from conda.compat import iteritems
10 
11 from conda_build.config import config
12 from conda_build import environ
13 from conda_build import source
14 from conda_build.utils import _check_call
15 
16 try:
17     import psutil
18 except ImportError:
19     psutil = None
20 
21 assert sys.platform == 'win32'
22 
23 
24 def fix_staged_scripts():
25     """
26     Fixes scripts which have been installed unix-style to have a .bat
27     helper
28     """
29     scripts_dir = join(config.build_prefix, 'Scripts')
30     if not isdir(scripts_dir):
31         return
32     for fn in os.listdir(scripts_dir):
33         # process all the extensionless files
34         if not isfile(join(scripts_dir, fn)) or '.' in fn:
35             continue
36 
37         with open(join(scripts_dir, fn)) as f:
38             line = f.readline().lower()
39             # If it's a #!python script
40             if not (line.startswith('#!') and 'python' in line.lower()):
41                 continue
42             print('Adjusting unix-style #! script %s, '
43                   'and adding a .bat file for it' % fn)
44             # copy it with a .py extension (skipping that first #! line)
45             with open(join(scripts_dir, fn + '-script.py'), 'w') as fo:
46                 fo.write(f.read())
47             # now create the .exe file
48             shutil.copyfile(join(dirname(__file__),
49                                  'cli-%d.exe' % (8 * tuple.__itemsize__)),
50                             join(scripts_dir, fn + '.exe'))
51 
52         # remove the original script
53         os.remove(join(scripts_dir, fn))
54 
55 
56 def msvc_env_cmd():
57     if 'ProgramFiles(x86)' in os.environ:
58         program_files = os.environ['ProgramFiles(x86)']
59     else:
60         program_files = os.environ['ProgramFiles']
61 
62     localappdata = os.environ.get("localappdata")
63 
64     if config.PY3K:
65         vcvarsall = os.path.join(program_files,
66                                  r'Microsoft Visual Studio 10.0'
67                                  r'\VC\vcvarsall.bat')
68     else:
69         vcvarsall = os.path.join(program_files,
70                                  r'Microsoft Visual Studio 9.0'
71                                  r'\VC\vcvarsall.bat')
72 
73     # Try the Microsoft Visual C++ Compiler for Python 2.7
74     if not isfile(vcvarsall) and localappdata and not config.PY3K:
75         vcvarsall = os.path.join(localappdata, "Programs", "Common",
76             "Microsoft", "Visual C++ for Python", "9.0", "vcvarsall.bat")
77     if not isfile(vcvarsall) and program_files and not config.PY3K:
78         vcvarsall = os.path.join(program_files, 'Common Files',
79             'Microsoft', 'Visual C++ for Python', "9.0", "vcvarsall.bat")
80     if not isfile(vcvarsall):
81         print("Warning: Couldn't find Visual Studio: %r" % vcvarsall)
82         return ''
83 
84     return '''\
85 call "%s" %s
86 ''' % (vcvarsall, {32: 'x86', 64: 'amd64'}[cc.bits])
87 
88 
89 def kill_processes():
90     if psutil is None:
91         return
92     for n in psutil.get_pid_list():
93         try:
94             p = psutil.Process(n)
95             if p.name.lower() == 'msbuild.exe':
96                 print('Terminating:', p.name)
97                 p.terminate()
98         except:
99             continue
100 
101 
102 def build(m):
103     env = dict(os.environ)
104     env.update(environ.get_dict(m))
105 
106     for name in 'BIN', 'INC', 'LIB':
107         path = env['LIBRARY_' + name]
108         if not isdir(path):
109             os.makedirs(path)
110 
111     src_dir = source.get_dir()
112     bld_bat = join(m.path, 'bld.bat')
113     if exists(bld_bat):
114         with open(bld_bat) as fi:
115             data = fi.read()
116         with open(join(src_dir, 'bld.bat'), 'w') as fo:
117             fo.write(msvc_env_cmd())
118             for kv in iteritems(env):
119                 fo.write('set %s=%s\n' % kv)
120             # more debuggable with echo on
121             fo.write('@echo on\n')
122             fo.write("REM ===== end generated header =====\n")
123             fo.write(data)
124 
125         cmd = [os.environ['COMSPEC'], '/c', 'call', 'bld.bat']
126         _check_call(cmd, cwd=src_dir)
127         kill_processes()
128         fix_staged_scripts()
129
```
--- 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/windows.py b/conda_build/windows.py
--- a/conda_build/windows.py
+++ b/conda_build/windows.py
@@ -116,7 +116,7 @@
         with open(join(src_dir, 'bld.bat'), 'w') as fo:
             fo.write(msvc_env_cmd())
             for kv in iteritems(env):
-                fo.write('set %s=%s\n' % kv)
+                fo.write('set "%s=%s"\n' % kv)
             # more debuggable with echo on
             fo.write('@echo on\n')
             fo.write("REM ===== end generated header =====\n")

{"golden_diff": "diff --git a/conda_build/windows.py b/conda_build/windows.py\n--- a/conda_build/windows.py\n+++ b/conda_build/windows.py\n@@ -116,7 +116,7 @@\n         with open(join(src_dir, 'bld.bat'), 'w') as fo:\n             fo.write(msvc_env_cmd())\n             for kv in iteritems(env):\n-                fo.write('set %s=%s\\n' % kv)\n+                fo.write('set \"%s=%s\"\\n' % kv)\n             # more debuggable with echo on\n             fo.write('@echo on\\n')\n             fo.write(\"REM ===== end generated header =====\\n\")\n", "issue": "AppVeyor: Commit message with braces -> failed build\nhttps://ci.appveyor.com/project/mpi4py/mpi4py/build/2.0.0a0-13/job/0q0w2g5o32qk3m94#L522\n\nPS: I got a warning about conda-build being outdated. Isn't `conda update --all` supposed to update it? Maybe conflicting versions with dependencies?\n\n", "before_files": [{"content": "from __future__ import absolute_import, division, print_function\n\nimport os\nimport sys\nimport shutil\nfrom os.path import dirname, isdir, isfile, join, exists\n\nimport conda.config as cc\nfrom conda.compat import iteritems\n\nfrom conda_build.config import config\nfrom conda_build import environ\nfrom conda_build import source\nfrom conda_build.utils import _check_call\n\ntry:\n    import psutil\nexcept ImportError:\n    psutil = None\n\nassert sys.platform == 'win32'\n\n\ndef fix_staged_scripts():\n    \"\"\"\n    Fixes scripts which have been installed unix-style to have a .bat\n    helper\n    \"\"\"\n    scripts_dir = join(config.build_prefix, 'Scripts')\n    if not isdir(scripts_dir):\n        return\n    for fn in os.listdir(scripts_dir):\n        # process all the extensionless files\n        if not isfile(join(scripts_dir, fn)) or '.' in fn:\n            continue\n\n        with open(join(scripts_dir, fn)) as f:\n            line = f.readline().lower()\n            # If it's a #!python script\n            if not (line.startswith('#!') and 'python' in line.lower()):\n                continue\n            print('Adjusting unix-style #! script %s, '\n                  'and adding a .bat file for it' % fn)\n            # copy it with a .py extension (skipping that first #! line)\n            with open(join(scripts_dir, fn + '-script.py'), 'w') as fo:\n                fo.write(f.read())\n            # now create the .exe file\n            shutil.copyfile(join(dirname(__file__),\n                                 'cli-%d.exe' % (8 * tuple.__itemsize__)),\n                            join(scripts_dir, fn + '.exe'))\n\n        # remove the original script\n        os.remove(join(scripts_dir, fn))\n\n\ndef msvc_env_cmd():\n    if 'ProgramFiles(x86)' in os.environ:\n        program_files = os.environ['ProgramFiles(x86)']\n    else:\n        program_files = os.environ['ProgramFiles']\n\n    localappdata = os.environ.get(\"localappdata\")\n\n    if config.PY3K:\n        vcvarsall = os.path.join(program_files,\n                                 r'Microsoft Visual Studio 10.0'\n                                 r'\\VC\\vcvarsall.bat')\n    else:\n        vcvarsall = os.path.join(program_files,\n                                 r'Microsoft Visual Studio 9.0'\n                                 r'\\VC\\vcvarsall.bat')\n\n    # Try the Microsoft Visual C++ Compiler for Python 2.7\n    if not isfile(vcvarsall) and localappdata and not config.PY3K:\n        vcvarsall = os.path.join(localappdata, \"Programs\", \"Common\",\n            \"Microsoft\", \"Visual C++ for Python\", \"9.0\", \"vcvarsall.bat\")\n    if not isfile(vcvarsall) and program_files and not config.PY3K:\n        vcvarsall = os.path.join(program_files, 'Common Files',\n            'Microsoft', 'Visual C++ for Python', \"9.0\", \"vcvarsall.bat\")\n    if not isfile(vcvarsall):\n        print(\"Warning: Couldn't find Visual Studio: %r\" % vcvarsall)\n        return ''\n\n    return '''\\\ncall \"%s\" %s\n''' % (vcvarsall, {32: 'x86', 64: 'amd64'}[cc.bits])\n\n\ndef kill_processes():\n    if psutil is None:\n        return\n    for n in psutil.get_pid_list():\n        try:\n            p = psutil.Process(n)\n            if p.name.lower() == 'msbuild.exe':\n                print('Terminating:', p.name)\n                p.terminate()\n        except:\n            continue\n\n\ndef build(m):\n    env = dict(os.environ)\n    env.update(environ.get_dict(m))\n\n    for name in 'BIN', 'INC', 'LIB':\n        path = env['LIBRARY_' + name]\n        if not isdir(path):\n            os.makedirs(path)\n\n    src_dir = source.get_dir()\n    bld_bat = join(m.path, 'bld.bat')\n    if exists(bld_bat):\n        with open(bld_bat) as fi:\n            data = fi.read()\n        with open(join(src_dir, 'bld.bat'), 'w') as fo:\n            fo.write(msvc_env_cmd())\n            for kv in iteritems(env):\n                fo.write('set %s=%s\\n' % kv)\n            # more debuggable with echo on\n            fo.write('@echo on\\n')\n            fo.write(\"REM ===== end generated header =====\\n\")\n            fo.write(data)\n\n        cmd = [os.environ['COMSPEC'], '/c', 'call', 'bld.bat']\n        _check_call(cmd, cwd=src_dir)\n        kill_processes()\n        fix_staged_scripts()\n", "path": "conda_build/windows.py"}], "after_files": [{"content": "from __future__ import absolute_import, division, print_function\n\nimport os\nimport sys\nimport shutil\nfrom os.path import dirname, isdir, isfile, join, exists\n\nimport conda.config as cc\nfrom conda.compat import iteritems\n\nfrom conda_build.config import config\nfrom conda_build import environ\nfrom conda_build import source\nfrom conda_build.utils import _check_call\n\ntry:\n    import psutil\nexcept ImportError:\n    psutil = None\n\nassert sys.platform == 'win32'\n\n\ndef fix_staged_scripts():\n    \"\"\"\n    Fixes scripts which have been installed unix-style to have a .bat\n    helper\n    \"\"\"\n    scripts_dir = join(config.build_prefix, 'Scripts')\n    if not isdir(scripts_dir):\n        return\n    for fn in os.listdir(scripts_dir):\n        # process all the extensionless files\n        if not isfile(join(scripts_dir, fn)) or '.' in fn:\n            continue\n\n        with open(join(scripts_dir, fn)) as f:\n            line = f.readline().lower()\n            # If it's a #!python script\n            if not (line.startswith('#!') and 'python' in line.lower()):\n                continue\n            print('Adjusting unix-style #! script %s, '\n                  'and adding a .bat file for it' % fn)\n            # copy it with a .py extension (skipping that first #! line)\n            with open(join(scripts_dir, fn + '-script.py'), 'w') as fo:\n                fo.write(f.read())\n            # now create the .exe file\n            shutil.copyfile(join(dirname(__file__),\n                                 'cli-%d.exe' % (8 * tuple.__itemsize__)),\n                            join(scripts_dir, fn + '.exe'))\n\n        # remove the original script\n        os.remove(join(scripts_dir, fn))\n\n\ndef msvc_env_cmd():\n    if 'ProgramFiles(x86)' in os.environ:\n        program_files = os.environ['ProgramFiles(x86)']\n    else:\n        program_files = os.environ['ProgramFiles']\n\n    localappdata = os.environ.get(\"localappdata\")\n\n    if config.PY3K:\n        vcvarsall = os.path.join(program_files,\n                                 r'Microsoft Visual Studio 10.0'\n                                 r'\\VC\\vcvarsall.bat')\n    else:\n        vcvarsall = os.path.join(program_files,\n                                 r'Microsoft Visual Studio 9.0'\n                                 r'\\VC\\vcvarsall.bat')\n\n    # Try the Microsoft Visual C++ Compiler for Python 2.7\n    if not isfile(vcvarsall) and localappdata and not config.PY3K:\n        vcvarsall = os.path.join(localappdata, \"Programs\", \"Common\",\n            \"Microsoft\", \"Visual C++ for Python\", \"9.0\", \"vcvarsall.bat\")\n    if not isfile(vcvarsall) and program_files and not config.PY3K:\n        vcvarsall = os.path.join(program_files, 'Common Files',\n            'Microsoft', 'Visual C++ for Python', \"9.0\", \"vcvarsall.bat\")\n    if not isfile(vcvarsall):\n        print(\"Warning: Couldn't find Visual Studio: %r\" % vcvarsall)\n        return ''\n\n    return '''\\\ncall \"%s\" %s\n''' % (vcvarsall, {32: 'x86', 64: 'amd64'}[cc.bits])\n\n\ndef kill_processes():\n    if psutil is None:\n        return\n    for n in psutil.get_pid_list():\n        try:\n            p = psutil.Process(n)\n            if p.name.lower() == 'msbuild.exe':\n                print('Terminating:', p.name)\n                p.terminate()\n        except:\n            continue\n\n\ndef build(m):\n    env = dict(os.environ)\n    env.update(environ.get_dict(m))\n\n    for name in 'BIN', 'INC', 'LIB':\n        path = env['LIBRARY_' + name]\n        if not isdir(path):\n            os.makedirs(path)\n\n    src_dir = source.get_dir()\n    bld_bat = join(m.path, 'bld.bat')\n    if exists(bld_bat):\n        with open(bld_bat) as fi:\n            data = fi.read()\n        with open(join(src_dir, 'bld.bat'), 'w') as fo:\n            fo.write(msvc_env_cmd())\n            for kv in iteritems(env):\n                fo.write('set \"%s=%s\"\\n' % kv)\n            # more debuggable with echo on\n            fo.write('@echo on\\n')\n            fo.write(\"REM ===== end generated header =====\\n\")\n            fo.write(data)\n\n        cmd = [os.environ['COMSPEC'], '/c', 'call', 'bld.bat']\n        _check_call(cmd, cwd=src_dir)\n        kill_processes()\n        fix_staged_scripts()\n", "path": "conda_build/windows.py"}]}