i have 2 targets: a python_source and a pex_binary...
# general
g
i have 2 targets: a python_source and a pex_binary target. in the pex_binary my generated files are available (and after extracting they are in fact there) with my python_source target they are missing
Copy code
vcs_version(
    name="version",
    generate_to="src/python/marla/version.py",
    template='version = "{version}"',
)

python_sources(
    name="src_prod",
    dependencies=[
        "./app",
        "./base",
        "./css",
        "./responsive_image",
        "src/python/tuhls/core",
        "src/python/tuhls/dashboard",
        "src/python/tuhls/icons",
    ],
)

python_sources(
    name="src_dev",
    dependencies=[
        ":src_prod",
        "3rdparty/python:reqs#django-extensions",
        "3rdparty/python:reqs#Werkzeug",
    ],
)

python_source(
    name="manage_dev",
    dependencies=[":src_dev"],
    restartable=True,
    source="manage.py",
)

pex_binary(
    name="manage_dev_pex",
    dependencies=[":src_dev"],
    entry_point="manage.py",
    restartable=True,
)
the files get generated in the ./css dependency:
Copy code
tailwind(
    template_folders=["src/python/marla/app/templates",],
    src="./src/python/marla/css",
    dest="./marla/app/static",
)
i have to relocate the file not to ./src/python/marla/app/static but instead to ./marla/app/static because of this bug: https://github.com/pantsbuild/pants/issues/21444 and the src/python doesnt get stripped which is the following macro
Copy code
def tailwind(template_folders, src, dest):
    files(
        name="tw_inputs",
        sources=[
            "main.scss",
            "tailwind.config.js",
        ],
    )

    files(
        name="package_json",
        sources=[
            "package.json",
        ],
    )

    system_binary(
        name="node",
        binary_name="node",
        fingerprint=r"v(19|[2-9][0-9])\..*\..*",
        fingerprint_args=["--version"],
    )

    system_binary(
        name="yarn",
        binary_name="yarn",
        fingerprint=r"1\.([2-9][0-9]|[1-9][0-9][0-9])\..*",
        fingerprint_args=["--version"],
        fingerprint_dependencies=[":node"],
    )

    adhoc_tool(
        name="node_modules",
        runnable=":yarn",
        runnable_dependencies=[":node"],
        args=["install", "--immutable"],
        output_dependencies=[":package_json"],
        execution_dependencies=[":package_json"],
        output_directories=["node_modules"],
        timeout=300,
    )

    adhoc_tool(
        name="build_tailwind",
        runnable=":yarn",
        runnable_dependencies=[":node"],
        args=[
            "tailwindcss",
            "-i",
            "main.scss",
            "-o",
            "main.css",
            "-c",
            "tailwind.config.js",
            "-m",
        ],
        execution_dependencies=[
            ":tw_inputs",
            ":node_modules",
        ] + template_folders,
        output_dependencies=[
            ":tw_inputs",
            ":node_modules",
        ] + template_folders,
        output_files=["*.css"],
        timeout=300,
    )

    relocated_files(
        name="relocated_output",
        src=src,
        dest=dest,
        files_targets=[":build_tailwind"],
    )

    experimental_wrap_as_resources(
        inputs=[":relocated_output"],
        outputs=["**/*.css"],
    )
i've tried to relocate to the "right" destination while trying the python source target, but with no success. what else could i try? am i right with my thinking that both targets should work the same?
i've build a minimal working example repo and filed a bug report: https://github.com/pantsbuild/pants/issues/21688
c
heya, I commented on the issue. TLDR: this is due to
package
using the source root to automatically relocate the python sources, which
run
does not do to preserve the feeling of running from the cwd.
❤️ 1
g
thanks for your comment. i will try to reproduce it and i have to think about it, what it implies and who am i to judge, if its an error? 😄