prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `spack checksum` finds wrong URLs
  I was having some problems getting spack to find the correct URL for files.
  
  With these settings
  
  ``` python
      homepage = "http://fishshell.com/"
      url      = "http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz"
      list_url = homepage
  ```
  
  I get the following result (with wrong URLs):
  
  ``` sh
  $ spack checksum fish
  ==> Found 5 versions of fish.
    2.2.0     http://fishshell.com/fish-2.2.0.tar.gz
    2.1.2     http://fishshell.com/fish-2.1.2.tar.gz
    2.1.1     http://fishshell.com/fish-2.1.1.tar.gz
    2.1.0     http://fishshell.com/fish-2.1.0.tar.gz
    2.0.0     http://fishshell.com/fish-2.0.0.tar.gz
  
  How many would you like to checksum? (default is 5, q to abort)
  ==> Downloading...
  ==> Trying to fetch from http://fishshell.com/fish-2.2.0.tar.gz
  
  curl: (22) The requested URL returned error: 404 Not Found
  ==> Fetching from http://fishshell.com/fish-2.2.0.tar.gz failed.
  ==> Error: All fetchers failed for spack-stage-Slflbn
  ```
  
  
  </issue>
  <code>
  [start of var/spack/repos/builtin/packages/fish/package.py]
  1 ##############################################################################
  2 # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
  3 # Produced at the Lawrence Livermore National Laboratory.
  4 #
  5 # This file is part of Spack.
  6 # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
  7 # LLNL-CODE-647188
  8 #
  9 # For details, see https://github.com/llnl/spack
  10 # Please also see the LICENSE file for our notice and the LGPL.
  11 #
  12 # This program is free software; you can redistribute it and/or modify
  13 # it under the terms of the GNU Lesser General Public License (as
  14 # published by the Free Software Foundation) version 2.1, February 1999.
  15 #
  16 # This program is distributed in the hope that it will be useful, but
  17 # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
  18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
  19 # conditions of the GNU Lesser General Public License for more details.
  20 #
  21 # You should have received a copy of the GNU Lesser General Public
  22 # License along with this program; if not, write to the Free Software
  23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24 ##############################################################################
  25 from spack import *
  26 
  27 
  28 class Fish(Package):
  29     """fish is a smart and user-friendly command line shell for OS X, Linux, and
  30     the rest of the family.
  31     """
  32 
  33     homepage = "http://fishshell.com/"
  34     url      = "http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz"
  35     list_url = "http://fishshell.com/files/"
  36     list_depth = 2
  37 
  38     version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')
  39 
  40     def install(self, spec, prefix):
  41         configure('--prefix=%s' % prefix)
  42 
  43         make()
  44         make("install")
  45
  [end of var/spack/repos/builtin/packages/fish/package.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/var/spack/repos/builtin/packages/fish/package.py b/var/spack/repos/builtin/packages/fish/package.py
  --- a/var/spack/repos/builtin/packages/fish/package.py
  +++ b/var/spack/repos/builtin/packages/fish/package.py
  @@ -32,8 +32,7 @@
   
       homepage = "http://fishshell.com/"
       url      = "http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz"
  -    list_url = "http://fishshell.com/files/"
  -    list_depth = 2
  +    list_url = "http://fishshell.com/"
   
       version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')
  
verification_info: {"golden_diff": "diff --git a/var/spack/repos/builtin/packages/fish/package.py b/var/spack/repos/builtin/packages/fish/package.py\n--- a/var/spack/repos/builtin/packages/fish/package.py\n+++ b/var/spack/repos/builtin/packages/fish/package.py\n@@ -32,8 +32,7 @@\n \n     homepage = \"http://fishshell.com/\"\n     url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n-    list_url = \"http://fishshell.com/files/\"\n-    list_depth = 2\n+    list_url = \"http://fishshell.com/\"\n \n     version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')\n", "issue": "`spack checksum` finds wrong URLs\nI was having some problems getting spack to find the correct URL for files.\n\nWith these settings\n\n``` python\n    homepage = \"http://fishshell.com/\"\n    url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n    list_url = homepage\n```\n\nI get the following result (with wrong URLs):\n\n``` sh\n$ spack checksum fish\n==> Found 5 versions of fish.\n  2.2.0     http://fishshell.com/fish-2.2.0.tar.gz\n  2.1.2     http://fishshell.com/fish-2.1.2.tar.gz\n  2.1.1     http://fishshell.com/fish-2.1.1.tar.gz\n  2.1.0     http://fishshell.com/fish-2.1.0.tar.gz\n  2.0.0     http://fishshell.com/fish-2.0.0.tar.gz\n\nHow many would you like to checksum? (default is 5, q to abort)\n==> Downloading...\n==> Trying to fetch from http://fishshell.com/fish-2.2.0.tar.gz\n\ncurl: (22) The requested URL returned error: 404 Not Found\n==> Fetching from http://fishshell.com/fish-2.2.0.tar.gz failed.\n==> Error: All fetchers failed for spack-stage-Slflbn\n```\n\n", "before_files": [{"content": "##############################################################################\n# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.\n# Produced at the Lawrence Livermore National Laboratory.\n#\n# This file is part of Spack.\n# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.\n# LLNL-CODE-647188\n#\n# For details, see https://github.com/llnl/spack\n# Please also see the LICENSE file for our notice and the LGPL.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License (as\n# published by the Free Software Foundation) version 2.1, February 1999.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and\n# conditions of the GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n##############################################################################\nfrom spack import *\n\n\nclass Fish(Package):\n    \"\"\"fish is a smart and user-friendly command line shell for OS X, Linux, and\n    the rest of the family.\n    \"\"\"\n\n    homepage = \"http://fishshell.com/\"\n    url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n    list_url = \"http://fishshell.com/files/\"\n    list_depth = 2\n\n    version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')\n\n    def install(self, spec, prefix):\n        configure('--prefix=%s' % prefix)\n\n        make()\n        make(\"install\")\n", "path": "var/spack/repos/builtin/packages/fish/package.py"}]}