prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  conda env update : does not support --prefix
  The `conda env update` does not support the `--prefix` / `-p` argument.
  
  ```
  $ conda info | grep version
            conda version : 4.2.12
        conda-env version : 4.2.12
      conda-build version : 1.20.3
           python version : 2.7.11.final.0
         requests version : 2.10.0
  
  $ conda env update -p ./conda-env
  usage: conda-env [-h] {attach,create,export,list,remove,upload,update} ...
  conda-env: error: unrecognized arguments: -p
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `conda_env/cli/main_update.py`
  Content:
  ```
  1 from argparse import RawDescriptionHelpFormatter
  2 import os
  3 import textwrap
  4 import sys
  5 
  6 from conda import config
  7 from conda.cli import common
  8 from conda.cli import install as cli_install
  9 from conda.misc import touch_nonadmin
  10 from ..installers.base import get_installer, InvalidInstaller
  11 from .. import specs as install_specs
  12 from .. import exceptions
  13 # for conda env
  14 from conda_env.cli.common import get_prefix
  15 from ..exceptions import CondaEnvException
  16 description = """
  17 Update the current environment based on environment file
  18 """
  19 
  20 example = """
  21 examples:
  22     conda env update
  23     conda env update -n=foo
  24     conda env update -f=/path/to/environment.yml
  25     conda env update --name=foo --file=environment.yml
  26     conda env update vader/deathstar
  27 """
  28 
  29 
  30 def configure_parser(sub_parsers):
  31     p = sub_parsers.add_parser(
  32         'update',
  33         formatter_class=RawDescriptionHelpFormatter,
  34         description=description,
  35         help=description,
  36         epilog=example,
  37     )
  38     p.add_argument(
  39         '-n', '--name',
  40         action='store',
  41         help='name of environment (in %s)' % os.pathsep.join(config.envs_dirs),
  42         default=None,
  43     )
  44     p.add_argument(
  45         '-f', '--file',
  46         action='store',
  47         help='environment definition (default: environment.yml)',
  48         default='environment.yml',
  49     )
  50     p.add_argument(
  51         '--prune',
  52         action='store_true',
  53         default=False,
  54         help='remove installed packages not defined in environment.yml',
  55     )
  56     p.add_argument(
  57         '-q', '--quiet',
  58         action='store_true',
  59         default=False,
  60     )
  61     p.add_argument(
  62         'remote_definition',
  63         help='remote environment definition / IPython notebook',
  64         action='store',
  65         default=None,
  66         nargs='?'
  67     )
  68     common.add_parser_json(p)
  69     p.set_defaults(func=execute)
  70 
  71 
  72 def execute(args, parser):
  73     name = args.remote_definition or args.name
  74 
  75     try:
  76         spec = install_specs.detect(name=name, filename=args.file,
  77                                     directory=os.getcwd())
  78         env = spec.environment
  79     except exceptions.SpecNotFound:
  80         raise
  81 
  82     if not args.name:
  83         if not env.name:
  84                     # Note, this is a hack fofr get_prefix that assumes argparse results
  85             # TODO Refactor common.get_prefix
  86             name = os.environ.get('CONDA_DEFAULT_ENV', False)
  87             if not name:
  88                 msg = "Unable to determine environment\n\n"
  89                 msg += textwrap.dedent("""
  90                     Please re-run this command with one of the following options:
  91 
  92                     * Provide an environment name via --name or -n
  93                     * Re-run this command inside an activated conda environment.""").lstrip()
  94                 # TODO Add json support
  95                 raise CondaEnvException(msg)
  96 
  97         # Note: stubbing out the args object as all of the
  98         # conda.cli.common code thinks that name will always
  99         # be specified.
  100         args.name = env.name
  101 
  102     prefix = get_prefix(args, search=False)
  103     # CAN'T Check with this function since it assumes we will create prefix.
  104     # cli_install.check_prefix(prefix, json=args.json)
  105 
  106     # TODO, add capability
  107     # common.ensure_override_channels_requires_channel(args)
  108     # channel_urls = args.channel or ()
  109 
  110     for installer_type, specs in env.dependencies.items():
  111         try:
  112             installer = get_installer(installer_type)
  113             installer.install(prefix, specs, args, env, prune=args.prune)
  114         except InvalidInstaller:
  115             sys.stderr.write(textwrap.dedent("""
  116                 Unable to install package for {0}.
  117 
  118                 Please double check and ensure you dependencies file has
  119                 the correct spelling.  You might also try installing the
  120                 conda-env-{0} package to see if provides the required
  121                 installer.
  122                 """).lstrip().format(installer_type)
  123             )
  124             return -1
  125 
  126     touch_nonadmin(prefix)
  127     if not args.json:
  128         print(cli_install.print_activate(args.name if args.name else prefix))
  129
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/conda_env/cli/main_update.py b/conda_env/cli/main_update.py
  --- a/conda_env/cli/main_update.py
  +++ b/conda_env/cli/main_update.py
  @@ -79,7 +79,7 @@
       except exceptions.SpecNotFound:
           raise
   
  -    if not args.name:
  +    if not (args.name or args.prefix):
           if not env.name:
                       # Note, this is a hack fofr get_prefix that assumes argparse results
               # TODO Refactor common.get_prefix
  
verification_info: {"golden_diff": "diff --git a/conda_env/cli/main_update.py b/conda_env/cli/main_update.py\n--- a/conda_env/cli/main_update.py\n+++ b/conda_env/cli/main_update.py\n@@ -79,7 +79,7 @@\n     except exceptions.SpecNotFound:\n         raise\n \n-    if not args.name:\n+    if not (args.name or args.prefix):\n         if not env.name:\n                     # Note, this is a hack fofr get_prefix that assumes argparse results\n             # TODO Refactor common.get_prefix\n", "issue": "conda env update : does not support --prefix\nThe `conda env update` does not support the `--prefix` / `-p` argument.\r\n\r\n```\r\n$ conda info | grep version\r\n          conda version : 4.2.12\r\n      conda-env version : 4.2.12\r\n    conda-build version : 1.20.3\r\n         python version : 2.7.11.final.0\r\n       requests version : 2.10.0\r\n\r\n$ conda env update -p ./conda-env\r\nusage: conda-env [-h] {attach,create,export,list,remove,upload,update} ...\r\nconda-env: error: unrecognized arguments: -p\r\n```\r\n\n", "before_files": [{"content": "from argparse import RawDescriptionHelpFormatter\nimport os\nimport textwrap\nimport sys\n\nfrom conda import config\nfrom conda.cli import common\nfrom conda.cli import install as cli_install\nfrom conda.misc import touch_nonadmin\nfrom ..installers.base import get_installer, InvalidInstaller\nfrom .. import specs as install_specs\nfrom .. import exceptions\n# for conda env\nfrom conda_env.cli.common import get_prefix\nfrom ..exceptions import CondaEnvException\ndescription = \"\"\"\nUpdate the current environment based on environment file\n\"\"\"\n\nexample = \"\"\"\nexamples:\n    conda env update\n    conda env update -n=foo\n    conda env update -f=/path/to/environment.yml\n    conda env update --name=foo --file=environment.yml\n    conda env update vader/deathstar\n\"\"\"\n\n\ndef configure_parser(sub_parsers):\n    p = sub_parsers.add_parser(\n        'update',\n        formatter_class=RawDescriptionHelpFormatter,\n        description=description,\n        help=description,\n        epilog=example,\n    )\n    p.add_argument(\n        '-n', '--name',\n        action='store',\n        help='name of environment (in %s)' % os.pathsep.join(config.envs_dirs),\n        default=None,\n    )\n    p.add_argument(\n        '-f', '--file',\n        action='store',\n        help='environment definition (default: environment.yml)',\n        default='environment.yml',\n    )\n    p.add_argument(\n        '--prune',\n        action='store_true',\n        default=False,\n        help='remove installed packages not defined in environment.yml',\n    )\n    p.add_argument(\n        '-q', '--quiet',\n        action='store_true',\n        default=False,\n    )\n    p.add_argument(\n        'remote_definition',\n        help='remote environment definition / IPython notebook',\n        action='store',\n        default=None,\n        nargs='?'\n    )\n    common.add_parser_json(p)\n    p.set_defaults(func=execute)\n\n\ndef execute(args, parser):\n    name = args.remote_definition or args.name\n\n    try:\n        spec = install_specs.detect(name=name, filename=args.file,\n                                    directory=os.getcwd())\n        env = spec.environment\n    except exceptions.SpecNotFound:\n        raise\n\n    if not args.name:\n        if not env.name:\n                    # Note, this is a hack fofr get_prefix that assumes argparse results\n            # TODO Refactor common.get_prefix\n            name = os.environ.get('CONDA_DEFAULT_ENV', False)\n            if not name:\n                msg = \"Unable to determine environment\\n\\n\"\n                msg += textwrap.dedent(\"\"\"\n                    Please re-run this command with one of the following options:\n\n                    * Provide an environment name via --name or -n\n                    * Re-run this command inside an activated conda environment.\"\"\").lstrip()\n                # TODO Add json support\n                raise CondaEnvException(msg)\n\n        # Note: stubbing out the args object as all of the\n        # conda.cli.common code thinks that name will always\n        # be specified.\n        args.name = env.name\n\n    prefix = get_prefix(args, search=False)\n    # CAN'T Check with this function since it assumes we will create prefix.\n    # cli_install.check_prefix(prefix, json=args.json)\n\n    # TODO, add capability\n    # common.ensure_override_channels_requires_channel(args)\n    # channel_urls = args.channel or ()\n\n    for installer_type, specs in env.dependencies.items():\n        try:\n            installer = get_installer(installer_type)\n            installer.install(prefix, specs, args, env, prune=args.prune)\n        except InvalidInstaller:\n            sys.stderr.write(textwrap.dedent(\"\"\"\n                Unable to install package for {0}.\n\n                Please double check and ensure you dependencies file has\n                the correct spelling.  You might also try installing the\n                conda-env-{0} package to see if provides the required\n                installer.\n                \"\"\").lstrip().format(installer_type)\n            )\n            return -1\n\n    touch_nonadmin(prefix)\n    if not args.json:\n        print(cli_install.print_activate(args.name if args.name else prefix))\n", "path": "conda_env/cli/main_update.py"}], "after_files": [{"content": "from argparse import RawDescriptionHelpFormatter\nimport os\nimport textwrap\nimport sys\n\nfrom conda import config\nfrom conda.cli import common\nfrom conda.cli import install as cli_install\nfrom conda.misc import touch_nonadmin\nfrom ..installers.base import get_installer, InvalidInstaller\nfrom .. import specs as install_specs\nfrom .. import exceptions\n# for conda env\nfrom conda_env.cli.common import get_prefix\nfrom ..exceptions import CondaEnvException\ndescription = \"\"\"\nUpdate the current environment based on environment file\n\"\"\"\n\nexample = \"\"\"\nexamples:\n    conda env update\n    conda env update -n=foo\n    conda env update -f=/path/to/environment.yml\n    conda env update --name=foo --file=environment.yml\n    conda env update vader/deathstar\n\"\"\"\n\n\ndef configure_parser(sub_parsers):\n    p = sub_parsers.add_parser(\n        'update',\n        formatter_class=RawDescriptionHelpFormatter,\n        description=description,\n        help=description,\n        epilog=example,\n    )\n    p.add_argument(\n        '-n', '--name',\n        action='store',\n        help='name of environment (in %s)' % os.pathsep.join(config.envs_dirs),\n        default=None,\n    )\n    p.add_argument(\n        '-f', '--file',\n        action='store',\n        help='environment definition (default: environment.yml)',\n        default='environment.yml',\n    )\n    p.add_argument(\n        '--prune',\n        action='store_true',\n        default=False,\n        help='remove installed packages not defined in environment.yml',\n    )\n    p.add_argument(\n        '-q', '--quiet',\n        action='store_true',\n        default=False,\n    )\n    p.add_argument(\n        'remote_definition',\n        help='remote environment definition / IPython notebook',\n        action='store',\n        default=None,\n        nargs='?'\n    )\n    common.add_parser_json(p)\n    p.set_defaults(func=execute)\n\n\ndef execute(args, parser):\n    name = args.remote_definition or args.name\n\n    try:\n        spec = install_specs.detect(name=name, filename=args.file,\n                                    directory=os.getcwd())\n        env = spec.environment\n    except exceptions.SpecNotFound:\n        raise\n\n    if not (args.name or args.prefix):\n        if not env.name:\n                    # Note, this is a hack fofr get_prefix that assumes argparse results\n            # TODO Refactor common.get_prefix\n            name = os.environ.get('CONDA_DEFAULT_ENV', False)\n            if not name:\n                msg = \"Unable to determine environment\\n\\n\"\n                msg += textwrap.dedent(\"\"\"\n                    Please re-run this command with one of the following options:\n\n                    * Provide an environment name via --name or -n\n                    * Re-run this command inside an activated conda environment.\"\"\").lstrip()\n                # TODO Add json support\n                raise CondaEnvException(msg)\n\n        # Note: stubbing out the args object as all of the\n        # conda.cli.common code thinks that name will always\n        # be specified.\n        args.name = env.name\n\n    prefix = get_prefix(args, search=False)\n    # CAN'T Check with this function since it assumes we will create prefix.\n    # cli_install.check_prefix(prefix, json=args.json)\n\n    # TODO, add capability\n    # common.ensure_override_channels_requires_channel(args)\n    # channel_urls = args.channel or ()\n\n    for installer_type, specs in env.dependencies.items():\n        try:\n            installer = get_installer(installer_type)\n            installer.install(prefix, specs, args, env, prune=args.prune)\n        except InvalidInstaller:\n            sys.stderr.write(textwrap.dedent(\"\"\"\n                Unable to install package for {0}.\n\n                Please double check and ensure you dependencies file has\n                the correct spelling.  You might also try installing the\n                conda-env-{0} package to see if provides the required\n                installer.\n                \"\"\").lstrip().format(installer_type)\n            )\n            return -1\n\n    touch_nonadmin(prefix)\n    if not args.json:\n        print(cli_install.print_activate(args.name if args.name else prefix))\n", "path": "conda_env/cli/main_update.py"}]}