prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Time to use `build` from `setuptools` instead of `distutils`?
  ### Describe the problem
  
  The following feature in setuptools has been deprecated for almost 2 years and is about to be removed:
  
  https://github.com/pypa/setuptools/blob/1ed759173983656734c3606e9c97a348895e5e0c/setuptools/command/build.py#L13-L27
  
  It might be a good idea to import `build` directly from setuptools for the following code:
  
  https://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L9
  https://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L51-L58
  
  (`build` is available directly from setuptools, starting on version v62.4.0)
  
  ### Describe the solution you would like
  
  Whenever possible, it might be a good idea to import from setuptools (and minimise imports to `distutils` to the minimum viable).
  
  ### Describe alternatives you have considered
  
  _No response_
  
  ### Screenshots
  
  _No response_
  
  ### Additional context
  
  _No response_
  Time to use `build` from `setuptools` instead of `distutils`?
  ### Describe the problem
  
  The following feature in setuptools has been deprecated for almost 2 years and is about to be removed:
  
  https://github.com/pypa/setuptools/blob/1ed759173983656734c3606e9c97a348895e5e0c/setuptools/command/build.py#L13-L27
  
  It might be a good idea to import `build` directly from setuptools for the following code:
  
  https://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L9
  https://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L51-L58
  
  (`build` is available directly from setuptools, starting on version v62.4.0)
  
  ### Describe the solution you would like
  
  Whenever possible, it might be a good idea to import from setuptools (and minimise imports to `distutils` to the minimum viable).
  
  ### Describe alternatives you have considered
  
  _No response_
  
  ### Screenshots
  
  _No response_
  
  ### Additional context
  
  _No response_
  
  </issue>
  <code>
  [start of setup.py]
  1 #!/usr/bin/env python3
  2 
  3 # Copyright © Michal Čihař <michal@weblate.org>
  4 #
  5 # SPDX-License-Identifier: GPL-3.0-or-later
  6 
  7 import os
  8 from distutils import log
  9 from distutils.command.build import build
  10 from distutils.core import Command
  11 from glob import glob
  12 from itertools import chain
  13 
  14 from setuptools import setup
  15 from setuptools.command.build_py import build_py
  16 from setuptools.modified import newer
  17 from translate.tools.pocompile import convertmo
  18 
  19 LOCALE_MASKS = [
  20     "weblate/locale/*/LC_MESSAGES/*.po",
  21 ]
  22 
  23 
  24 class WeblateBuildPy(build_py):
  25     def find_package_modules(self, package, package_dir):
  26         """Filter settings.py from built module."""
  27         result = super().find_package_modules(package, package_dir)
  28         return [item for item in result if item[2] != "weblate/settings.py"]
  29 
  30 
  31 class BuildMo(Command):
  32     description = "update MO files to match PO"
  33     user_options = []
  34 
  35     def initialize_options(self) -> None:
  36         self.build_base = None
  37 
  38     def finalize_options(self) -> None:
  39         self.set_undefined_options("build", ("build_base", "build_base"))
  40 
  41     def run(self) -> None:
  42         for name in chain.from_iterable(glob(mask) for mask in LOCALE_MASKS):
  43             output = os.path.splitext(name)[0] + ".mo"
  44             if not newer(name, output):
  45                 continue
  46             self.announce(f"compiling {name} -> {output}", level=log.INFO)
  47             with open(name, "rb") as pofile, open(output, "wb") as mofile:
  48                 convertmo(pofile, mofile, None)
  49 
  50 
  51 class WeblateBuild(build):
  52     """Override the default build with new subcommands."""
  53 
  54     # The build_mo has to be before build_data
  55     sub_commands = [
  56         ("build_mo", lambda self: True),  # noqa: ARG005
  57         *build.sub_commands,
  58     ]
  59 
  60 
  61 setup(
  62     cmdclass={"build_py": WeblateBuildPy, "build_mo": BuildMo, "build": WeblateBuild},
  63 )
  64
  [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,12 +6,12 @@
   
   import os
   from distutils import log
  -from distutils.command.build import build
   from distutils.core import Command
   from glob import glob
   from itertools import chain
   
   from setuptools import setup
  +from setuptools.command.build import build
   from setuptools.command.build_py import build_py
   from setuptools.modified import newer
   from translate.tools.pocompile import convertmo
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -6,12 +6,12 @@\n \n import os\n from distutils import log\n-from distutils.command.build import build\n from distutils.core import Command\n from glob import glob\n from itertools import chain\n \n from setuptools import setup\n+from setuptools.command.build import build\n from setuptools.command.build_py import build_py\n from setuptools.modified import newer\n from translate.tools.pocompile import convertmo\n", "issue": "Time to use `build` from `setuptools` instead of `distutils`?\n### Describe the problem\n\nThe following feature in setuptools has been deprecated for almost 2 years and is about to be removed:\r\n\r\nhttps://github.com/pypa/setuptools/blob/1ed759173983656734c3606e9c97a348895e5e0c/setuptools/command/build.py#L13-L27\r\n\r\nIt might be a good idea to import `build` directly from setuptools for the following code:\r\n\r\nhttps://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L9\r\nhttps://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L51-L58\r\n\r\n(`build` is available directly from setuptools, starting on version v62.4.0)\n\n### Describe the solution you would like\n\nWhenever possible, it might be a good idea to import from setuptools (and minimise imports to `distutils` to the minimum viable).\n\n### Describe alternatives you have considered\n\n_No response_\n\n### Screenshots\n\n_No response_\n\n### Additional context\n\n_No response_\nTime to use `build` from `setuptools` instead of `distutils`?\n### Describe the problem\n\nThe following feature in setuptools has been deprecated for almost 2 years and is about to be removed:\r\n\r\nhttps://github.com/pypa/setuptools/blob/1ed759173983656734c3606e9c97a348895e5e0c/setuptools/command/build.py#L13-L27\r\n\r\nIt might be a good idea to import `build` directly from setuptools for the following code:\r\n\r\nhttps://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L9\r\nhttps://github.com/WeblateOrg/weblate/blob/47f9f2870c4ed9fd5429eebfacc61d2267a5bb31/setup.py#L51-L58\r\n\r\n(`build` is available directly from setuptools, starting on version v62.4.0)\n\n### Describe the solution you would like\n\nWhenever possible, it might be a good idea to import from setuptools (and minimise imports to `distutils` to the minimum viable).\n\n### Describe alternatives you have considered\n\n_No response_\n\n### Screenshots\n\n_No response_\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright \u00a9 Michal \u010ciha\u0159 <michal@weblate.org>\n#\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nimport os\nfrom distutils import log\nfrom distutils.command.build import build\nfrom distutils.core import Command\nfrom glob import glob\nfrom itertools import chain\n\nfrom setuptools import setup\nfrom setuptools.command.build_py import build_py\nfrom setuptools.modified import newer\nfrom translate.tools.pocompile import convertmo\n\nLOCALE_MASKS = [\n    \"weblate/locale/*/LC_MESSAGES/*.po\",\n]\n\n\nclass WeblateBuildPy(build_py):\n    def find_package_modules(self, package, package_dir):\n        \"\"\"Filter settings.py from built module.\"\"\"\n        result = super().find_package_modules(package, package_dir)\n        return [item for item in result if item[2] != \"weblate/settings.py\"]\n\n\nclass BuildMo(Command):\n    description = \"update MO files to match PO\"\n    user_options = []\n\n    def initialize_options(self) -> None:\n        self.build_base = None\n\n    def finalize_options(self) -> None:\n        self.set_undefined_options(\"build\", (\"build_base\", \"build_base\"))\n\n    def run(self) -> None:\n        for name in chain.from_iterable(glob(mask) for mask in LOCALE_MASKS):\n            output = os.path.splitext(name)[0] + \".mo\"\n            if not newer(name, output):\n                continue\n            self.announce(f\"compiling {name} -> {output}\", level=log.INFO)\n            with open(name, \"rb\") as pofile, open(output, \"wb\") as mofile:\n                convertmo(pofile, mofile, None)\n\n\nclass WeblateBuild(build):\n    \"\"\"Override the default build with new subcommands.\"\"\"\n\n    # The build_mo has to be before build_data\n    sub_commands = [\n        (\"build_mo\", lambda self: True),  # noqa: ARG005\n        *build.sub_commands,\n    ]\n\n\nsetup(\n    cmdclass={\"build_py\": WeblateBuildPy, \"build_mo\": BuildMo, \"build\": WeblateBuild},\n)\n", "path": "setup.py"}]}