gentle-sugar-52379
11/22/2024, 6:26 AMvcs_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:
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
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?gentle-sugar-52379
11/23/2024, 12:09 PMcareful-address-89803
11/27/2024, 7:58 PMpackage
using the source root to automatically relocate the python sources, which run
does not do to preserve the feeling of running from the cwd.gentle-sugar-52379
11/29/2024, 6:46 PM