prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Can't get conda index to work with channel_name
  From the updated docs on 3.14.0, `channel_name` is now a positional argument. However, when I do
  ```bash
  $ conda index <build_dir> <channel_name>
  ```
  I get
  ```
  (...)
  FileNotFoundError: [Errno 2] No such file or directory: '<path_prefix>/<channel_name>'
  ```
  instead of a custom channel name in the outputted html files. 
  
  Am I forgetting some special `argparse` magic or did #3091 introduce a bug?
  
  I'm on conda 4.5.11 and conda-build 3.14.0
  
  </issue>
  <code>
  [start of conda_build/cli/main_index.py]
  1 from __future__ import absolute_import, division, print_function
  2 
  3 import logging
  4 import os
  5 import sys
  6 
  7 from conda_build.conda_interface import ArgumentParser
  8 
  9 from conda_build import api
  10 from conda_build.index import DEFAULT_SUBDIRS, MAX_THREADS_DEFAULT
  11 
  12 logging.basicConfig(level=logging.INFO)
  13 
  14 
  15 def parse_args(args):
  16     p = ArgumentParser(
  17         description="Update package index metadata files in given directories.")
  18 
  19     p.add_argument(
  20         'dir',
  21         help='Directory that contains an index to be updated.',
  22         nargs='*',
  23         default=[os.getcwd()],
  24     )
  25 
  26     p.add_argument(
  27         '-c', "--check-md5",
  28         action="store_true",
  29         help="""Use hash values instead of file modification times for determining if a
  30         package's metadata needs to be updated.""",
  31     )
  32     p.add_argument(
  33         'channel_name',
  34         help='Adding a channel name will create an index.html file within the subdir.',
  35         nargs='?',
  36         default=None,
  37     )
  38     p.add_argument(
  39         '-s', '--subdir',
  40         action='append',
  41         help='Optional. The subdir to index. Can be given multiple times. If not provided, will '
  42              'default to all of %s. If provided, will not create channeldata.json for the channel.'
  43              '' % ', '.join(DEFAULT_SUBDIRS),
  44     )
  45     p.add_argument(
  46         '-t', '--threads',
  47         default=MAX_THREADS_DEFAULT,
  48         type=int,
  49     )
  50     p.add_argument(
  51         "-p", "--patch-generator",
  52         help="Path to Python file that outputs metadata patch instructions"
  53     )
  54 
  55     args = p.parse_args(args)
  56     return p, args
  57 
  58 
  59 def execute(args):
  60     _, args = parse_args(args)
  61     api.update_index(args.dir, check_md5=args.check_md5, channel_name=args.channel_name,
  62                      threads=args.threads, subdir=args.subdir, patch_generator=args.patch_generator)
  63 
  64 
  65 def main():
  66     return execute(sys.argv[1:])
  67
  [end of conda_build/cli/main_index.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/conda_build/cli/main_index.py b/conda_build/cli/main_index.py
  --- a/conda_build/cli/main_index.py
  +++ b/conda_build/cli/main_index.py
  @@ -30,10 +30,8 @@
           package's metadata needs to be updated.""",
       )
       p.add_argument(
  -        'channel_name',
  -        help='Adding a channel name will create an index.html file within the subdir.',
  -        nargs='?',
  -        default=None,
  +        "-n", "--channel-name",
  +        help="Customize the channel name listed in each channel's index.html.",
       )
       p.add_argument(
           '-s', '--subdir',
  
verification_info: {"golden_diff": "diff --git a/conda_build/cli/main_index.py b/conda_build/cli/main_index.py\n--- a/conda_build/cli/main_index.py\n+++ b/conda_build/cli/main_index.py\n@@ -30,10 +30,8 @@\n         package's metadata needs to be updated.\"\"\",\n     )\n     p.add_argument(\n-        'channel_name',\n-        help='Adding a channel name will create an index.html file within the subdir.',\n-        nargs='?',\n-        default=None,\n+        \"-n\", \"--channel-name\",\n+        help=\"Customize the channel name listed in each channel's index.html.\",\n     )\n     p.add_argument(\n         '-s', '--subdir',\n", "issue": "Can't get conda index to work with channel_name\nFrom the updated docs on 3.14.0, `channel_name` is now a positional argument. However, when I do\r\n```bash\r\n$ conda index <build_dir> <channel_name>\r\n```\r\nI get\r\n```\r\n(...)\r\nFileNotFoundError: [Errno 2] No such file or directory: '<path_prefix>/<channel_name>'\r\n```\r\ninstead of a custom channel name in the outputted html files. \r\n\r\nAm I forgetting some special `argparse` magic or did #3091 introduce a bug?\r\n\r\nI'm on conda 4.5.11 and conda-build 3.14.0\n", "before_files": [{"content": "from __future__ import absolute_import, division, print_function\n\nimport logging\nimport os\nimport sys\n\nfrom conda_build.conda_interface import ArgumentParser\n\nfrom conda_build import api\nfrom conda_build.index import DEFAULT_SUBDIRS, MAX_THREADS_DEFAULT\n\nlogging.basicConfig(level=logging.INFO)\n\n\ndef parse_args(args):\n    p = ArgumentParser(\n        description=\"Update package index metadata files in given directories.\")\n\n    p.add_argument(\n        'dir',\n        help='Directory that contains an index to be updated.',\n        nargs='*',\n        default=[os.getcwd()],\n    )\n\n    p.add_argument(\n        '-c', \"--check-md5\",\n        action=\"store_true\",\n        help=\"\"\"Use hash values instead of file modification times for determining if a\n        package's metadata needs to be updated.\"\"\",\n    )\n    p.add_argument(\n        'channel_name',\n        help='Adding a channel name will create an index.html file within the subdir.',\n        nargs='?',\n        default=None,\n    )\n    p.add_argument(\n        '-s', '--subdir',\n        action='append',\n        help='Optional. The subdir to index. Can be given multiple times. If not provided, will '\n             'default to all of %s. If provided, will not create channeldata.json for the channel.'\n             '' % ', '.join(DEFAULT_SUBDIRS),\n    )\n    p.add_argument(\n        '-t', '--threads',\n        default=MAX_THREADS_DEFAULT,\n        type=int,\n    )\n    p.add_argument(\n        \"-p\", \"--patch-generator\",\n        help=\"Path to Python file that outputs metadata patch instructions\"\n    )\n\n    args = p.parse_args(args)\n    return p, args\n\n\ndef execute(args):\n    _, args = parse_args(args)\n    api.update_index(args.dir, check_md5=args.check_md5, channel_name=args.channel_name,\n                     threads=args.threads, subdir=args.subdir, patch_generator=args.patch_generator)\n\n\ndef main():\n    return execute(sys.argv[1:])\n", "path": "conda_build/cli/main_index.py"}]}