Skip to content

Fix debug logging in release #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions py/private/py_venv/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

package(default_visibility = [
"//docs:__pkg__",
Expand All @@ -10,10 +11,15 @@ exports_files([
"link.py",
])

bool_flag(
name = "debug_venv",
build_setting_default = False,
)

config_setting(
name = "debug_build",
values = {
"compilation_mode": "dbg",
name = "debug_venv_setting",
flag_values = {
":debug_venv": "True",
},
)

Expand Down
3 changes: 1 addition & 2 deletions py/private/py_venv/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@


if __name__ == "__main__":
PARSER.print_help(sys.stdout)
opts = PARSER.parse_args()
dest = Path(os.path.join(opts.dest, opts.name))
print("""
Expand All @@ -59,7 +58,7 @@
dest.unlink()
except FileNotFoundError:
pass

# From -> to
dest.symlink_to(virtualenv_home, target_is_directory=True)
print("Link created!")
Expand Down
4 changes: 2 additions & 2 deletions py/private/py_venv/py_venv.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ _py_venv = rule(

def _wrap_with_debug(rule):
def helper(**kwargs):
kwargs["debug"] = select({Label(":debug_build"): True, "//conditions:default": False})
kwargs["debug"] = select({Label(":debug_venv_setting"): True, "//conditions:default": False})
return rule(**kwargs)

return helper
Expand Down Expand Up @@ -383,7 +383,7 @@ def py_venv_link(venv_name = None, **kwargs):

# Note that the binary is already wrapped with debug
link_script = str(Label("//py/private/py_venv:link.py"))
kwargs["debug"] = select({Label(":debug_build"): True, "//conditions:default": False})
kwargs["debug"] = select({Label(":debug_venv_setting"): True, "//conditions:default": False})
py_venv_binary(
args = [] + (["--venv-name=" + venv_name] if venv_name else []),
main = link_script,
Expand Down
Loading