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

curved-microphone-39455

01/11/2023, 4:12 PM
Hey there! Quick question concerning the Targets
resources
I would like to include all
*.html
in multiple projects. I am just not sure of the syntax to specify any folder under the project root Giving this structure • Project A ◦ Folder A ▪︎ file.html ◦ Folder B ▪︎ Folder B.1 • file.html ◦ BUILD Can I include only this in the BUILD at the root of every projects ?
Copy code
python_sources(
    dependencies=[":static-files"],
)

resources(
    name="static-files",
    sources=["**/*.html"]
)
Thanks in advance 🙂
r

refined-addition-53644

01/11/2023, 4:28 PM
This should work. Are you facing any issue?
c

curved-microphone-39455

01/11/2023, 4:29 PM
not yet, but did not test through all projects at the moment, I just want to confirm if this is a bad practice and if the syntax was good for the
**/*.ext
to find any sub-folders
I was using a
<http://MANIFEST.in|MANIFEST.in>
before
w

witty-crayon-22786

01/11/2023, 5:24 PM
that’s the right syntax, yea.
c

curved-microphone-39455

01/12/2023, 7:20 PM
Just tested today and it appears it works in most case, but during like unit testing, it fails to include some files. During the Test my error is
Copy code
61 - 2023-01-12 14:14:14 - App - ERROR - 12345 - Error While deploying def-d-public-12345 tpxxxbbjsxpkatmtnbsq <http://test.com:80> : [Errno 2] No such file or directory: '/tmp/pants-sandbox-AnckFc/src/libraries/infra/i
nterfaces/data/workload_create.json'
but at
/src/libraries/infra/BUILD
I have
Copy code
python_sources(
    dependencies=[":static-files"],
)

resources(
    name="static-files",
    sources=["**/*.json"]
)
w

witty-crayon-22786

01/12/2023, 7:26 PM
resources
are included as relative to the source root / PYTHONPATH
so
resources
will be loaded with source root (
./pants roots
) prefixes removed
files
are loaded as relative to the buildroot
4 Views