happy-kitchen-89482
03/15/2020, 5:18 AMfiles()
target and a resources()
target?hundreds-father-404
03/15/2020, 9:58 AMwith open()
if you want to pass the whole path relative to the build roothappy-kitchen-89482
03/15/2020, 4:31 PMwitty-crayon-22786
03/15/2020, 5:14 PMwitty-crayon-22786
03/15/2020, 5:14 PMastonishing-jelly-60479
03/19/2020, 3:05 PMpython_binary
that depends on files
, are the files included in the PEX? or is that only if they're resources
?hundreds-father-404
03/19/2020, 3:28 PMfiles
witty-crayon-22786
03/19/2020, 4:56 PMwitty-crayon-22786
03/19/2020, 4:57 PMresources
are loaded the same way from a test vs in prodwitty-crayon-22786
03/19/2020, 4:58 PMfiles
(assuming some more investment)hundreds-father-404
03/19/2020, 5:00 PMHm... is that accurate?I believe so. We strip source roots for every target type except for
files()
. If you use resources()
, for example, then we convert src/python/f1.txt
into f1.txt
.
In Pants’ tests, this is how we get it working to be able to copy over the entire directory testsprojects/src/python/.../example
and then open that exact path in the test via with open()
, rather than having to think about what the path would be if we stripped testprojects/src/python
witty-crayon-22786
03/19/2020, 5:04 PMwitty-crayon-22786
03/19/2020, 5:04 PMwitty-crayon-22786
03/19/2020, 5:05 PMopen
relative to your cwd and etcwitty-crayon-22786
03/19/2020, 5:06 PMwitty-crayon-22786
03/19/2020, 5:06 PMwitty-crayon-22786
03/19/2020, 5:08 PMwitty-crayon-22786
03/19/2020, 5:09 PMfiles
target is relatively new, and not at all integrated with bundles
/ *_app
(a much older concept) although they probably should be.hundreds-father-404
03/19/2020, 5:11 PMhappy-kitchen-89482
03/19/2020, 7:02 PM__file__
to find them relative to yourself).