prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  toml package is obsolete
  ### Steps To Reproduce
  
  _No response_
  
  ### Expected Behavior
  
  toml is not installed
  
  ### Actual Behavior
  
  toml is installed
  
  ### Additional Information
  
  I think our `toml` package is obsolete. The only other package listing it as a requirement is tox, but tox only needs it with ancient pythons: https://github.com/tox-dev/tox/blob/3.27.1/setup.cfg#L45
  
  I think our dependency can be replaced with tomli at which point toml can go.
  
  
  ### Environment
  
  ```markdown
  Gentoo / git develop
  ```
  
  
  ### Checklist
  
  - [X] I have searched the existing issues for a bug report that matches the one I want to file, without success.
  - [X] I have read the documentation and troubleshoot guide
  
  </issue>
  <code>
  [start of build/sage_bootstrap/creator.py]
  1 # -*- coding: utf-8 -*-
  2 """
  3 Package Creator
  4 """
  5 
  6 # ****************************************************************************
  7 #       Copyright (C) 2016 Volker Braun <vbraun.name@gmail.com>
  8 #
  9 # This program is free software: you can redistribute it and/or modify
  10 # it under the terms of the GNU General Public License as published by
  11 # the Free Software Foundation, either version 2 of the License, or
  12 # (at your option) any later version.
  13 #                  https://www.gnu.org/licenses/
  14 # ****************************************************************************
  15 
  16 import os
  17 
  18 import logging
  19 log = logging.getLogger()
  20 
  21 from sage_bootstrap.env import SAGE_ROOT
  22 
  23 
  24 class PackageCreator(object):
  25 
  26     def __init__(self, package_name):
  27         self.package_name = package_name
  28         self.path = os.path.join(SAGE_ROOT, 'build', 'pkgs', package_name)
  29         try:
  30             os.mkdir(self.path)
  31         except OSError:
  32             pass
  33 
  34     def set_version(self, version):
  35         """
  36         Write the version to ``package-version.txt``
  37         """
  38         with open(os.path.join(self.path, 'package-version.txt'), 'w+') as f:
  39             f.write(version)
  40             f.write('\n')
  41 
  42     def set_type(self, pkg_type):
  43         """
  44         Write the package type to ``type``
  45         """
  46         with open(os.path.join(self.path, 'type'), 'w+') as f:
  47             f.write(pkg_type)
  48             f.write('\n')
  49 
  50     def set_tarball(self, tarball, upstream_url):
  51         """
  52         Write the tarball name pattern to ``checksums.ini``
  53         """
  54         with open(os.path.join(self.path, 'checksums.ini'), 'w+') as f:
  55             f.write('tarball={0}'.format(tarball))
  56             f.write('\n')
  57             if upstream_url:
  58                 f.write('upstream_url={0}'.format(upstream_url))
  59             f.write('\n')
  60 
  61     def set_description(self, description, license, upstream_contact):
  62         """
  63         Write the ``SPKG.rst`` file
  64         """
  65         with open(os.path.join(self.path, 'SPKG.rst'), 'w+') as f:
  66             def heading(title, char='-'):
  67                 return '{0}\n{1}\n\n'.format(title, char * len(title))
  68             if description:
  69                 title = '{0}: {1}'.format(self.package_name, description)
  70             else:
  71                 title = self.package_name
  72             f.write(heading(title, '='))
  73             f.write(heading('Description'))
  74             if description:
  75                 f.write('{0}\n\n'.format(description))
  76             f.write(heading('License'))
  77             if license:
  78                 f.write('{0}\n\n'.format(license))
  79             f.write(heading('Upstream Contact'))
  80             if upstream_contact:
  81                 f.write('{0}\n\n'.format(upstream_contact))
  82 
  83     def set_python_data_and_scripts(self, pypi_package_name=None, source='normal'):
  84         """
  85         Write the file ``dependencies`` and other files for Python packages.
  86 
  87         If ``source`` is ``"normal"``, write the files ``spkg-install.in`` and
  88         ``install-requires.txt``.
  89 
  90         If ``source`` is ``"wheel"``, write the file ``install-requires.txt``.
  91 
  92         If ``source`` is ``"pip"``, write the file ``requirements.txt``.
  93         """
  94         if pypi_package_name is None:
  95             pypi_package_name = self.package_name
  96         with open(os.path.join(self.path, 'dependencies'), 'w+') as f:
  97             f.write('$(PYTHON) | $(PYTHON_TOOLCHAIN)\n\n')
  98             f.write('----------\nAll lines of this file are ignored except the first.\n')
  99         if source == 'normal':
  100             with open(os.path.join(self.path, 'spkg-install.in'), 'w+') as f:
  101                 f.write('cd src\nsdh_pip_install .\n')
  102             with open(os.path.join(self.path, 'install-requires.txt'), 'w+') as f:
  103                 f.write('{0}\n'.format(pypi_package_name))
  104         elif source == 'wheel':
  105             with open(os.path.join(self.path, 'install-requires.txt'), 'w+') as f:
  106                 f.write('{0}\n'.format(pypi_package_name))
  107         elif source == 'pip':
  108             with open(os.path.join(self.path, 'requirements.txt'), 'w+') as f:
  109                 f.write('{0}\n'.format(pypi_package_name))
  110         elif source == 'script':
  111             pass
  112         else:
  113             raise ValueError('package source must be one of normal, script, pip, or wheel')
  114
  [end of build/sage_bootstrap/creator.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/build/sage_bootstrap/creator.py b/build/sage_bootstrap/creator.py
  --- a/build/sage_bootstrap/creator.py
  +++ b/build/sage_bootstrap/creator.py
  @@ -94,7 +94,7 @@
           if pypi_package_name is None:
               pypi_package_name = self.package_name
           with open(os.path.join(self.path, 'dependencies'), 'w+') as f:
  -            f.write('$(PYTHON) | $(PYTHON_TOOLCHAIN)\n\n')
  +            f.write(' | $(PYTHON_TOOLCHAIN) $(PYTHON)\n\n')
               f.write('----------\nAll lines of this file are ignored except the first.\n')
           if source == 'normal':
               with open(os.path.join(self.path, 'spkg-install.in'), 'w+') as f:
  
verification_info: {"golden_diff": "diff --git a/build/sage_bootstrap/creator.py b/build/sage_bootstrap/creator.py\n--- a/build/sage_bootstrap/creator.py\n+++ b/build/sage_bootstrap/creator.py\n@@ -94,7 +94,7 @@\n         if pypi_package_name is None:\n             pypi_package_name = self.package_name\n         with open(os.path.join(self.path, 'dependencies'), 'w+') as f:\n-            f.write('$(PYTHON) | $(PYTHON_TOOLCHAIN)\\n\\n')\n+            f.write(' | $(PYTHON_TOOLCHAIN) $(PYTHON)\\n\\n')\n             f.write('----------\\nAll lines of this file are ignored except the first.\\n')\n         if source == 'normal':\n             with open(os.path.join(self.path, 'spkg-install.in'), 'w+') as f:\n", "issue": "toml package is obsolete\n### Steps To Reproduce\n\n_No response_\n\n### Expected Behavior\n\ntoml is not installed\n\n### Actual Behavior\n\ntoml is installed\n\n### Additional Information\n\nI think our `toml` package is obsolete. The only other package listing it as a requirement is tox, but tox only needs it with ancient pythons: https://github.com/tox-dev/tox/blob/3.27.1/setup.cfg#L45\r\n\r\nI think our dependency can be replaced with tomli at which point toml can go.\r\n\n\n### Environment\n\n```markdown\nGentoo / git develop\n```\n\n\n### Checklist\n\n- [X] I have searched the existing issues for a bug report that matches the one I want to file, without success.\n- [X] I have read the documentation and troubleshoot guide\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nPackage Creator\n\"\"\"\n\n# ****************************************************************************\n#       Copyright (C) 2016 Volker Braun <vbraun.name@gmail.com>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 2 of the License, or\n# (at your option) any later version.\n#                  https://www.gnu.org/licenses/\n# ****************************************************************************\n\nimport os\n\nimport logging\nlog = logging.getLogger()\n\nfrom sage_bootstrap.env import SAGE_ROOT\n\n\nclass PackageCreator(object):\n\n    def __init__(self, package_name):\n        self.package_name = package_name\n        self.path = os.path.join(SAGE_ROOT, 'build', 'pkgs', package_name)\n        try:\n            os.mkdir(self.path)\n        except OSError:\n            pass\n\n    def set_version(self, version):\n        \"\"\"\n        Write the version to ``package-version.txt``\n        \"\"\"\n        with open(os.path.join(self.path, 'package-version.txt'), 'w+') as f:\n            f.write(version)\n            f.write('\\n')\n\n    def set_type(self, pkg_type):\n        \"\"\"\n        Write the package type to ``type``\n        \"\"\"\n        with open(os.path.join(self.path, 'type'), 'w+') as f:\n            f.write(pkg_type)\n            f.write('\\n')\n\n    def set_tarball(self, tarball, upstream_url):\n        \"\"\"\n        Write the tarball name pattern to ``checksums.ini``\n        \"\"\"\n        with open(os.path.join(self.path, 'checksums.ini'), 'w+') as f:\n            f.write('tarball={0}'.format(tarball))\n            f.write('\\n')\n            if upstream_url:\n                f.write('upstream_url={0}'.format(upstream_url))\n            f.write('\\n')\n\n    def set_description(self, description, license, upstream_contact):\n        \"\"\"\n        Write the ``SPKG.rst`` file\n        \"\"\"\n        with open(os.path.join(self.path, 'SPKG.rst'), 'w+') as f:\n            def heading(title, char='-'):\n                return '{0}\\n{1}\\n\\n'.format(title, char * len(title))\n            if description:\n                title = '{0}: {1}'.format(self.package_name, description)\n            else:\n                title = self.package_name\n            f.write(heading(title, '='))\n            f.write(heading('Description'))\n            if description:\n                f.write('{0}\\n\\n'.format(description))\n            f.write(heading('License'))\n            if license:\n                f.write('{0}\\n\\n'.format(license))\n            f.write(heading('Upstream Contact'))\n            if upstream_contact:\n                f.write('{0}\\n\\n'.format(upstream_contact))\n\n    def set_python_data_and_scripts(self, pypi_package_name=None, source='normal'):\n        \"\"\"\n        Write the file ``dependencies`` and other files for Python packages.\n\n        If ``source`` is ``\"normal\"``, write the files ``spkg-install.in`` and\n        ``install-requires.txt``.\n\n        If ``source`` is ``\"wheel\"``, write the file ``install-requires.txt``.\n\n        If ``source`` is ``\"pip\"``, write the file ``requirements.txt``.\n        \"\"\"\n        if pypi_package_name is None:\n            pypi_package_name = self.package_name\n        with open(os.path.join(self.path, 'dependencies'), 'w+') as f:\n            f.write('$(PYTHON) | $(PYTHON_TOOLCHAIN)\\n\\n')\n            f.write('----------\\nAll lines of this file are ignored except the first.\\n')\n        if source == 'normal':\n            with open(os.path.join(self.path, 'spkg-install.in'), 'w+') as f:\n                f.write('cd src\\nsdh_pip_install .\\n')\n            with open(os.path.join(self.path, 'install-requires.txt'), 'w+') as f:\n                f.write('{0}\\n'.format(pypi_package_name))\n        elif source == 'wheel':\n            with open(os.path.join(self.path, 'install-requires.txt'), 'w+') as f:\n                f.write('{0}\\n'.format(pypi_package_name))\n        elif source == 'pip':\n            with open(os.path.join(self.path, 'requirements.txt'), 'w+') as f:\n                f.write('{0}\\n'.format(pypi_package_name))\n        elif source == 'script':\n            pass\n        else:\n            raise ValueError('package source must be one of normal, script, pip, or wheel')\n", "path": "build/sage_bootstrap/creator.py"}]}