Skip to content

Commit

Permalink
buck/python: materialize __manifest__
Browse files Browse the repository at this point in the history
Summary:
`__manifest__.py` and `__manifest__.json` were not declared as `other_outputs` for inplace builds.
This diff fixes that.

Reviewed By: IanChilds

Differential Revision: D67276154

fbshipit-source-id: bfe2e120bf6684f0eacd8bf60f91a984183ba5cd
  • Loading branch information
zsol authored and facebook-github-bot committed Dec 16, 2024
1 parent 7874f05 commit 27ee7ff
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions python/make_py_package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ PexProviders = record(
run_cmd = cmd_args,
)

ManifestModule = record(
manifest = ArgLike,
artifacts = list[ArgLike],
)

def make_py_package_providers(
pex: PexProviders) -> list[Provider]:
providers = [
Expand Down Expand Up @@ -282,7 +287,7 @@ def _make_py_package_impl(
dep_artifacts: list[ArgLike],
debug_artifacts: list[(str | (str, SharedLibrary, str), ArgLike)],
main: EntryPoint,
manifest_module: ArgLike | None,
manifest_module: ManifestModule | None,
pex_modules: PexModules,
output_suffix: str,
allow_cache_upload: bool) -> PexProviders:
Expand Down Expand Up @@ -327,6 +332,8 @@ def _make_py_package_impl(
runtime_artifacts.extend([a[0] for a in pex_modules.manifests.resource_artifacts_with_paths(standalone)])
if pex_modules.compile:
runtime_artifacts.extend([a[0] for a in pex_modules.manifests.bytecode_artifacts_with_paths(pyc_mode)])
if manifest_module:
runtime_artifacts.extend(manifest_module.artifacts)

modules_args = _pex_modules_args(
ctx,
Expand Down Expand Up @@ -637,7 +644,7 @@ def _pex_modules_args(
is_standalone: bool,
pyc_mode: PycInvalidationMode,
symlink_tree_path: Artifact | None,
manifest_module: ArgLike | None,
manifest_module: ManifestModule | None,
pex_modules: PexModules,
output_suffix: str) -> cmd_args:
"""
Expand All @@ -651,7 +658,7 @@ def _pex_modules_args(
cmd.append(common_args)

if manifest_module != None:
cmd.append(cmd_args(manifest_module, format = "--module-manifest={}"))
cmd.append(cmd_args(manifest_module.manifest, format = "--module-manifest={}"))

if pex_modules.compile:
bytecode_manifests = pex_modules.manifests.bytecode_manifests(pyc_mode)
Expand Down Expand Up @@ -834,7 +841,7 @@ def generate_manifest_module(
ctx: AnalysisContext,
manifest_module_entries: dict[str, typing.Any] | None,
python_toolchain: PythonToolchainInfo,
src_manifests: list[ArgLike]) -> ArgLike | None:
src_manifests: list[ArgLike]) -> ManifestModule | None:
"""
Generates a __manifest__.py module, and an extra entry to add to source manifests.
Expand Down Expand Up @@ -871,4 +878,4 @@ def generate_manifest_module(
with_inputs = True,
)

return src_manifest
return ManifestModule(manifest = src_manifest, artifacts = [json_entries_output, module])

0 comments on commit 27ee7ff

Please sign in to comment.