prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Setuptools 60.7.0 breaks the executable
  Building with setuptools==60.7.0 I get this error.
  There is no `jaraco` module (seems like this is the author of `setuptools)
  ```
  (simulator_venv) ➜  agent git:(feature/SB-22361-improve-socket-error-handling) ✗ dist/sbsimulator/sbsimulator
  Traceback (most recent call last):
    File "PyInstaller/hooks/rthooks/pyi_rth_pkgres.py", line 16, in <module>
    File "/Users/arossert/Shared/Bitbucket/agent/simulator_venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 74, in <module>
      from pkg_resources.extern.jaraco.text import (
    File "/Users/arossert/Shared/Bitbucket/agent/simulator_venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py", line 52, in create_module
      return self.load_module(spec.name)
    File "/Users/arossert/Shared/Bitbucket/agent/simulator_venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py", line 44, in load_module
      raise ImportError(
  ImportError: The 'jaraco' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
  [23421] Failed to execute script 'pyi_rth_pkgres' due to unhandled exception!
  ```
  
  PyInstaller: 4.8
  OS: Linux/Mac (not tested on Windows)
  Python: 3.8.10
  
  </issue>
  <code>
  [start of PyInstaller/hooks/hook-pkg_resources.py]
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2005-2021, PyInstaller Development Team.
  3 #
  4 # Distributed under the terms of the GNU General Public License (version 2
  5 # or later) with exception for distributing the bootloader.
  6 #
  7 # The full license is in the file COPYING.txt, distributed with this software.
  8 #
  9 # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
  10 #-----------------------------------------------------------------------------
  11 
  12 from PyInstaller.utils.hooks import collect_submodules
  13 
  14 # pkg_resources keeps vendored modules in its _vendor subpackage, and does sys.meta_path based import magic to expose
  15 # them as pkg_resources.extern.*
  16 hiddenimports = collect_submodules('pkg_resources._vendor')
  17 
  18 # pkg_resources v45.0 dropped support for Python 2 and added this module printing a warning. We could save some bytes if
  19 # we would replace this by a fake module.
  20 hiddenimports.append('pkg_resources.py2_warn')
  21 
  22 excludedimports = ['__main__']
  23 
  24 # Some more hidden imports. See:
  25 # https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/15#issuecomment-663699288 `packaging` can either be
  26 # its own package, or embedded in `pkg_resources._vendor.packaging`, or both. Assume the worst and include both if
  27 # present.
  28 hiddenimports += collect_submodules('packaging')
  29 
  30 hiddenimports += ['pkg_resources.markers']
  31
  [end of PyInstaller/hooks/hook-pkg_resources.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/PyInstaller/hooks/hook-pkg_resources.py b/PyInstaller/hooks/hook-pkg_resources.py
  --- a/PyInstaller/hooks/hook-pkg_resources.py
  +++ b/PyInstaller/hooks/hook-pkg_resources.py
  @@ -9,7 +9,7 @@
   # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
   #-----------------------------------------------------------------------------
   
  -from PyInstaller.utils.hooks import collect_submodules
  +from PyInstaller.utils.hooks import collect_submodules, is_module_satisfies
   
   # pkg_resources keeps vendored modules in its _vendor subpackage, and does sys.meta_path based import magic to expose
   # them as pkg_resources.extern.*
  @@ -28,3 +28,24 @@
   hiddenimports += collect_submodules('packaging')
   
   hiddenimports += ['pkg_resources.markers']
  +
  +# As of v60.7, setuptools vendored jaraco and has pkg_resources use it. Currently, the pkg_resources._vendor.jaraco
  +# namespace package cannot be automatically scanned due to limited support for pure namespace packages in our hook
  +# utilities.
  +#
  +# In setuptools 60.7.0, the vendored jaraco.text package included "Lorem Ipsum.txt" data file, which also has to be
  +# collected. However, the presence of the data file (and the resulting directory hierarchy) confuses the importer's
  +# redirection logic; instead of trying to work-around that, tell user to upgrade or downgrade their setuptools.
  +if is_module_satisfies("setuptools == 60.7.0"):
  +    raise SystemExit(
  +        "ERROR: Setuptools 60.7.0 is incompatible with PyInstaller. "
  +        "Downgrade to an earlier version or upgrade to a later version."
  +    )
  +# In setuptools 60.7.1, the "Lorem Ipsum.txt" data file was dropped from the vendored jaraco.text package, so we can
  +# accommodate it with couple of hidden imports.
  +elif is_module_satisfies("setuptools >= 60.7.1"):
  +    hiddenimports += [
  +        'pkg_resources._vendor.jaraco.functools',
  +        'pkg_resources._vendor.jaraco.context',
  +        'pkg_resources._vendor.jaraco.text',
  +    ]
  
verification_info: {"golden_diff": "diff --git a/PyInstaller/hooks/hook-pkg_resources.py b/PyInstaller/hooks/hook-pkg_resources.py\n--- a/PyInstaller/hooks/hook-pkg_resources.py\n+++ b/PyInstaller/hooks/hook-pkg_resources.py\n@@ -9,7 +9,7 @@\n # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n #-----------------------------------------------------------------------------\n \n-from PyInstaller.utils.hooks import collect_submodules\n+from PyInstaller.utils.hooks import collect_submodules, is_module_satisfies\n \n # pkg_resources keeps vendored modules in its _vendor subpackage, and does sys.meta_path based import magic to expose\n # them as pkg_resources.extern.*\n@@ -28,3 +28,24 @@\n hiddenimports += collect_submodules('packaging')\n \n hiddenimports += ['pkg_resources.markers']\n+\n+# As of v60.7, setuptools vendored jaraco and has pkg_resources use it. Currently, the pkg_resources._vendor.jaraco\n+# namespace package cannot be automatically scanned due to limited support for pure namespace packages in our hook\n+# utilities.\n+#\n+# In setuptools 60.7.0, the vendored jaraco.text package included \"Lorem Ipsum.txt\" data file, which also has to be\n+# collected. However, the presence of the data file (and the resulting directory hierarchy) confuses the importer's\n+# redirection logic; instead of trying to work-around that, tell user to upgrade or downgrade their setuptools.\n+if is_module_satisfies(\"setuptools == 60.7.0\"):\n+    raise SystemExit(\n+        \"ERROR: Setuptools 60.7.0 is incompatible with PyInstaller. \"\n+        \"Downgrade to an earlier version or upgrade to a later version.\"\n+    )\n+# In setuptools 60.7.1, the \"Lorem Ipsum.txt\" data file was dropped from the vendored jaraco.text package, so we can\n+# accommodate it with couple of hidden imports.\n+elif is_module_satisfies(\"setuptools >= 60.7.1\"):\n+    hiddenimports += [\n+        'pkg_resources._vendor.jaraco.functools',\n+        'pkg_resources._vendor.jaraco.context',\n+        'pkg_resources._vendor.jaraco.text',\n+    ]\n", "issue": "Setuptools 60.7.0 breaks the executable\nBuilding with setuptools==60.7.0 I get this error.\r\nThere is no `jaraco` module (seems like this is the author of `setuptools)\r\n```\r\n(simulator_venv) \u279c  agent git:(feature/SB-22361-improve-socket-error-handling) \u2717 dist/sbsimulator/sbsimulator\r\nTraceback (most recent call last):\r\n  File \"PyInstaller/hooks/rthooks/pyi_rth_pkgres.py\", line 16, in <module>\r\n  File \"/Users/arossert/Shared/Bitbucket/agent/simulator_venv/lib/python3.8/site-packages/pkg_resources/__init__.py\", line 74, in <module>\r\n    from pkg_resources.extern.jaraco.text import (\r\n  File \"/Users/arossert/Shared/Bitbucket/agent/simulator_venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py\", line 52, in create_module\r\n    return self.load_module(spec.name)\r\n  File \"/Users/arossert/Shared/Bitbucket/agent/simulator_venv/lib/python3.8/site-packages/pkg_resources/extern/__init__.py\", line 44, in load_module\r\n    raise ImportError(\r\nImportError: The 'jaraco' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.\r\n[23421] Failed to execute script 'pyi_rth_pkgres' due to unhandled exception!\r\n```\r\n\r\nPyInstaller: 4.8\r\nOS: Linux/Mac (not tested on Windows)\r\nPython: 3.8.10\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2005-2021, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License (version 2\n# or later) with exception for distributing the bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n#-----------------------------------------------------------------------------\n\nfrom PyInstaller.utils.hooks import collect_submodules\n\n# pkg_resources keeps vendored modules in its _vendor subpackage, and does sys.meta_path based import magic to expose\n# them as pkg_resources.extern.*\nhiddenimports = collect_submodules('pkg_resources._vendor')\n\n# pkg_resources v45.0 dropped support for Python 2 and added this module printing a warning. We could save some bytes if\n# we would replace this by a fake module.\nhiddenimports.append('pkg_resources.py2_warn')\n\nexcludedimports = ['__main__']\n\n# Some more hidden imports. See:\n# https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/15#issuecomment-663699288 `packaging` can either be\n# its own package, or embedded in `pkg_resources._vendor.packaging`, or both. Assume the worst and include both if\n# present.\nhiddenimports += collect_submodules('packaging')\n\nhiddenimports += ['pkg_resources.markers']\n", "path": "PyInstaller/hooks/hook-pkg_resources.py"}]}