https://pantsbuild.org/ logo
#general
Title
# general
p

proud-dentist-22844

04/12/2021, 2:59 AM
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

happy-kitchen-89482

04/12/2021, 3:12 AM
So files that are not in the
sources=
of a target, or files that are not depended on by any other target?
p

proud-dentist-22844

04/12/2021, 3:41 AM
Files that are not in the
sources=
of any target (candidates for inclusion in
resources
or
files
targets)
h

happy-kitchen-89482

04/12/2021, 4:35 AM
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

hundreds-father-404

04/12/2021, 6:04 AM
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

curved-television-6568

04/12/2021, 7:26 AM
Copy code
./pants orphans path/to/dir::
(suggested feature.. 😉 )
👍 1
h

hundreds-father-404

04/12/2021, 7:46 AM
Or ./pants tailor --orphans maybe
c

curved-television-6568

04/12/2021, 7:55 AM
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

proud-dentist-22844

04/12/2021, 12:11 PM
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

happy-kitchen-89482

04/12/2021, 3:46 PM
Yeah, makes sense
2 Views