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

acceptable-football-32760

03/11/2022, 2:38 PM
Hi! 👋 An semi-aesthetic semi-practical question: is the period-separated path (like
<http://some.path.to|some.path.to>.pex.binary
) under
dist/
configuarble to be
/
-separated instead? The practicality comes from the fact that we share bazel and pants repos in one codebase and it would be nice for use to refer to the results of the different builds using a unified way. Thank you!
f

fast-nail-55400

03/11/2022, 2:42 PM
Generally, targets that output into
dist/
have an
output_path
field to allow you to customize the name of the output.
👍 1
c

curved-television-6568

03/11/2022, 2:45 PM
That is per target, though, and you must provide the full path manually then. There’s currently no way to use
/
for the default generated output_path value: https://github.com/pantsbuild/pants/blob/79140750fa921bcc1d51722d2c161cc5236911bd/src/python/pants/core/goals/package.py#L63-L76 https://www.pantsbuild.org/docs/reference-pex_binary#codeoutput_pathcode
👍 1
f

flat-zoo-31952

03/11/2022, 4:21 PM
There's probably a way to use a new field or target and a union rule to write a plugin that changes this behavior for built-in goals like
package
h

hundreds-father-404

03/11/2022, 4:30 PM
Re the plugin suggestion, generally something like that could work but, here, I unfortunately don't think it would. Each
package
rule (e.g.
pex_binary
) hardcodes where to output the file, which is usually based on the
output_path
field @acceptable-football-32760 one idea is to add an option
[package].output_path_default_use_slashes
or something like that..I think we'd consider that. Although I'm hesitant because it's relatively niche and we try to think in general about "options fatigue". Wdyt?
w

witty-crayon-22786

03/11/2022, 5:42 PM
there are good reasons to use slash separated: filesystem name lengths, for one. so any option in this direction would actually make a good default at some point.
1
a

acceptable-football-32760

03/14/2022, 12:24 PM
Thanks a lot for the consideration! I admit it is indeed niche so I was thinking of making some emi-hacky plugin about it (along the lines of @flat-zoo-31952 s) suggestion
f

flat-zoo-31952

03/14/2022, 1:06 PM
It's not niche... I agree with @witty-crayon-22786 that slashes should probably be the default.
And if you're into hacks, you could probably just wrap your package call in bash:
Copy code
pants-package () {
  ./pants $@
  for f in dist/*.*; do
    if test -d $f; then
      mv $f $(echo $f | sed s:\\.:/:g)
    fi
  done
}