diff options
| author | Tim D. Smith | 2015-03-02 21:44:35 -0800 |
|---|---|---|
| committer | Tim D. Smith | 2015-03-03 06:31:29 -0800 |
| commit | b1d9169ae6229722aca2207fca4cebc0284f2e95 (patch) | |
| tree | de627c2899d2cd2d3d45529c751f52802df0cc44 /Library/Homebrew/language/python.rb | |
| parent | 67554a7338d488faffe0b14ddd57e0078778d173 (diff) | |
| download | brew-b1d9169ae6229722aca2207fca4cebc0284f2e95.tar.bz2 | |
language/python: add package_available? helper
Add helper to check whether a module is importable.
Closes Homebrew/homebrew#37345.
Signed-off-by: Tim D. Smith <git@tim-smith.us>
Diffstat (limited to 'Library/Homebrew/language/python.rb')
| -rw-r--r-- | Library/Homebrew/language/python.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index c07848458..4089316bb 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -92,5 +92,9 @@ module Language --record=installed.txt ] end + + def self.package_available? python, module_name + quiet_system python, "-c", "import #{module_name}" + end end end |
