breezy-mouse-20493
05/29/2024, 12:08 AM├── interface
│ ├── BUILD
│ ├── interface.dtd
│ ├── interface.xml
│ └── xmlconvert.py
└── pants.toml
And the BUILD file:
python_source(
name="xml_convert_py",
source="xmlconvert.py",
)
files(name="interface_deps", sources=["interface.xml"])
adhoc_tool(
name="xmlconvert",
runnable=":xml_convert_py",
execution_dependencies=["interface.xml:interface_deps"],
output_files=[<tbd, need to fix the FileNotFoundError first>]
)
Running pants run interface:xml_convert_py
, I get a FileNotFoundError. The pants sandbox does not receive the interface.xml file. How can I solve this?breezy-mouse-20493
05/29/2024, 12:08 AMfast-nail-55400
05/29/2024, 1:01 AMresources
instead of files
for the interface.xml
file.fast-nail-55400
05/29/2024, 1:01 AMpython_source
target to the resources
target.fast-nail-55400
05/29/2024, 1:03 AMimportlib.resources
) to access it.fast-nail-55400
05/29/2024, 1:03 AMfiles
is not showing up in the sandbox.fast-nail-55400
05/29/2024, 1:04 AM--keep-sandboxes=on_failure
to preserve the sandbox and see what files actually made it in there.fast-nail-55400
05/29/2024, 1:04 AMbreezy-mouse-20493
05/29/2024, 2:43 AMresources
instead of files
for the interface.xml
file.
Resources looks good. The idea there is to turn this script into a module, perhaps running it with an entry point, and accessing that xml file as a package resource? I didn't think about this. Coming back to Pants after a few months' hiatus...breezy-mouse-20493
05/29/2024, 2:46 AMpreserve the sandbox and see what filesI've looked at this, the only file that made it in there is the
xmlconvert.py
file.
~> tree
.
├── interface
│ ├── __pycache__
│ │ └── xmlconvert.cpython-310.pyc
│ └── xmlconvert.py
├── __run.sh
├── xml_convert_py.pex
│ ├── __main__.py
│ ├── __pex__
│ │ └── __init__.py
│ └── PEX-INFO
├── xml_convert_py.pex_bin_python_shim.sh
└── xml_convert_py.pex_pex_shim.sh