Skip to content

Commit

Permalink
fix(rules): drop the unused argument (bazelbuild#1953)
Browse files Browse the repository at this point in the history
It seems that there is an extra argument that is there but I am not sure
about
the reason, it is most likely a leftover. As part of this change we add
an
analysis test for non-windows zip building. I could reproduce the
failure and
now the newly added test passes.

Fixes bazelbuild#1954
  • Loading branch information
aignas authored and rickeylev committed Jun 13, 2024
1 parent e682cd0 commit 026edb7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
10 changes: 5 additions & 5 deletions python/config_settings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,39 @@ string_flag(
name = "precompile",
build_setting_default = PrecompileFlag.AUTO,
values = sorted(PrecompileFlag.__members__.values()),
# NOTE: Only public because its an implicit dependency
# NOTE: Only public because it's an implicit dependency
visibility = ["//visibility:public"],
)

string_flag(
name = "precompile_source_retention",
build_setting_default = PrecompileSourceRetentionFlag.KEEP_SOURCE,
values = sorted(PrecompileSourceRetentionFlag.__members__.values()),
# NOTE: Only public because its an implicit dependency
# NOTE: Only public because it's an implicit dependency
visibility = ["//visibility:public"],
)

string_flag(
name = "precompile_add_to_runfiles",
build_setting_default = PrecompileAddToRunfilesFlag.ALWAYS,
values = sorted(PrecompileAddToRunfilesFlag.__members__.values()),
# NOTE: Only public because its an implicit dependency
# NOTE: Only public because it's an implicit dependency
visibility = ["//visibility:public"],
)

string_flag(
name = "pyc_collection",
build_setting_default = PycCollectionFlag.DISABLED,
values = sorted(PycCollectionFlag.__members__.values()),
# NOTE: Only public because its an implicit dependency
# NOTE: Only public because it's an implicit dependency
visibility = ["//visibility:public"],
)

string_flag(
name = "bootstrap_impl",
build_setting_default = BootstrapImplFlag.SYSTEM_PYTHON,
values = sorted(BootstrapImplFlag.__members__.values()),
# NOTE: Only public because its an implicit dependency
# NOTE: Only public because it's an implicit dependency
visibility = ["//visibility:public"],
)

Expand Down
1 change: 1 addition & 0 deletions python/private/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ bzl_library(
"//python/private:enum_bzl",
"//python/private:flags_bzl",
"//python/private:reexports_bzl",
"//python/private:rules_cc_srcs_bzl",
"@bazel_skylib//rules:common_settings",
],
)
Expand Down
26 changes: 15 additions & 11 deletions python/private/common/py_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ def py_library_impl(ctx, *, semantics):
create_output_group_info(py_info.transitive_sources, extra_groups = {}),
]

_DEFAULT_PY_LIBRARY_DOC = """
A library of Python code that can be depended upon.
Default outputs:
* The input Python sources
* The precompiled artifacts from the sources.
NOTE: Precompilation affects which of the default outputs are included in the
resulting runfiles. See the precompile-related attributes and flags for
more information.
"""

def create_py_library_rule(*, attrs = {}, **kwargs):
"""Creates a py_library rule.
Expand All @@ -111,6 +123,9 @@ def create_py_library_rule(*, attrs = {}, **kwargs):
Returns:
A rule object
"""

# Within Google, the doc attribute is overridden
kwargs.setdefault("doc", _DEFAULT_PY_LIBRARY_DOC)
return rule(
attrs = dicts.add(LIBRARY_ATTRS, attrs),
toolchains = [
Expand All @@ -120,16 +135,5 @@ def create_py_library_rule(*, attrs = {}, **kwargs):
# TODO(b/253818097): fragments=py is only necessary so that
# RequiredConfigFragmentsTest passes
fragments = ["py"],
doc = """
A library of Python code that can be depended upon.
Default outputs:
* The input Python sources
* The precompiled artifacts from the sources.
NOTE: Precompilation affects which of the default outputs are included in the
resulting runfiles. See the precompile-related attributes and flags for
more information.
""",
**kwargs
)

0 comments on commit 026edb7

Please sign in to comment.