GithubHelp home page GithubHelp logo

Comments (4)

MikeMcQuaid avatar MikeMcQuaid commented on September 25, 2024

Thanks for the issue!

This API seems reasonable although unclear if it would be a major improvement over just ENV["whatever"] = "something" in the formula itself.

Do you have any homebrew/core formulae that would need this?

from brew.

jasonkarns avatar jasonkarns commented on September 25, 2024

This API seems reasonable although unclear if it would be a major improvement over just ENV["whatever"] = "something" in the formula itself.

I didn't even think of that! Hrm, the simplicity of that might be enough to not bother with changing the completion-helper api.

One downside is the "blast radius" of the ENV= approach extends beyond only the completion command. But in practice, I assume that helper is typically invoked at the very end of install anyway, so it's probably fine. (Though I'm not certain how much stuff homebrew does after #install is invoked that could be affected. It might be weird if #post_install operates in an environment mutated elsewhere?)

Do you have any homebrew/core formulae that would need this?
The only two formulae I ran into are both private taps. Though I haven't looked in core for other potential candidates.

Honestly, I think I'm satisfied to close this and just set ENV as you suggested. I'll try that in our taps and circle back.

from brew.

cho-m avatar cho-m commented on September 25, 2024

One downside is the "blast radius" of the ENV= approach extends beyond only the completion command.

There is also with_env, e.g.

with_env(VAR1: ..., VAR2: ...) do
  generate_completions_from_executable(...)
end

Though I'm not certain how much stuff homebrew does after #install is invoked that could be affected.

Should be pretty much nothing. Specifically, looks like just writing metadata files which shouldn't have a major impact by ENV modification (EDIT: you can get the tab to recording a different ENV.compiler, but that isn't normal usage).

formula.install
stdlibs = detect_stdlibs
tab = Tab.create(formula, ENV.compiler, stdlibs.first)
tab.write
# Find and link metafiles
formula.prefix.install_metafiles formula.buildpath
formula.prefix.install_metafiles formula.libexec if formula.libexec.exist?

from brew.

jasonkarns avatar jasonkarns commented on September 25, 2024

@cho-m oh yeah, that's perfect.

Closing in favor of 'with_env'. thank you both!

from brew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.