forked from Mirror/pmbootstrap
args: remove dead code (MR 2349)
Remove a bunch of commented out code: * debug leftovers * update_work(): a function that used to replace $WORK in all kinds of arguments to pmbootstrap, with the actual work dir. This seemed like a good idea when I made this initially, but in hindsight it's clear that this made args just much more complex. I'm glad that Caleb removed this. Now $WORK only gets removed in one place, for mount points, which makes much more sense. * args.from_argparse and related comment: pmbootstrap used to make a full copy of its args, so in some cases it could go back before $WORK was replaced IIRC. This isn't great, but even worse is that this caused each stack trace to say something like infinite recursion on args. I'm also glad that Caleb got rid of this :)
This commit is contained in:
parent
0e62eaac67
commit
852b8d6c7d
2 changed files with 0 additions and 27 deletions
|
@ -131,32 +131,9 @@ def init(args: PmbArgs) -> PmbArgs:
|
||||||
if not key.startswith("_") and not key == "from_argparse":
|
if not key.startswith("_") and not key == "from_argparse":
|
||||||
setattr(__args, key, value)
|
setattr(__args, key, value)
|
||||||
|
|
||||||
# print(json.dumps(__args.__dict__))
|
|
||||||
|
|
||||||
# sys.exit(0)
|
|
||||||
|
|
||||||
return __args
|
return __args
|
||||||
|
|
||||||
|
|
||||||
# def update_work(args: PmbArgs, work):
|
|
||||||
# """Update the work path in args.work and wherever $WORK was used."""
|
|
||||||
# # Start with the unmodified args from argparse
|
|
||||||
# args_new = copy.deepcopy(args.from_argparse)
|
|
||||||
|
|
||||||
# # Keep from the modified args:
|
|
||||||
# # * the unmodified args from argparse (to check if --aports was specified)
|
|
||||||
# args_new.from_argparse = args.from_argparse
|
|
||||||
|
|
||||||
# # Generate modified args again, replacing $WORK with the new work folder
|
|
||||||
# # When args.log is different, this also opens the log in the new location
|
|
||||||
# args_new.work = work
|
|
||||||
# args_new = pmb.helpers.args.init(args_new)
|
|
||||||
|
|
||||||
# # Overwrite old attributes of args with the new attributes
|
|
||||||
# for key in vars(args_new):
|
|
||||||
# setattr(args, key, getattr(args_new, key))
|
|
||||||
|
|
||||||
|
|
||||||
def please_i_really_need_args() -> PmbArgs:
|
def please_i_really_need_args() -> PmbArgs:
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
|
@ -1277,12 +1277,8 @@ def get_parser():
|
||||||
|
|
||||||
|
|
||||||
def arguments():
|
def arguments():
|
||||||
# Parse and extend arguments (also backup unmodified result from argparse)
|
|
||||||
args: PmbArgs = get_parser().parse_args()
|
args: PmbArgs = get_parser().parse_args()
|
||||||
|
|
||||||
# setattr(args, "from_argparse", copy.deepcopy(args))
|
|
||||||
# setattr(args.from_argparse, "from_argparse", args.from_argparse)
|
|
||||||
|
|
||||||
if getattr(args, "fork_alpine_retain_branch", False):
|
if getattr(args, "fork_alpine_retain_branch", False):
|
||||||
# fork_alpine_retain_branch largely matches the behaviour of fork_alpine, so
|
# fork_alpine_retain_branch largely matches the behaviour of fork_alpine, so
|
||||||
# just set fork_alpine here to reduce repetition.
|
# just set fork_alpine here to reduce repetition.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue