Is there a way to get a list of all files in a giv...
# general
p
Is there a way to get a list of all files in a given directory that are not python files and are not otherwise included as a dependency anywhere?
h
So files that are not in the
sources=
of a target, or files that are not depended on by any other target?
p
Files that are not in the
sources=
of any target (candidates for inclusion in
resources
or
files
targets)
h
Hmm
Not directly, but
./pants filedeps path/to/dir::
will show you all the files that are owned by any target
So you can do that and
ls
or
find
and subtract
👍 1
there is logic in
tailor
that could be adapted to do what you suggest
Trying to think how to generalize this into something useful
I'm guessing the use-case is to find those candidates, which is exactly what
tailor
is there for, it's just not been implemented for resources yet
h
That would be tricky to automatically determine whether something should be files vs resources (which is also very confusing for humans...one of our more confusing concepts)
c
Copy code
./pants orphans path/to/dir::
(suggested feature.. 😉 )
👍 1
h
Or ./pants tailor --orphans maybe
c
Isn’t the
tailor
goal about creating BUILD files? Just wondering how my neutrons are expected to connect a desire to list orphan files as a subcommand to that goal.. 🙂 (to me, feels like an implementation shortcut, knowing that the functionality to implement it is available there… but from a usability perspective it feels unintuitive)
hmm… maybe if presented together with a
--dry-run
to present which files would be addressed.. so
./pants tailor --dry-run --orphans
to me would mean to present BUILD files that would be created for which currently orphan files, and also include any files that would still be orphans, that didn’t have any target tailored for them.
p
That would be tricky to automatically determine whether something should be files vs resources (which is also very confusing for humans...one of our more confusing concepts)
I'm not asking to determine files vs resources automatically. The idea for
./pants orphans
is more like what I'm looking for: a list of files that are not included in any targets.
👍 1
h
Yeah, makes sense