https://pantsbuild.org/ logo
#general
Title
# general
w

worried-painter-31382

01/19/2023, 4:10 PM
I have
Copy code
class PortableObjectSourceField(SingleSourceField):
    expected_file_extensions = ('.po',)
    default = 'messages.po'


class PortableObjectDependenciesField(Dependencies):
    pass


class PortableObjectTarget(Target):
    alias = "portable_object_file"
    core_fields = (
        PortableObjectSourceField,
        PortableObjectDependenciesField,
        *COMMON_TARGET_FIELDS,
    )
    help = "A gettext Portable Object file."


@dataclass(frozen=True)
class PortableObjectFileInferenceFieldSet(FieldSet):
    required_fields = (PortableObjectSourceField, PortableObjectDependenciesField)

    source: PortableObjectSourceField
    dependencies: PortableObjectDependenciesField


class InferPortableObjectDependencies(InferDependenciesRequest):
    infer_from = PortableObjectFileInferenceFieldSet

@rule
async def infer_markup_files_for_portable_object_file(
    request: InferPortableObjectDependencies,
) -> InferredDependencies:
    raise RuntimeError("Please Run")

    return InferredDependencies([])

def rules() -> Iterable[Rule]:
    return [*collect_rules(), UnionRule(InferDependenciesRequest, InferPortableObjectDependencies)]

def target_types() -> Iterable[type[Target]]:
    return [PortableObjectTarget]
what I get is
Copy code
[
  {
    "address": "translations/de/LC_MESSAGES:LC_MESSAGES",
    "target_type": "portable_object_file",
    "dependencies": [],
    "dependencies_raw": null,
    "description": null,
    "source_raw": "messages.po",
    "sources": [
      "translations/de/LC_MESSAGES/messages.po"
    ],
    "tags": null
  }
]
3 Views