pantsbuild/scie-pants

PANTS_DEBUG causes unknown flags

felixkbb opened this issue · 1 comments

Upgrade scie launder to the latest and pants to 2.17.0.

Trying to use PANTS_DEBUG with command like PANTS_DEBUG=1 pants --no-pantsd export-codegen ::, but having the following error. If I replace the scie launcher with the legacy script, it works fine.

$ PANTS_DEBUG=1 pants --no-pantsd export-codegen ::
Unknown flag --listen on global scope
Did you mean --list-sep, --list-documented, or --isort-version?
Use `pants help` to get help.
Unknown flag --wait-for-client on global scope
Did you mean --test-force?
Use `pants help` to get help.
Exception caught: (pants.option.errors.UnknownFlagsError)
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/bin/pants", line 10, in <module>
    sys.exit(main())
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 112, in main
    PantsLoader.main()
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 108, in main
    cls.run_default_entrypoint()
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 91, in run_default_entrypoint
    exit_code = runner.run(start_time)
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 143, in run
    runner = LocalPantsRunner.create(
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 95, in create
    options = options_initializer.options(
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/init/options_initializer.py", line 123, in options
    return options_bootstrapper.full_options(build_config, union_membership)
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/option/options_bootstrapper.py", line 307, in full_options
    GlobalOptions.validate_instance(options.for_global_scope())
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/option/options.py", line 411, in for_global_scope
    return self.for_scope(GLOBAL_SCOPE)
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/util/memo.py", line 123, in memoize
    result = func(*args, **kwargs)
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/option/options.py", line 350, in for_scope
    values = self.get_parser(scope).parse_args(parse_args_request)
  File "/home/vagrant/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0-debugpy==1.6.0/lib/python3.9/site-packages/pants/option/parser.py", line 289, in parse_args
    raise UnknownFlagsError(tuple(flag_value_map.keys()), self.scope)

Exception message: Unknown flags --listen, --wait-for-client on global scope
NoneType: None
kaos commented

Thanks, when using scie-pants this starts pants with a DAP (debug adaptor protocol) server, waiting for a client to connect before proceeding.

However, there seems to have snuck in a bug in the lift manifest for this boot path:

# Run Pants Debug Mode
[[lift.commands]]
name = "pants-debug"
# No description because this command shouldn't render in the help output (it's invoked as
# appropriate by the default "Boot" one above)
# description = "Runs a hermetic Pants installation with a debug server for debugging Pants code."
exe = "{scie.bindings.install:VIRTUAL_ENV}/bin/pants"
args = [
"-c",
"""\
sys = __import__("sys")

Those args are for a python interpreter, not directly to pants which will be invoked from the inline script there.. so this seems to be broken.

Good find, thanks :)