prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Deprecate the old 'pyomo' command syntax
  In earlier releases, we supported commands like
  `  pyomo --solver=glpk foo.py bar.dat`
  And we moved to a nested pyomo command, which uses the following syntax:
  `  pyomo solve --solver=glpk foo.py bar.dat`
  
  However, to enable graceful transition for users, we added a hack to transition to the old syntax if it looks like the user is not specifying a valid subcommand.  However, this leads to confusing error messages, and I think it's time to deprecate that hack and start throwing warnings that this hack will be removed in an upcoming release.
  
  </issue>
  <code>
  [start of pyomo/scripting/pyomo_main.py]
  1 #  ___________________________________________________________________________
  2 #
  3 #  Pyomo: Python Optimization Modeling Objects
  4 #  Copyright (c) 2008-2022
  5 #  National Technology and Engineering Solutions of Sandia, LLC
  6 #  Under the terms of Contract DE-NA0003525 with National Technology and
  7 #  Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
  8 #  rights in this software.
  9 #  This software is distributed under the 3-clause BSD License.
  10 #  ___________________________________________________________________________
  11 
  12 import sys
  13 import copy
  14 
  15 try:
  16     import pkg_resources
  17 
  18     pyomo_commands = pkg_resources.iter_entry_points('pyomo.command')
  19 except:
  20     pyomo_commands = []
  21 #
  22 # Load modules associated with Plugins that are defined in
  23 # EGG files.
  24 #
  25 for entrypoint in pyomo_commands:
  26     try:
  27         plugin_class = entrypoint.load()
  28     except Exception:
  29         exctype, err, tb = sys.exc_info()  # BUG?
  30         import traceback
  31 
  32         msg = (
  33             "Error loading pyomo.command entry point %s:\nOriginal %s: %s\n"
  34             "Traceback:\n%s"
  35             % (entrypoint, exctype.__name__, err, ''.join(traceback.format_tb(tb)))
  36         )
  37         # clear local variables to remove circular references
  38         exctype = err = tb = None
  39         # TODO: Should this just log an error and re-raise the original
  40         # exception?
  41         raise ImportError(msg)
  42 
  43 
  44 def main(args=None):
  45     #
  46     # Load subcommands
  47     #
  48     from pyomo.scripting import pyomo_parser
  49     import pyomo.environ
  50 
  51     #
  52     # Parse the arguments
  53     #
  54     parser = pyomo_parser.get_parser()
  55     if args is None:
  56         args = copy.copy(sys.argv[1:])
  57     #
  58     # This is a hack to convert a command-line to a 'solve' subcommand
  59     #
  60     if not args:
  61         args.append('-h')
  62     # FIXME: This should use the logger and not print()
  63     if args[0][0] == '-':
  64         if args[0] not in ['-h', '--help', '--version']:
  65             print("WARNING: converting to the 'pyomo solve' subcommand")
  66             args = ['solve'] + args[0:]
  67     elif args[0] not in pyomo_parser.subparsers:
  68         print("WARNING: converting to the 'pyomo solve' subcommand")
  69         args = ['solve'] + args[0:]
  70     #
  71     # Process arguments
  72     #
  73     _options, _unparsed = parser.parse_known_args(args)
  74     #
  75     # Process the results
  76     #
  77     if _options.func.__code__.co_argcount == 1:
  78         #
  79         # If the execution function only accepts one argument, then we
  80         # create an exception if there are unparsed arguments.
  81         #
  82         if len(_unparsed) > 0:
  83             #
  84             # Re-parse the command-line to create an exception
  85             #
  86             parser.parse_args(_unparsed)
  87         retval = _options.func(_options)
  88     else:
  89         retval = _options.func(_options, _unparsed)
  90     return retval
  91 
  92 
  93 def main_console_script():
  94     "This is the entry point for the main Pyomo script"
  95     # Note that we eat the retval data structure and only return the
  96     # process return code
  97     ans = main()
  98     try:
  99         return ans.errorcode
  100     except AttributeError:
  101         return ans
  102 
  103 
  104 if __name__ == '__main__':
  105     sys.exit(main_console_script())
  106
  [end of pyomo/scripting/pyomo_main.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/pyomo/scripting/pyomo_main.py b/pyomo/scripting/pyomo_main.py
  --- a/pyomo/scripting/pyomo_main.py
  +++ b/pyomo/scripting/pyomo_main.py
  @@ -11,6 +11,7 @@
   
   import sys
   import copy
  +from pyomo.common.deprecation import deprecation_warning
   
   try:
       import pkg_resources
  @@ -59,13 +60,16 @@
       #
       if not args:
           args.append('-h')
  -    # FIXME: This should use the logger and not print()
       if args[0][0] == '-':
           if args[0] not in ['-h', '--help', '--version']:
  -            print("WARNING: converting to the 'pyomo solve' subcommand")
  +            deprecation_warning("Running the 'pyomo' script with no subcommand is deprecated. "
  +                                "Defaulting to 'pyomo solve'",
  +                                version='TBD')
               args = ['solve'] + args[0:]
       elif args[0] not in pyomo_parser.subparsers:
  -        print("WARNING: converting to the 'pyomo solve' subcommand")
  +        deprecation_warning("Running the 'pyomo' script with no subcommand is deprecated. "
  +                            "Defaulting to 'pyomo solve'",
  +                            version='TBD')
           args = ['solve'] + args[0:]
       #
       # Process arguments
  
verification_info: {"golden_diff": "diff --git a/pyomo/scripting/pyomo_main.py b/pyomo/scripting/pyomo_main.py\n--- a/pyomo/scripting/pyomo_main.py\n+++ b/pyomo/scripting/pyomo_main.py\n@@ -11,6 +11,7 @@\n \n import sys\n import copy\n+from pyomo.common.deprecation import deprecation_warning\n \n try:\n     import pkg_resources\n@@ -59,13 +60,16 @@\n     #\n     if not args:\n         args.append('-h')\n-    # FIXME: This should use the logger and not print()\n     if args[0][0] == '-':\n         if args[0] not in ['-h', '--help', '--version']:\n-            print(\"WARNING: converting to the 'pyomo solve' subcommand\")\n+            deprecation_warning(\"Running the 'pyomo' script with no subcommand is deprecated. \"\n+                                \"Defaulting to 'pyomo solve'\",\n+                                version='TBD')\n             args = ['solve'] + args[0:]\n     elif args[0] not in pyomo_parser.subparsers:\n-        print(\"WARNING: converting to the 'pyomo solve' subcommand\")\n+        deprecation_warning(\"Running the 'pyomo' script with no subcommand is deprecated. \"\n+                            \"Defaulting to 'pyomo solve'\",\n+                            version='TBD')\n         args = ['solve'] + args[0:]\n     #\n     # Process arguments\n", "issue": "Deprecate the old 'pyomo' command syntax\nIn earlier releases, we supported commands like\r\n`  pyomo --solver=glpk foo.py bar.dat`\r\nAnd we moved to a nested pyomo command, which uses the following syntax:\r\n`  pyomo solve --solver=glpk foo.py bar.dat`\r\n\r\nHowever, to enable graceful transition for users, we added a hack to transition to the old syntax if it looks like the user is not specifying a valid subcommand.  However, this leads to confusing error messages, and I think it's time to deprecate that hack and start throwing warnings that this hack will be removed in an upcoming release.\n", "before_files": [{"content": "#  ___________________________________________________________________________\n#\n#  Pyomo: Python Optimization Modeling Objects\n#  Copyright (c) 2008-2022\n#  National Technology and Engineering Solutions of Sandia, LLC\n#  Under the terms of Contract DE-NA0003525 with National Technology and\n#  Engineering Solutions of Sandia, LLC, the U.S. Government retains certain\n#  rights in this software.\n#  This software is distributed under the 3-clause BSD License.\n#  ___________________________________________________________________________\n\nimport sys\nimport copy\n\ntry:\n    import pkg_resources\n\n    pyomo_commands = pkg_resources.iter_entry_points('pyomo.command')\nexcept:\n    pyomo_commands = []\n#\n# Load modules associated with Plugins that are defined in\n# EGG files.\n#\nfor entrypoint in pyomo_commands:\n    try:\n        plugin_class = entrypoint.load()\n    except Exception:\n        exctype, err, tb = sys.exc_info()  # BUG?\n        import traceback\n\n        msg = (\n            \"Error loading pyomo.command entry point %s:\\nOriginal %s: %s\\n\"\n            \"Traceback:\\n%s\"\n            % (entrypoint, exctype.__name__, err, ''.join(traceback.format_tb(tb)))\n        )\n        # clear local variables to remove circular references\n        exctype = err = tb = None\n        # TODO: Should this just log an error and re-raise the original\n        # exception?\n        raise ImportError(msg)\n\n\ndef main(args=None):\n    #\n    # Load subcommands\n    #\n    from pyomo.scripting import pyomo_parser\n    import pyomo.environ\n\n    #\n    # Parse the arguments\n    #\n    parser = pyomo_parser.get_parser()\n    if args is None:\n        args = copy.copy(sys.argv[1:])\n    #\n    # This is a hack to convert a command-line to a 'solve' subcommand\n    #\n    if not args:\n        args.append('-h')\n    # FIXME: This should use the logger and not print()\n    if args[0][0] == '-':\n        if args[0] not in ['-h', '--help', '--version']:\n            print(\"WARNING: converting to the 'pyomo solve' subcommand\")\n            args = ['solve'] + args[0:]\n    elif args[0] not in pyomo_parser.subparsers:\n        print(\"WARNING: converting to the 'pyomo solve' subcommand\")\n        args = ['solve'] + args[0:]\n    #\n    # Process arguments\n    #\n    _options, _unparsed = parser.parse_known_args(args)\n    #\n    # Process the results\n    #\n    if _options.func.__code__.co_argcount == 1:\n        #\n        # If the execution function only accepts one argument, then we\n        # create an exception if there are unparsed arguments.\n        #\n        if len(_unparsed) > 0:\n            #\n            # Re-parse the command-line to create an exception\n            #\n            parser.parse_args(_unparsed)\n        retval = _options.func(_options)\n    else:\n        retval = _options.func(_options, _unparsed)\n    return retval\n\n\ndef main_console_script():\n    \"This is the entry point for the main Pyomo script\"\n    # Note that we eat the retval data structure and only return the\n    # process return code\n    ans = main()\n    try:\n        return ans.errorcode\n    except AttributeError:\n        return ans\n\n\nif __name__ == '__main__':\n    sys.exit(main_console_script())\n", "path": "pyomo/scripting/pyomo_main.py"}]}