Skip to content

Commit 01d25ad

Browse files
aignasewianda
authored andcommitted
refactor(pypi): translate wheel METADATA parsing to starlark (bazel-contrib#2629)
This PR starts using the newly introduced (bazel-contrib#2692) PEP508 compliant requirement marker parser in starlark and moves the dependency generation from the Python language (`whl_installer`) to the Starlark in the `whl_library` repository rule. This PR is (almost) a pure refactor where no bugs are fixed, but this is foundational work that also adds notes on how things will be moved to macros (i.e. analysis phase) so that we can fix a few long standing bugs and prepare for stabilizing the `experimental_index_url` (bazel-contrib#260). Refactor: * I have migrated all of the unit tests from Python to starlark for deps generation from METADATA `Requires-Dist` fields. * Read the `METADATA` file itself in Starlark. Work towards bazel-contrib#260, bazel-contrib#2319, bazel-contrib#2241 Fixes bazel-contrib#2423 fix(toolchain) Override coverage rc
1 parent da95314 commit 01d25ad

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

Diff for: python/private/stage2_bootstrap_template.py

+13-14
Original file line numberDiff line numberDiff line change
@@ -309,29 +309,28 @@ def _maybe_collect_coverage(enable):
309309
relative_files = True
310310
source =
311311
\t{source}
312+
omit =
313+
# Pipes can't be read back later, which can cause coverage to
314+
# throw an error when trying to get its source code.
315+
/dev/fd/*
316+
# The mechanism for finding third-party packages in coverage-py
317+
# only works for installed packages, not for runfiles. e.g:
318+
#'$HOME/.local/lib/python3.10/site-packages',
319+
# '/usr/lib/python',
320+
# '/usr/lib/python3.10/site-packages',
321+
# '/usr/local/lib/python3.10/dist-packages'
322+
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
323+
*/external/*
312324
"""
313325
)
314326
try:
315327
cov = coverage.Coverage(
316-
config_file=rcfile_name,
328+
config_file=os.environ.get("COVERAGE_RCFILE", rcfile_name),
317329
branch=True,
318330
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
319331
# which can interfere with the Bazel coverage command. Enabling message
320332
# output is only useful for debugging coverage support.
321333
messages=is_verbose_coverage(),
322-
omit=[
323-
# Pipes can't be read back later, which can cause coverage to
324-
# throw an error when trying to get its source code.
325-
"/dev/fd/*",
326-
# The mechanism for finding third-party packages in coverage-py
327-
# only works for installed packages, not for runfiles. e.g:
328-
#'$HOME/.local/lib/python3.10/site-packages',
329-
# '/usr/lib/python',
330-
# '/usr/lib/python3.10/site-packages',
331-
# '/usr/local/lib/python3.10/dist-packages'
332-
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
333-
"*/external/*",
334-
],
335334
)
336335
cov.start()
337336
try:

0 commit comments

Comments
 (0)