prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Pip Installing PTVSD fails 
  * Python2.7
  * Pip install ptvsd from local source fails with the following error:
  ```
  running build_ext
      building 'ptvsd.pydevd._pydevd_bundle.pydevd_cython' extension
      error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
  ```
  
  </issue>
  <code>
  [start of setup.py]
  1 #!/usr/bin/env python
  2 
  3 # Copyright (c) Microsoft Corporation. All rights reserved.
  4 # Licensed under the MIT License. See LICENSE in the project root
  5 # for license information.
  6 
  7 import os
  8 import os.path
  9 from setuptools import setup, Extension
  10 
  11 ROOT = os.path.dirname(os.path.abspath(__file__))
  12 
  13 # Add pydevd files as data files for this package. They are not treated as a package of their own,
  14 # because we don't actually want to provide pydevd - just use our own copy internally.
  15 def get_pydevd_package_data():
  16     ptvsd_prefix = os.path.join(ROOT, 'ptvsd')
  17     pydevd_prefix = os.path.join(ptvsd_prefix, 'pydevd')
  18     for root, dirs, files in os.walk(pydevd_prefix):
  19         # From the root of pydevd repo, we want only scripts and subdirectories that
  20         # constitute the package itself (not helper scripts, tests etc). But when
  21         # walking down into those subdirectories, we want everything below.
  22         if os.path.normcase(root) == os.path.normcase(pydevd_prefix):
  23             dirs[:] = [d for d in dirs if d.startswith('pydev') or d.startswith('_pydev')]
  24             files[:] = [f for f in files if f.endswith('.py') and 'pydev' in f]
  25         for f in files:
  26             yield os.path.join(root[len(ptvsd_prefix) + 1:], f)
  27 
  28 setup(name='ptvsd',
  29       version='4.0.0a1',
  30       description='Visual Studio remote debugging server for Python',
  31       license='MIT',
  32       author='Microsoft Corporation',
  33       author_email='ptvshelp@microsoft.com',
  34       url='https://aka.ms/ptvs',
  35       classifiers=[
  36         'Development Status :: 3 - Alpha',
  37         'Programming Language :: Python',
  38         'Programming Language :: Python :: 2',
  39         'Programming Language :: Python :: 3',
  40         'License :: OSI Approved :: MIT License'],
  41       packages=['ptvsd'],
  42       package_data={'ptvsd': list(get_pydevd_package_data()) + ['ThirdPartyNotices.txt']},
  43       ext_modules=[Extension('ptvsd.pydevd._pydevd_bundle.pydevd_cython',
  44                              ['ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c'],
  45                              optional=True)],
  46       )
  47
  [end of setup.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -6,6 +6,7 @@
   
   import os
   import os.path
  +import sys
   from setuptools import setup, Extension
   
   ROOT = os.path.dirname(os.path.abspath(__file__))
  @@ -25,6 +26,18 @@
           for f in files:
               yield os.path.join(root[len(ptvsd_prefix) + 1:], f)
   
  +cmdclass = {}
  +
  +if sys.version_info[0] == 2:
  +    from setuptools.command.build_ext import build_ext
  +    class build_optional_ext(build_ext):
  +        def build_extension(self, ext):
  +            try:
  +                super(build_optional_ext, self).build_extension(ext)
  +            except:
  +                pass
  +    cmdclass = { 'build_ext': build_optional_ext }
  +
   setup(name='ptvsd',
         version='4.0.0a1',
         description='Visual Studio remote debugging server for Python',
  @@ -43,4 +56,5 @@
         ext_modules=[Extension('ptvsd.pydevd._pydevd_bundle.pydevd_cython',
                                ['ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c'],
                                optional=True)],
  +      cmdclass=cmdclass,
         )
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -6,6 +6,7 @@\n \n import os\n import os.path\n+import sys\n from setuptools import setup, Extension\n \n ROOT = os.path.dirname(os.path.abspath(__file__))\n@@ -25,6 +26,18 @@\n         for f in files:\n             yield os.path.join(root[len(ptvsd_prefix) + 1:], f)\n \n+cmdclass = {}\n+\n+if sys.version_info[0] == 2:\n+    from setuptools.command.build_ext import build_ext\n+    class build_optional_ext(build_ext):\n+        def build_extension(self, ext):\n+            try:\n+                super(build_optional_ext, self).build_extension(ext)\n+            except:\n+                pass\n+    cmdclass = { 'build_ext': build_optional_ext }\n+\n setup(name='ptvsd',\n       version='4.0.0a1',\n       description='Visual Studio remote debugging server for Python',\n@@ -43,4 +56,5 @@\n       ext_modules=[Extension('ptvsd.pydevd._pydevd_bundle.pydevd_cython',\n                              ['ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c'],\n                              optional=True)],\n+      cmdclass=cmdclass,\n       )\n", "issue": "Pip Installing PTVSD fails \n* Python2.7\r\n* Pip install ptvsd from local source fails with the following error:\r\n```\r\nrunning build_ext\r\n    building 'ptvsd.pydevd._pydevd_bundle.pydevd_cython' extension\r\n    error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nimport os\nimport os.path\nfrom setuptools import setup, Extension\n\nROOT = os.path.dirname(os.path.abspath(__file__))\n\n# Add pydevd files as data files for this package. They are not treated as a package of their own,\n# because we don't actually want to provide pydevd - just use our own copy internally.\ndef get_pydevd_package_data():\n    ptvsd_prefix = os.path.join(ROOT, 'ptvsd')\n    pydevd_prefix = os.path.join(ptvsd_prefix, 'pydevd')\n    for root, dirs, files in os.walk(pydevd_prefix):\n        # From the root of pydevd repo, we want only scripts and subdirectories that\n        # constitute the package itself (not helper scripts, tests etc). But when\n        # walking down into those subdirectories, we want everything below.\n        if os.path.normcase(root) == os.path.normcase(pydevd_prefix):\n            dirs[:] = [d for d in dirs if d.startswith('pydev') or d.startswith('_pydev')]\n            files[:] = [f for f in files if f.endswith('.py') and 'pydev' in f]\n        for f in files:\n            yield os.path.join(root[len(ptvsd_prefix) + 1:], f)\n\nsetup(name='ptvsd',\n      version='4.0.0a1',\n      description='Visual Studio remote debugging server for Python',\n      license='MIT',\n      author='Microsoft Corporation',\n      author_email='ptvshelp@microsoft.com',\n      url='https://aka.ms/ptvs',\n      classifiers=[\n        'Development Status :: 3 - Alpha',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 3',\n        'License :: OSI Approved :: MIT License'],\n      packages=['ptvsd'],\n      package_data={'ptvsd': list(get_pydevd_package_data()) + ['ThirdPartyNotices.txt']},\n      ext_modules=[Extension('ptvsd.pydevd._pydevd_bundle.pydevd_cython',\n                             ['ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c'],\n                             optional=True)],\n      )\n", "path": "setup.py"}]}