MCPcopy Create free account
hub / github.com/Drakkar-Software/OctoBot / setup_kwargs_plugin

Function setup_kwargs_plugin

pants-plugins/python_plugins/register.py:30–53  ·  view source on GitHub ↗
(request: PantsSetupKwargsRequest)

Source from the content-addressed store, hash-verified

28
29@rule
30async def setup_kwargs_plugin(request: PantsSetupKwargsRequest) -> SetupKwargs:
31 original_kwargs = request.explicit_kwargs.copy()
32 long_description_relpath = original_kwargs.pop("long_description_file", None)
33 if not long_description_relpath:
34 raise ValueError(
35 f"The python_distribution target {request.target.address} did not include "
36 "`long_description_file` in its python_artifact's kwargs. Our plugin requires this! "
37 "Please set to a path relative to the BUILD file, e.g. `README.md`."
38 )
39
40 build_file_path = request.target.address.spec_path
41 long_description_path = os.path.join(build_file_path, long_description_relpath)
42 digest_contents = await get_digest_contents(
43 **implicitly(PathGlobs(
44 [long_description_path],
45 description_of_origin=f"the 'long_description_file' kwarg in {request.target.address}",
46 glob_match_error_behavior=GlobMatchErrorBehavior.error,
47 ))
48 )
49 description_content = digest_contents[0].content.decode()
50 return SetupKwargs(
51 {**original_kwargs, "long_description": description_content},
52 address=request.target.address
53 )
54
55
56class InstallDepsSubsystem(GoalSubsystem):

Callers

nothing calls this directly

Calls 2

copyMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected