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 | 6863c385bc68571ef5afa431d80bb0db4cbf470d (patch) | |
| tree | 127be416372500f6d569ab1f20696e8ef8018d50 /Library/Homebrew | |
| parent | 0d7259360ce4d3dc577f237b30d0370753e28c13 (diff) | |
| download | homebrew-6863c385bc68571ef5afa431d80bb0db4cbf470d.tar.bz2 | |
language/python: add package_available? helper
Add helper to check whether a module is importable.
Closes #37345.
Signed-off-by: Tim D. Smith <git@tim-smith.us>
Diffstat (limited to 'Library/Homebrew')
| -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 |
