Update docstrings
This commit is contained in:
1 parent
b13e48bd71
commit
7aba78f96e
7 files changed
+32
-14
No files matched your search
@@ -1,4 +1,8 @@
|
||||
"""Helpers to install PyPi packages."""
|
||||
"""
|
||||
homeassistant.util.package
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Helpers to install PyPi packages.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
@@ -13,8 +17,10 @@ INSTALL_LOCK = threading.Lock()
|
||||
|
||||
|
||||
def install_package(package, upgrade=True, target=None):
|
||||
"""Install a package on PyPi. Accepts pip compatible package strings.
|
||||
Return boolean if install successfull."""
|
||||
"""
|
||||
Install a package on PyPi. Accepts pip compatible package strings.
|
||||
Return boolean if install successful.
|
||||
"""
|
||||
# Not using 'import pip; pip.main([])' because it breaks the logger
|
||||
with INSTALL_LOCK:
|
||||
if check_package_exists(package, target):
|
||||
@@ -35,9 +41,11 @@ def install_package(package, upgrade=True, target=None):
|
||||
|
||||
|
||||
def check_package_exists(package, lib_dir):
|
||||
"""Check if a package is installed globally or in lib_dir.
|
||||
"""
|
||||
Check if a package is installed globally or in lib_dir.
|
||||
Returns True when the requirement is met.
|
||||
Returns False when the package is not installed or doesn't meet req."""
|
||||
Returns False when the package is not installed or doesn't meet req.
|
||||
"""
|
||||
try:
|
||||
req = pkg_resources.Requirement.parse(package)
|
||||
except ValueError:
|
||||
|
||||
Reference in new issue
Block a user