Skip to content

Commit

Permalink
Drop/deprecate 'auto' layer detection support
Browse files Browse the repository at this point in the history
- Remove 'auto' mode from ksconf package.
- Add warning about using 'auto' for combine.  (This has been around longer,
  and there wasn't a warning previously.  Honestly, this one may not be a big
  problem.  Lets issue a warning and see if there's any pushback.)
  • Loading branch information
lowell80 committed Oct 4, 2023
1 parent 1212583 commit 5ca9bd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
8 changes: 4 additions & 4 deletions ksconf/commands/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def f(pattern):
Use ``dir.d`` if you have directories like ``MyApp/default.d/##-layer-name``, or use
``disable`` to manage layers explicitly and avoid any accidental layer detection.
By default, ``auto`` mode will enable transparent switching between 'dir.d' and 'disable'
(legacy) behavior.
(legacy) behavior, however this option will be removed in a future release.
""")

parser.add_argument("-q", "--quiet", action="store_true",
Expand Down Expand Up @@ -252,9 +252,9 @@ def run(self, args):
args.source = list(expand_glob_list(args.source, do_sort=True))

if args.layer_method == "auto":
self.stderr.write(
"Warning: Automatically guessing an appropriate directory layer detection. "
"Consider using '--layer-method' to avoid this warning.\n")
from warnings import warn
warn("Using 'auto' layer detection will not be supported in future releases. "
"Consider using '--layer-method' to avoid this warning", DeprecationWarning)
if len(args.source) == 1:
layer_method = "dir.d"
else:
Expand Down
14 changes: 2 additions & 12 deletions ksconf/commands/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ def f(pattern):
"are specified, then all layers will be included.")

player.add_argument("--layer-method",
choices=["dir.d", "disable", "auto"],
choices=["dir.d", "disable"],
default="dir.d",
help="Set the layer type used by SOURCE. "
"Additional description provided in in the ``combine`` command."
"Note that 'auto' is no longer supported as of v0.10.")
"Additional description provided in in the ``combine`` command.")
player.add_argument("-I", "--include", action="append", default=[], dest="layer_filter",
type=wb_type("include"), metavar="PATTERN",
help="Name or pattern of layers to include.")
Expand Down Expand Up @@ -209,15 +208,6 @@ def run(self, args):
packager = AppPackager(args.source, app_name, output=self.stderr,
template_variables=template_vars)

if args.layer_method == "auto":
# There'd no way to make this option legal but not shown in argparse. :-(
# Yeah, all this needs *LOTS* of work!
self.stderr("The 'auto' option for layer_method is not longer supported. "
"This will be an error in v0.11 and removed in v0.12\n")
from ksconf import __version__
if __version__.startswith("0.11."):
return EXIT_CODE_CLI_ARG_DEPRECATED

with packager:
packager.combine(args.source, args.layer_filter,
layer_method=args.layer_method,
Expand Down

0 comments on commit 5ca9bd3

Please sign in to comment.