def is_installed(self): """ Checks if the dependency is installed. :param return: True if dependency is installed, false otherwise. """ return not call_without_output(('pip', 'show', self.package))
def is_installed(self): """ Checks if the dependency is installed. :param return: True if dependency is installed, false otherwise. """ return not call_without_output((sys.executable, "-m", "pip", "show", self.package))
def is_installed(self): """ Checks if the dependency is installed. :param return: True if dependency is installed, false otherwise. """ cmd = ['gem', 'list', '-i', self.package] if platform.system() == 'Windows': # pragma: no cover cmd = ['cmd', '/c'] + cmd return not call_without_output(cmd)
def is_installed(self): """ Checks if the dependency is installed. :param return: True if dependency is installed, false otherwise. """ cmd = ["npm", "show", self.package] if platform.system() == "Windows": # pragma: no cover cmd = ["cmd", "/c"] + cmd return not call_without_output(cmd)
def is_installed(self): """ Checks if the dependency is installed. :return: ``True`` if dependency is installed, ``False`` otherwise. """ # We need to check explicitly if `nothing` is returned, as this happens # when the package is *registered*, but *not installed*. If it's not # even registered, julia will throw an exception which lets julia exit # with an error code different from 0. code = 'Pkg.installed("{}")==nothing?exit(1):exit(0)'.format( escape(self.package, '\\"')) args = ('julia', '-e', code) return not call_without_output(args)
def is_installed(self): """ Checks if the dependency is installed. :param return: True if dependency is installed, false otherwise. """ for cmd in (["npm", "list", self.package], ["npm", "list", "-g", self.package]): if platform.system() == "Windows": # pragma: no cover cmd = ["cmd", "/c"] + cmd if not call_without_output(cmd): return True return False
def is_installed(self): """ Checks if the dependency is installed. :param return: True if dependency is installed, false otherwise. """ for cmd in (['npm', 'list', self.package], ['npm', 'list', '-g', self.package]): if platform.system() == 'Windows': # pragma: no cover cmd = ['cmd', '/c'] + cmd if not call_without_output(cmd): return True return False
import platform import shutil import unittest from coalib.bears.requirements.GemRequirement import GemRequirement from coalib.misc.Shell import call_without_output cmd = ['gem', 'list', '-i', 'ruby'] if platform.system() == 'Windows': # pragma: no cover cmd = ['cmd', '/c'] + cmd @unittest.skipIf(shutil.which('gem') is None or bool(call_without_output(cmd)), "Gem is not installed.") class GemRequirementTestCase(unittest.TestCase): def test_installed_requirement(self): self.assertTrue(GemRequirement('ruby').is_installed()) def test_not_installed_requirement(self): self.assertFalse(GemRequirement('some_bad_package').is_installed())
import platform import shutil import unittest from coalib.bears.requirements.GemRequirement import GemRequirement from coalib.misc.Shell import call_without_output cmd = ['gem', 'list', '-i', 'ruby'] if platform.system() == 'Windows': # pragma: no cover cmd = ['cmd', '/c'] + cmd @unittest.skipIf( shutil.which('gem') is None or bool(call_without_output(cmd)), 'Gem is not installed.') class GemRequirementTestCase(unittest.TestCase): def test_installed_requirement(self): self.assertTrue(GemRequirement('ruby').is_installed()) def test_not_installed_requirement(self): self.assertFalse(GemRequirement('some_bad_package').is_installed())