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>
This commit is contained in:
Tim D. Smith 2015-03-02 21:44:35 -08:00
parent 67554a7338
commit b1d9169ae6

View File

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