def addDependencies( self ): pkgList = map( lambda s: os.path.join( '%SIT%', strip( s ), 'CmdSrc' ), self.details.inheritedProjects ) intro = 'set INHERITED_PROJECTS=' data = ' '.join( pkgList ) return intro + data + "\n\n"
def addDependencies(self): pkgList = map(lambda s: strip(s), self.details.inheritedProjects) intro = 'SIT_DEPENDENCIES="' separator = ' \\\n%s' % (' ' * len(intro)) data = separator.join(pkgList) outro = '"\n\n' return intro + data + outro
def _getInheritedProjects(self): # This is a legacy combination of the real (not build-)dependencies # and recommendations. They all will get sourced to be in the PATH. # # Note that Non-SIT-dependencies (e.g. "deb://binutils") get # filtered out. from ToolBOSCore.Storage.SIT import strip tmpList = FastScript.reduceList(self.dependencies + self.recommendations) tmpList = filter(lambda s: not s.startswith('deb://'), tmpList) self.inheritedProjects = list(map(lambda s: strip(s), tmpList))
def addDependencies(self): result = ''' #---------------------------------------------------------------------------- # Dependencies #---------------------------------------------------------------------------- # please include here the packages this one depends on # (one bst_find_package() per dependency), e.g: # bst_find_package(DevelopmentTools/ToolBOSCore/2.0) ''' for dep in self.details.dependencies: if dep.startswith('sit://'): canonicalPath = strip(dep) result += 'bst_find_package(%s)\n' % canonicalPath return result + '\n'
def addPackage( self, canonicalPath, recursive, filterFunc ): """ Runs 'filterFunc' on the specified package. Does the same for all dependent packages if 'recursive=True'. """ Any.requireIsTextNonEmpty( canonicalPath ) Any.requireIsBool( recursive ) Any.requireIsCallable( filterFunc ) canonicalPath = strip( canonicalPath ) installRoot = self.sitPath + os.sep + canonicalPath if canonicalPath in self.pkgList: # avoid duplicates return if canonicalPath.startswith( 'deb://' ): # ignore Debian packages return if self._showProgress: logging.info( 'processing %s', canonicalPath ) if os.path.exists( installRoot + os.sep + 'SkipLibIndex' ): logging.debug( '%s: SkipLibIndex found' % canonicalPath ) else: filterFunc( self, canonicalPath ) if recursive: deps = getDependencies( project = canonicalPath, recursive = True, cache = self._depCache, systemPackages = False, sitPath = getPath() ) shortDepList = FastScript.reduceList( deps ) for package in shortDepList: if package not in self.pkgList: self.addPackage( package, False, filterFunc )
def addPackageList( self, pkgList, recursive, filterFunc ): """ Like addPackage(), but for a list of packages. pkgList = ( 'Basics/Any/2.2', 'Basics/Time/1.1' ) LibIndex.createFromList( pkgList, 'MyLibIndex' ) """ Any.requireIsList( pkgList ) Any.requireIsCallable( filterFunc ) pkgFileDependecies = [] for pkg in pkgList: deps = getDependencies( project = pkg, recursive = True, cache = self._depCache, systemPackages = False, sitPath = getPath() ) shortDeps = FastScript.reduceList( deps ) for shortDep in shortDeps: path = splitPath( pkg ) Any.requireIsTuple( path ) dependency = splitPath( shortDep ) Any.requireIsTuple( dependency ) mod = strip( path[ 1 ] ) lib = strip( dependency[ 1 ] ) vers = strip( dependency[ 2 ] ) pkgFileDependecies.append( ( mod, lib, vers ) ) conflictDeps = [] #returns the list of conflicting dependencies, if empty there are no conflicts for deps in pkgFileDependecies: mod = deps[ 0 ] lib = deps[ 1 ] vers = deps[ 2 ] #we build the list where the lib library appears in other versions listDep = [ x for x in pkgFileDependecies if x[ 1 ] == lib and not x[ 2 ] == vers ] for dep in listDep: module = dep[ 0 ] lib = dep[ 1 ] version = dep[ 2 ] #check for duplicates if not ( module, mod, lib, version, vers ) in conflictDeps: conflictDeps.append( ( mod, module, lib, vers, version ) ) textError = 'ERROR:\n' text = '{} {} used by {} \n is in conflict with \n{} {} used by {}\n\n' for dep in conflictDeps: mod1 = dep[ 0 ] # first module mod2 = dep[ 1 ] # second module lib = dep[ 2 ] # library vers1 = dep[ 3 ] # first version vers2 = dep[ 4 ] # second version textError = textError + text.format( lib, vers1, mod1, lib, vers2, mod2 ) Any.requireMsg( not conflictDeps, '\n %s' % textError ) for pkg in pkgList: self.addPackage( pkg, recursive, filterFunc )