From 961be891e5cff539e14f2050d5cd9e82845ce0f2 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Wed, 5 Jul 2023 14:23:37 -0600 Subject: [PATCH] Move output to stderr, pass debug through as an attr --- zapp/compiler/__main__.py | 8 ++++---- zapp/zapp.bzl | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/zapp/compiler/__main__.py b/zapp/compiler/__main__.py index 85770eb..add54b6 100644 --- a/zapp/compiler/__main__.py +++ b/zapp/compiler/__main__.py @@ -223,8 +223,8 @@ def rezip_wheels(opts, manifest): wf = str(wf) else: if opts.debug and False: - print("\n---") - json.dump({"$type": "whl", **w}, sys.stdout, indent=2) + print("\n---", file=sys.stderr) + json.dump({"$type": "whl", **w}, sys.stderr, indent=2) wf = zip_wheel(opts.tmpdir, w) @@ -336,7 +336,7 @@ def main(): manifest = insert_manifest_json(opts, manifest) if opts.debug: - print("\n---") + print("\n---", file=sys.stderr) json.dump( { "$type": "zapp", @@ -345,7 +345,7 @@ def main(): }, "manifest": manifest, }, - sys.stdout, + sys.stderr, indent=2, ) diff --git a/zapp/zapp.bzl b/zapp/zapp.bzl index c72491f..a898c56 100644 --- a/zapp/zapp.bzl +++ b/zapp/zapp.bzl @@ -142,12 +142,13 @@ def _zapp_impl(ctx): ) args = [ - "--debug", "-o", ctx.outputs.executable.path, manifest_file.path ] if ctx.attr.use_wheels: args = ["--use-wheels"] + args + if ctx.attr.debug: + args = ["--debug"] + args # Run compiler ctx.actions.run( @@ -183,6 +184,7 @@ _zapp_attrs = { "prelude_points": attr.string_list(), "zip_safe": attr.bool(default = True), "use_wheels": attr.bool(default = False), + "debug": attr.bool(default = False), # FIXME: These are really toolchain parameters, probably. "compiler": attr.label( default = Label(DEFAULT_COMPILER),