Created
March 8, 2018 21:42
-
-
Save innovid-rnd/cc05f67b7511fb9d905a71165910fc7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Helper method for the common case of installing a Python application. | |
# Creates a virtualenv in `libexec`, installs all `resource`s defined | |
# on the formula, and then installs the formula. | |
def virtualenv_install_with_resources(options = {}) | |
python = options[:using] | |
if python.nil? | |
wanted = %w[python python@2 python@3 python3].select { |py| needs_python?(py) } | |
raise FormulaAmbiguousPythonError, self if wanted.size > 1 | |
python = wanted.first || "python2.7" | |
end | |
venv = virtualenv_create(libexec, python.delete("@")) | |
venv.pip_install resources | |
venv.pip_install_and_link buildpath | |
venv | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment