예제 #1
0
파일: specs.py 프로젝트: dlhuang/kipoi
    def all_installed(self, verbose=False):
        """Validate if all the dependencies are installed as requested

        Args:
          verbose: if True, display warnings if the dependencies are not installed

        Returns:
          (bool): True if all the required package versions are installed
            and False otherwise
        """
        norm = self.normalized()
        for pkg in list(norm.conda) + list(norm.pip):
            if not kconda.is_installed(pkg):
                if verbose:
                    pkg_name, req_version = kconda.version_split(pkg)
                    found_version = kconda.get_package_version(pkg_name)
                    if found_version is None:
                        print("Package '{}' is not installed".
                              format(pkg_name))
                    else:
                        print("Installed package '{}={}' doesn't "
                              "comply with '{}'".
                              format(pkg_name, found_version, pkg))
                return False
        return True
예제 #2
0
def test_version_split():
    assert version_split("asdsda>=2.4,==2") == ('asdsda', ['>=2.4', '==2'])
    assert version_split("asdsda>=2.4") == ('asdsda', ['>=2.4'])
    assert version_split("asdsda>=2.4,~=2.3") == ('asdsda', ['>=2.4', '~=2.3'])
    assert version_split("asdsda~=2.4,>=2.3") == ('asdsda', ['~=2.4', '>=2.3'])
    assert version_split("asdsda~=2.4") == ('asdsda', ['~=2.4'])
    assert version_split("asdsda") == ('asdsda', [])