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:
parent
67554a7338
commit
b1d9169ae6
@ -92,5 +92,9 @@ module Language
|
|||||||
--record=installed.txt
|
--record=installed.txt
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.package_available? python, module_name
|
||||||
|
quiet_system python, "-c", "import #{module_name}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user