Merge "Remove pip helper object since its not used"
This commit is contained in:
commit
57cb788eaa
@ -24,7 +24,6 @@ from anvil import shell as sh
|
||||
from anvil import utils
|
||||
|
||||
from anvil.components import base
|
||||
from anvil.packaging.helpers import pip_helper
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -55,7 +54,6 @@ class EmptyTestingComponent(base.Component):
|
||||
class PythonTestingComponent(base.Component):
|
||||
def __init__(self, *args, **kargs):
|
||||
base.Component.__init__(self, *args, **kargs)
|
||||
self.helper = pip_helper.Helper()
|
||||
self.test_type = self.get_option('test_type', default_value='').lower().strip()
|
||||
self.ignore_test_failures = kargs.get('ignore_test_failures', False)
|
||||
|
||||
|
@ -155,36 +155,3 @@ def read_requirement_files(files):
|
||||
with open(filename) as f:
|
||||
result.extend(parse_requirements(f.read()))
|
||||
return result
|
||||
|
||||
|
||||
class Helper(object):
|
||||
def __init__(self):
|
||||
self._pip_executable = sh.which_first(['pip-python', 'pip'])
|
||||
self._installed_cache = None
|
||||
|
||||
def _get_installed(self):
|
||||
cmd = [self._pip_executable] + FREEZE_CMD
|
||||
(stdout, _stderr) = sh.execute(cmd)
|
||||
return parse_requirements(stdout, True)
|
||||
|
||||
def uncache(self):
|
||||
self._installed_cache = None
|
||||
|
||||
def list_installed(self):
|
||||
if self._installed_cache is None:
|
||||
self._installed_cache = self._get_installed()
|
||||
return list(self._installed_cache)
|
||||
|
||||
def is_installed(self, name):
|
||||
matches = self.find_installed(name)
|
||||
if len(matches):
|
||||
return True
|
||||
return False
|
||||
|
||||
def find_installed(self, name):
|
||||
wanted_pkg = create_requirement(name)
|
||||
matches = []
|
||||
for pkg in self.list_installed():
|
||||
if pkg.key == wanted_pkg.key:
|
||||
matches.append(pkg)
|
||||
return matches
|
||||
|
Loading…
Reference in New Issue
Block a user