Hey there! Quick question concerning the Targets `...
# general
c
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
This should work. Are you facing any issue?
c
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
that’s the right syntax, yea.
c
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
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