https://pantsbuild.org/ logo
p

polite-secretary-23285

02/15/2022, 4:57 PM
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

fast-nail-55400

02/15/2022, 5:02 PM
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

polite-secretary-23285

02/15/2022, 5:08 PM
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

happy-kitchen-89482

02/15/2022, 5:14 PM
Exactly
h

hundreds-father-404

02/15/2022, 5:14 PM
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

happy-kitchen-89482

02/15/2022, 5:14 PM
I can walk you through it if you want to submit a PR
Sorry for the inconvenience!
h

hundreds-father-404

02/15/2022, 5:15 PM
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

polite-secretary-23285

02/15/2022, 5:16 PM
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

fast-nail-55400

02/15/2022, 5:16 PM
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

hundreds-father-404

02/15/2022, 5:17 PM
@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

happy-kitchen-89482

02/15/2022, 5:20 PM
Let's discuss on an issue, as @polite-secretary-23285 suggests, so the conversation isn't lost in the Slack scrollback.
👍 1
p

polite-secretary-23285

02/15/2022, 5:21 PM
i copied some of the questions and suggestions made here into the ticket for prosperity
h

happy-kitchen-89482

02/15/2022, 9:32 PM
Thanks! I'll chime in over there
p

polite-secretary-23285

02/15/2022, 9:47 PM
just opened a a wip-PR. could need some pointers there tho 🙂
h

happy-kitchen-89482

02/24/2022, 11:47 PM
Ah just found this and added some comments. In future pinging here with a link will get a faster response 🙂
Hopefully, anyway
2 Views