-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
y2j 1.1.1 (new formula) #10927
y2j 1.1.1 (new formula) #10927
Conversation
Added new formula: y2j Uses python virtualenv to provide runtime dependency on PyYAML Uses optional dependency on docker for running on a system with only docker. Closes wildducktheories/y2j#4
stdin.write(yaml_test_input) | ||
stdin.close | ||
assert_equal expected_output, stdout.read | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pipe_output
instead:
assert_equal "{\n \"foo\": \"bar\"\n}", pipe_output("#{bin}/y2j", yaml_test_input)
python_resources = resources.map(&:name).to_set | ||
python_resources.each do |r| | ||
venv.pip_install resource(r) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can venv.pip_install resources
instead.
|
||
# Force our venv python for use with y2j | ||
inreplace buildpath/"y2j.sh", /^#!.*bash/, | ||
"#!/usr/bin/env bash\nexport PYTHONPATH=#{venv_site_packages_path}:$PYTHONPATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do so in the formula: ENV["PYTHONPATH"] = …
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this only affect the runtime of the brew install y2j
ruby script that is executed? What do you mean by "in the formula"? The need here was to ensure that the y2j.sh
script environment uses the homebrew managed python virtualenv. So my thought was: just force a shebang line & PYTHONPATH
variable set as a shim inside the y2j.sh
script to set it for this tool.
|
||
File.open("install_y2j.sh", "w") do |f| | ||
f.write(install_script) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use (buildpath/"install_y2j.sh").write install_script
.
chmod 0755, "./install_y2j.sh" | ||
system "./install_y2j.sh" | ||
|
||
bin.install "y2j.sh", "y2j", "j2y", "yq" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use #{bin}
for the install_script
so you can remove this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand what you mean on this one. It looked like #{bin}
just was an expansion of #{prefix}/bin
which would be the formula's bin
directory.
The problem here was that "install_y2j.sh
" placed these as symlinks to the main y2j.sh
script which lives in the upstream project's source repo as checked out by the install_y2j.sh
script. As such, the real bash script executable in this case is y2j.sh
which is going to be located under something like: /usr/local/Cellar/y2j/<version e.g.: 1.2.3>/y2j.sh
It was my understanding that the usage of bin.install
was meant for this use case. That is: placing & setting the execute bit for executables such that they are placed into the formula's bin
dir (e.g.: /usr/local/Cellar/y2j/<version e.g.: 1.2.3>/bin/
).
@trinitronx thanks for contributing, please consider following up on the review comments. |
Will be closing this one for now, as it seems inactive… please consider reopening once review comments are addressed. |
@fxcoudert: I can't seem to re-open this issue |
@bfontaine, @fxcoudert, @ahmetb : I've made the changes requested and added this to a new Pull Request #12532 because I'm unable to re-open this. |
y2j
Closes wildducktheories/y2j#4
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?