hello pants. I've been trying to follow the `Incre...
# general
p
hello pants. I've been trying to follow the
Incremental Adoption
-section in the documentation but got stuck at running
./pants count-loc '**'
. it fails with: BinaryNotFoundError: Cannot find
unzip
on
['/bin', '/usr/bin', '/usr/local/bin']
I'm on NixOS and unzip is indeed not located in any of those paths (by design), but it's available through
$PATH
. any hints?
f
The search paths for those are not currently configurable. There;s even a TODO about it: https://github.com/pantsbuild/pants/blob/ee137851e2f0609210fd629c98615edd3da1d8fe/src/python/pants/core/util_rules/archive.py#L39-L40
p
so solving that TODO in a PR would solve my issue, because i could define where it is supposed to look for the binaries ?
h
Exactly
h
Yes, exactly. For example, we let you control where to look for other binaries like Docker: https://www.pantsbuild.org/v2.10/docs/reference-docker#section-executable-search-paths A PR would be very very welcome! It shouldn't be too tricky of code. It would look like this: https://github.com/pantsbuild/pants/pull/14360 The hardest part of the change is figuring out what the option should be called and what subsystem it belongs to
h
I can walk you through it if you want to submit a PR
Sorry for the inconvenience!
h
The hardest part of the change is figuring out what the option should be called and what subsystem it belongs to
Benjy any thoughts? My intuition is to add to
[GLOBAL]
because this is used to find core binaries? But ugh that scope is already huge
p
thanks for the pointers. I'll try to find some time to send a PR your way 🙂
I'll create an issue first so that discussion and opinions (that you're already raising) doesnt get lost, if that's ok with you
🙌 2
f
yes, this would actually be pretty straight-forward to do: 1. Define a
Subsystem
subclass with the option to use to specify the search path. Example in https://github.com/pantsbuild/pants/blob/e475d56d5ea149ffeb9fb0d4e316df6aeafd11ec/src/python/pants/backend/go/subsystems/golang.py#L65-L75. 2. Update
find_unzip
and related functions to take the new
Subsystem
as an argument. 3. Use the function defined on the `Subsystem`to be similar to
go_search_paths
in place of the
SEARCH_PATHS
constant.
h
@polite-secretary-23285 would you rather have a dedicated option per binary? (
unzip
,
zip
,
tar
). It's probably less boilerplate to have a single option for all 3 binaries, but I'm curious as a Nix user if you would want tighter control?
h
Let's discuss on an issue, as @polite-secretary-23285 suggests, so the conversation isn't lost in the Slack scrollback.
👍 1
p
i copied some of the questions and suggestions made here into the ticket for prosperity
h
Thanks! I'll chime in over there
p
just opened a a wip-PR. could need some pointers there tho 🙂
h
Ah just found this and added some comments. In future pinging here with a link will get a faster response 🙂
Hopefully, anyway