prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Remove pkg_resources.build_zipmanifest monkeypatching
  This may involve increasing the minimum setuptools version.  Another alternative is vendoring setuptools.
  
  
  </issue>
  <code>
  [start of pex/version.py]
  1 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
  2 # Licensed under the Apache License, Version 2.0 (see LICENSE).
  3 
  4 __version__ = '1.1.15'
  5 
  6 SETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<20.11'
  7 WHEEL_REQUIREMENT = 'wheel>=0.26.0,<0.30.0'
  8
  [end of pex/version.py]
  [start of pex/pex_bootstrapper.py]
  1 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
  2 # Licensed under the Apache License, Version 2.0 (see LICENSE).
  3 
  4 import contextlib
  5 import os
  6 import sys
  7 import zipfile
  8 
  9 __all__ = ('bootstrap_pex',)
  10 
  11 
  12 def pex_info_name(entry_point):
  13   """Return the PEX-INFO for an entry_point"""
  14   return os.path.join(entry_point, 'PEX-INFO')
  15 
  16 
  17 def is_compressed(entry_point):
  18   return os.path.exists(entry_point) and not os.path.exists(pex_info_name(entry_point))
  19 
  20 
  21 def read_pexinfo_from_directory(entry_point):
  22   with open(pex_info_name(entry_point), 'rb') as fp:
  23     return fp.read()
  24 
  25 
  26 def read_pexinfo_from_zip(entry_point):
  27   with contextlib.closing(zipfile.ZipFile(entry_point)) as zf:
  28     return zf.read('PEX-INFO')
  29 
  30 
  31 def read_pex_info_content(entry_point):
  32   """Return the raw content of a PEX-INFO."""
  33   if is_compressed(entry_point):
  34     return read_pexinfo_from_zip(entry_point)
  35   else:
  36     return read_pexinfo_from_directory(entry_point)
  37 
  38 
  39 def get_pex_info(entry_point):
  40   """Return the PexInfo object for an entry point."""
  41   from . import pex_info
  42 
  43   pex_info_content = read_pex_info_content(entry_point)
  44   if pex_info_content:
  45     return pex_info.PexInfo.from_json(pex_info_content)
  46   raise ValueError('Invalid entry_point: %s' % entry_point)
  47 
  48 
  49 # TODO(wickman) Remove once resolved (#91):
  50 #   https://bitbucket.org/pypa/setuptools/issue/154/build_zipmanifest-results-should-be
  51 def monkeypatch_build_zipmanifest():
  52   import pkg_resources
  53   if not hasattr(pkg_resources, 'build_zipmanifest'):
  54     return
  55   old_build_zipmanifest = pkg_resources.build_zipmanifest
  56   def memoized_build_zipmanifest(archive, memo={}):
  57     if archive not in memo:
  58       memo[archive] = old_build_zipmanifest(archive)
  59     return memo[archive]
  60   pkg_resources.build_zipmanifest = memoized_build_zipmanifest
  61 
  62 
  63 def find_in_path(target_interpreter):
  64   if os.path.exists(target_interpreter):
  65     return target_interpreter
  66 
  67   for directory in os.getenv('PATH', '').split(os.pathsep):
  68     try_path = os.path.join(directory, target_interpreter)
  69     if os.path.exists(try_path):
  70       return try_path
  71 
  72 
  73 def maybe_reexec_pex():
  74   from .variables import ENV
  75   if not ENV.PEX_PYTHON:
  76     return
  77 
  78   from .common import die
  79   from .tracer import TRACER
  80 
  81   target_python = ENV.PEX_PYTHON
  82   target = find_in_path(target_python)
  83   if not target:
  84     die('Failed to find interpreter specified by PEX_PYTHON: %s' % target)
  85   if os.path.exists(target) and os.path.realpath(target) != os.path.realpath(sys.executable):
  86     TRACER.log('Detected PEX_PYTHON, re-exec to %s' % target)
  87     ENV.delete('PEX_PYTHON')
  88     os.execve(target, [target_python] + sys.argv, ENV.copy())
  89 
  90 
  91 def bootstrap_pex(entry_point):
  92   from .finders import register_finders
  93   monkeypatch_build_zipmanifest()
  94   register_finders()
  95   maybe_reexec_pex()
  96 
  97   from . import pex
  98   pex.PEX(entry_point).execute()
  99 
  100 
  101 def bootstrap_pex_env(entry_point):
  102   """Bootstrap the current runtime environment using a given pex."""
  103   from .environment import PEXEnvironment
  104   from .finders import register_finders
  105   from .pex_info import PexInfo
  106 
  107   monkeypatch_build_zipmanifest()
  108   register_finders()
  109 
  110   PEXEnvironment(entry_point, PexInfo.from_pex(entry_point)).activate()
  111
  [end of pex/pex_bootstrapper.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/pex/pex_bootstrapper.py b/pex/pex_bootstrapper.py
  --- a/pex/pex_bootstrapper.py
  +++ b/pex/pex_bootstrapper.py
  @@ -46,20 +46,6 @@
     raise ValueError('Invalid entry_point: %s' % entry_point)
   
   
  -# TODO(wickman) Remove once resolved (#91):
  -#   https://bitbucket.org/pypa/setuptools/issue/154/build_zipmanifest-results-should-be
  -def monkeypatch_build_zipmanifest():
  -  import pkg_resources
  -  if not hasattr(pkg_resources, 'build_zipmanifest'):
  -    return
  -  old_build_zipmanifest = pkg_resources.build_zipmanifest
  -  def memoized_build_zipmanifest(archive, memo={}):
  -    if archive not in memo:
  -      memo[archive] = old_build_zipmanifest(archive)
  -    return memo[archive]
  -  pkg_resources.build_zipmanifest = memoized_build_zipmanifest
  -
  -
   def find_in_path(target_interpreter):
     if os.path.exists(target_interpreter):
       return target_interpreter
  @@ -90,7 +76,6 @@
   
   def bootstrap_pex(entry_point):
     from .finders import register_finders
  -  monkeypatch_build_zipmanifest()
     register_finders()
     maybe_reexec_pex()
   
  @@ -104,7 +89,6 @@
     from .finders import register_finders
     from .pex_info import PexInfo
   
  -  monkeypatch_build_zipmanifest()
     register_finders()
   
     PEXEnvironment(entry_point, PexInfo.from_pex(entry_point)).activate()
  diff --git a/pex/version.py b/pex/version.py
  --- a/pex/version.py
  +++ b/pex/version.py
  @@ -3,5 +3,5 @@
   
   __version__ = '1.1.15'
   
  -SETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<20.11'
  +SETUPTOOLS_REQUIREMENT = 'setuptools>=5.7,<20.11'
   WHEEL_REQUIREMENT = 'wheel>=0.26.0,<0.30.0'
  
verification_info: {"golden_diff": "diff --git a/pex/pex_bootstrapper.py b/pex/pex_bootstrapper.py\n--- a/pex/pex_bootstrapper.py\n+++ b/pex/pex_bootstrapper.py\n@@ -46,20 +46,6 @@\n   raise ValueError('Invalid entry_point: %s' % entry_point)\n \n \n-# TODO(wickman) Remove once resolved (#91):\n-#   https://bitbucket.org/pypa/setuptools/issue/154/build_zipmanifest-results-should-be\n-def monkeypatch_build_zipmanifest():\n-  import pkg_resources\n-  if not hasattr(pkg_resources, 'build_zipmanifest'):\n-    return\n-  old_build_zipmanifest = pkg_resources.build_zipmanifest\n-  def memoized_build_zipmanifest(archive, memo={}):\n-    if archive not in memo:\n-      memo[archive] = old_build_zipmanifest(archive)\n-    return memo[archive]\n-  pkg_resources.build_zipmanifest = memoized_build_zipmanifest\n-\n-\n def find_in_path(target_interpreter):\n   if os.path.exists(target_interpreter):\n     return target_interpreter\n@@ -90,7 +76,6 @@\n \n def bootstrap_pex(entry_point):\n   from .finders import register_finders\n-  monkeypatch_build_zipmanifest()\n   register_finders()\n   maybe_reexec_pex()\n \n@@ -104,7 +89,6 @@\n   from .finders import register_finders\n   from .pex_info import PexInfo\n \n-  monkeypatch_build_zipmanifest()\n   register_finders()\n \n   PEXEnvironment(entry_point, PexInfo.from_pex(entry_point)).activate()\ndiff --git a/pex/version.py b/pex/version.py\n--- a/pex/version.py\n+++ b/pex/version.py\n@@ -3,5 +3,5 @@\n \n __version__ = '1.1.15'\n \n-SETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<20.11'\n+SETUPTOOLS_REQUIREMENT = 'setuptools>=5.7,<20.11'\n WHEEL_REQUIREMENT = 'wheel>=0.26.0,<0.30.0'\n", "issue": "Remove pkg_resources.build_zipmanifest monkeypatching\nThis may involve increasing the minimum setuptools version.  Another alternative is vendoring setuptools.\n\n", "before_files": [{"content": "# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\n__version__ = '1.1.15'\n\nSETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<20.11'\nWHEEL_REQUIREMENT = 'wheel>=0.26.0,<0.30.0'\n", "path": "pex/version.py"}, {"content": "# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nimport contextlib\nimport os\nimport sys\nimport zipfile\n\n__all__ = ('bootstrap_pex',)\n\n\ndef pex_info_name(entry_point):\n  \"\"\"Return the PEX-INFO for an entry_point\"\"\"\n  return os.path.join(entry_point, 'PEX-INFO')\n\n\ndef is_compressed(entry_point):\n  return os.path.exists(entry_point) and not os.path.exists(pex_info_name(entry_point))\n\n\ndef read_pexinfo_from_directory(entry_point):\n  with open(pex_info_name(entry_point), 'rb') as fp:\n    return fp.read()\n\n\ndef read_pexinfo_from_zip(entry_point):\n  with contextlib.closing(zipfile.ZipFile(entry_point)) as zf:\n    return zf.read('PEX-INFO')\n\n\ndef read_pex_info_content(entry_point):\n  \"\"\"Return the raw content of a PEX-INFO.\"\"\"\n  if is_compressed(entry_point):\n    return read_pexinfo_from_zip(entry_point)\n  else:\n    return read_pexinfo_from_directory(entry_point)\n\n\ndef get_pex_info(entry_point):\n  \"\"\"Return the PexInfo object for an entry point.\"\"\"\n  from . import pex_info\n\n  pex_info_content = read_pex_info_content(entry_point)\n  if pex_info_content:\n    return pex_info.PexInfo.from_json(pex_info_content)\n  raise ValueError('Invalid entry_point: %s' % entry_point)\n\n\n# TODO(wickman) Remove once resolved (#91):\n#   https://bitbucket.org/pypa/setuptools/issue/154/build_zipmanifest-results-should-be\ndef monkeypatch_build_zipmanifest():\n  import pkg_resources\n  if not hasattr(pkg_resources, 'build_zipmanifest'):\n    return\n  old_build_zipmanifest = pkg_resources.build_zipmanifest\n  def memoized_build_zipmanifest(archive, memo={}):\n    if archive not in memo:\n      memo[archive] = old_build_zipmanifest(archive)\n    return memo[archive]\n  pkg_resources.build_zipmanifest = memoized_build_zipmanifest\n\n\ndef find_in_path(target_interpreter):\n  if os.path.exists(target_interpreter):\n    return target_interpreter\n\n  for directory in os.getenv('PATH', '').split(os.pathsep):\n    try_path = os.path.join(directory, target_interpreter)\n    if os.path.exists(try_path):\n      return try_path\n\n\ndef maybe_reexec_pex():\n  from .variables import ENV\n  if not ENV.PEX_PYTHON:\n    return\n\n  from .common import die\n  from .tracer import TRACER\n\n  target_python = ENV.PEX_PYTHON\n  target = find_in_path(target_python)\n  if not target:\n    die('Failed to find interpreter specified by PEX_PYTHON: %s' % target)\n  if os.path.exists(target) and os.path.realpath(target) != os.path.realpath(sys.executable):\n    TRACER.log('Detected PEX_PYTHON, re-exec to %s' % target)\n    ENV.delete('PEX_PYTHON')\n    os.execve(target, [target_python] + sys.argv, ENV.copy())\n\n\ndef bootstrap_pex(entry_point):\n  from .finders import register_finders\n  monkeypatch_build_zipmanifest()\n  register_finders()\n  maybe_reexec_pex()\n\n  from . import pex\n  pex.PEX(entry_point).execute()\n\n\ndef bootstrap_pex_env(entry_point):\n  \"\"\"Bootstrap the current runtime environment using a given pex.\"\"\"\n  from .environment import PEXEnvironment\n  from .finders import register_finders\n  from .pex_info import PexInfo\n\n  monkeypatch_build_zipmanifest()\n  register_finders()\n\n  PEXEnvironment(entry_point, PexInfo.from_pex(entry_point)).activate()\n", "path": "pex/pex_bootstrapper.py"}]}