Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

trinitronx
Copy link
Contributor

  • 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

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

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
@bfontaine bfontaine added the new formula PR adds a new formula to Homebrew/homebrew-core label Mar 12, 2017
stdin.write(yaml_test_input)
stdin.close
assert_equal expected_output, stdout.read
end
Copy link
Contributor

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
Copy link
Contributor

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"
Copy link
Contributor

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"] = ….

Copy link
Contributor Author

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
Copy link
Contributor

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"
Copy link
Contributor

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.

Copy link
Contributor Author

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/).

@dunn dunn added the needs response Needs a response from the issue/PR author label Mar 15, 2017
@ahmetb
Copy link
Contributor

ahmetb commented Mar 28, 2017

@trinitronx thanks for contributing, please consider following up on the review comments.

@BrewTestBot BrewTestBot removed the needs response Needs a response from the issue/PR author label Mar 28, 2017
@bfontaine bfontaine added the needs response Needs a response from the issue/PR author label Mar 28, 2017
@dunn dunn added the python Python use is a significant feature of the PR or issue label Apr 1, 2017
@fxcoudert
Copy link
Member

Will be closing this one for now, as it seems inactive… please consider reopening once review comments are addressed.

@fxcoudert fxcoudert closed this Apr 8, 2017
@BrewTestBot BrewTestBot removed the needs response Needs a response from the issue/PR author label Apr 12, 2017
@trinitronx
Copy link
Contributor Author

@fxcoudert: I can't seem to re-open this issue

@trinitronx trinitronx mentioned this pull request Apr 17, 2017
4 tasks
@trinitronx
Copy link
Contributor Author

trinitronx commented Apr 17, 2017

@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.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new formula PR adds a new formula to Homebrew/homebrew-core python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants