Example #1
0
        def provider(
            dspec,
            available_components,
            search_dirs,
            working_directory,
            update_installed,
            dep_of=None
        ):
            r = access.satisfyFromAvailable(dspec.name, available_components)
            if r:
                if r.isTestDependency() and not dspec.is_test_dependency:
                    logger.debug('test dependency subsequently occurred as real dependency: %s', r.getName())
                    r.setTestDependency(False)
                return r
            update_if_installed = False
            if update_installed is True:
                update_if_installed = True
            elif update_installed:
                update_if_installed = dspec.name in update_installed
            r = access.satisfyVersionFromSearchPaths(
                dspec.name,
                dspec.versionReq(),
                search_dirs,
                update_if_installed,
                inherit_shrinkwrap = dep_of.getShrinkwrap()
            )
            if r:
                r.setTestDependency(dspec.is_test_dependency)
                return r
            # before resorting to install this module, check if we have an
            # existing linked module (which wasn't picked up because it didn't
            # match the version specification) - if we do, then we shouldn't
            # try to install, but should return that anyway:
            default_path = os.path.join(self.modulesPath(), dspec.name)
            if fsutils.isLink(default_path):
                r = Component(
                                       default_path,
                     test_dependency = dspec.is_test_dependency,
                    installed_linked = fsutils.isLink(default_path),
                  inherit_shrinkwrap = dep_of.getShrinkwrap()
                )
                if r:
                    assert(r.installedLinked())
                    return r
                else:
                    logger.error('linked module %s is invalid: %s', dspec.name, r.getError())
                    return r

            r = access.satisfyVersionByInstalling(
                dspec.name,
                dspec.versionReq(),
                self.modulesPath(),
                inherit_shrinkwrap = dep_of.getShrinkwrap()
            )
            if not r:
                logger.error('could not install %s' % dspec.name)
            if r is not None:
                r.setTestDependency(dspec.is_test_dependency)
            return r
Example #2
0
        def provider(
            dspec,
            available_components,
            search_dirs,
            working_directory,
            update_installed,
            dep_of=None
        ):
            r = access.satisfyFromAvailable(dspec.name, available_components)
            if r:
                if r.isTestDependency() and not dspec.is_test_dependency:
                    logger.debug('test dependency subsequently occurred as real dependency: %s', r.getName())
                    r.setTestDependency(False)
                return r
            update_if_installed = False
            if update_installed is True:
                update_if_installed = True
            elif update_installed:
                update_if_installed = dspec.name in update_installed
            r = access.satisfyVersionFromSearchPaths(
                dspec.name,
                dspec.versionReq(),
                search_dirs,
                update_if_installed,
                inherit_shrinkwrap = dep_of.getShrinkwrap()
            )
            if r:
                r.setTestDependency(dspec.is_test_dependency)
                return r
            # before resorting to install this module, check if we have an
            # existing linked module (which wasn't picked up because it didn't
            # match the version specification) - if we do, then we shouldn't
            # try to install, but should return that anyway:
            default_path = os.path.join(self.modulesPath(), dspec.name)
            if fsutils.isLink(default_path):
                r = Component(
                                       default_path,
                     test_dependency = dspec.is_test_dependency,
                    installed_linked = fsutils.isLink(default_path),
                  inherit_shrinkwrap = dep_of.getShrinkwrap()
                )
                if r:
                    assert(r.installedLinked())
                    return r
                else:
                    logger.error('linked module %s is invalid: %s', dspec.name, r.getError())
                    return r

            r = access.satisfyVersionByInstalling(
                dspec.name,
                dspec.versionReq(),
                self.modulesPath(),
                inherit_shrinkwrap = dep_of.getShrinkwrap()
            )
            if not r:
                logger.error('could not install %s' % dspec.name)
            if r is not None:
                r.setTestDependency(dspec.is_test_dependency)
            return r
Example #3
0
 def provideInstalled(self,
                     dspec,
      available_components,
               search_dirs,
         working_directory,
          update_installed,
                    dep_of
     ):
     #logger.info('%s provideInstalled: %s', dep_of.getName(), dspec.name)
     r = access.satisfyFromAvailable(dspec.name, available_components)
     if r:
         if r.isTestDependency() and not dspec.is_test_dependency:
             logger.debug('test dependency subsequently occurred as real dependency: %s', r.getName())
             r.setTestDependency(False)
         return r
     update_if_installed = False
     if update_installed is True:
         update_if_installed = True
     elif update_installed:
         update_if_installed = dspec.name in update_installed
     r = access.satisfyVersionFromSearchPaths(
         dspec.name,
         dspec.versionReq(),
         search_dirs,
         update_if_installed,
         inherit_shrinkwrap = dep_of.getShrinkwrap()
     )
     if r:
         r.setTestDependency(dspec.is_test_dependency)
         return r
     # return a module initialised to the path where we would have
     # installed this module, so that it's possible to use
     # getDependenciesRecursive to find a list of failed dependencies,
     # as well as just available ones
     # note that this Component object may still be valid (usable to
     # attempt a build), if a different version was previously installed
     # on disk at this location (which means we need to check if the
     # existing version is linked)
     default_path = os.path.join(self.modulesPath(), dspec.name)
     r = Component(
                            default_path,
          test_dependency = dspec.is_test_dependency,
         installed_linked = fsutils.isLink(default_path),
       inherit_shrinkwrap = dep_of.getShrinkwrap()
     )
     return r
Example #4
0
 def provideInstalled(self,
                     dspec,
      available_components,
               search_dirs,
         working_directory,
          update_installed,
                    dep_of
     ):
     #logger.info('%s provideInstalled: %s', dep_of.getName(), dspec.name)
     r = access.satisfyFromAvailable(dspec.name, available_components)
     if r:
         if r.isTestDependency() and not dspec.is_test_dependency:
             logger.debug('test dependency subsequently occurred as real dependency: %s', r.getName())
             r.setTestDependency(False)
         return r
     update_if_installed = False
     if update_installed is True:
         update_if_installed = True
     elif update_installed:
         update_if_installed = dspec.name in update_installed
     r = access.satisfyVersionFromSearchPaths(
         dspec.name,
         dspec.versionReq(),
         search_dirs,
         update_if_installed,
         inherit_shrinkwrap = dep_of.getShrinkwrap()
     )
     if r:
         r.setTestDependency(dspec.is_test_dependency)
         return r
     # return a module initialised to the path where we would have
     # installed this module, so that it's possible to use
     # getDependenciesRecursive to find a list of failed dependencies,
     # as well as just available ones
     # note that this Component object may still be valid (usable to
     # attempt a build), if a different version was previously installed
     # on disk at this location (which means we need to check if the
     # existing version is linked)
     default_path = os.path.join(self.modulesPath(), dspec.name)
     r = Component(
                            default_path,
          test_dependency = dspec.is_test_dependency,
         installed_linked = fsutils.isLink(default_path),
       inherit_shrinkwrap = dep_of.getShrinkwrap()
     )
     return r