Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
    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)
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
    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
Ejemplo n.º 10
0
    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
Ejemplo n.º 11
0
    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
Ejemplo n.º 12
0
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())
Ejemplo n.º 13
0
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())