Is it possible to build a `resources` out of a `re...
# general
s
Is it possible to build a
resources
out of a
relocated_files
? I've got a folder in
/library/stuff
with files I need in multiple projects. Can I relocate them into those projects with
relocated_files
then turn them into resources that will be packaged (at those new, relocated, paths)
h
Would they be packaged into wheels or pex files or...? How are they being loaded at runtime? If they are loaded as package resources then you might not need to relocate them. For example, if
library/stuff
is a source root, and you have a
resources()
target in it that globs over the relevant files, then any code that depends on that target can load
library/stuff/foo/bar.txt
as the resource
bar.txt
in the package
foo
(or the resource
foo/bar.txt
in the root package, I think that works).
h
Also see when I tried adding this in https://github.com/pantsbuild/pants/pull/11559. The PR died from being stale because of questions like the above, but it could be revived
s
Sorry for the late reply. Yes the services are getting packaged into pex files. Currently I'm porting existing code that tries to read them with
open
as they where just copied to a location on disk, though I'd like to change this and package everything properly, it shouldn't be too hard to get this to work with the files as package resources. Will the tests be able to also work with code that access these files via
pkg_resources
or are additional steps needed ?
Got this working, thanks for the help.
❤️ 1
💪 1