def test_makeShellfiles(self): projectRoot = FastScript.getEnv('TOOLBOSCORE_ROOT') installDir = os.path.join(projectRoot, 'install') fileNamePrefix = ToolBOSSettings.packageName + '-' # create shellfiles makeShellfiles(projectRoot) # check result for fileName in ('pkgInfo.py', 'BashSrc', 'CmdSrc.bat'): expectedFile = fileNamePrefix + fileName resultFile = os.path.join(installDir, fileName) logging.info('expecting content as in: %s' % expectedFile) logging.info('comparing with: %s' % resultFile) expectedContent = FastScript.getFileContent(expectedFile) resultContent = FastScript.getFileContent(resultFile) # check if each line occurs in 'resultContent', except the line # of the SVN revision as this frequently changes for line in expectedContent.splitlines(): if not line.startswith('revision'): try: self.assertTrue(resultContent.find(line) != -1) except AssertionError: logging.error('line not found: %s' % line) raise
def setupProxy(sitRootPath=None, sitProxyPath=None): """ Convenience-wrapper to create a default proxy directory. WARNING: If a proxy already exists, it will be DELETED ! You may specify the absolute paths for the SIT root- and/or proxy directories. If omitted, typical defaults will be used. """ from ToolBOSCore.Storage import ProxyDir from ToolBOSCore.Storage import SIT if not sitRootPath: sitRootPath = SIT.getDefaultRootPath() if not sitProxyPath: sitProxyPath = SIT.getDefaultProxyPath() Any.requireIsTextNonEmpty(sitRootPath) Any.requireIsTextNonEmpty(sitProxyPath) Any.requireIsDir(sitRootPath) # delete existing proxy if it exists, it might be screwed up if os.path.exists(sitProxyPath): logging.info('cleaning existing proxy in %s' % sitProxyPath) FastScript.remove(sitProxyPath) logging.info('creating proxy directory... (this may take some time)') logging.info('SIT Root: %s' % sitRootPath) logging.info('SIT Proxy: %s' % sitProxyPath) ProxyDir.createProxyDir(sitRootPath, sitProxyPath, verbose=False)
def switchEnvironment(toPlatform): """ Modifies the environment variables to appear as if this was another operating system. This is primary used for cross-compilations. If you would like to later restore the original settings, make sure to call "origEnv = FastScript.getEnv()" before invoking this function. When you are done, you can then reset the whole environment by calling "FastScript.setEnv( origMap )". """ Any.requireIsTextNonEmpty(toPlatform) fromPlatform = Platforms.getHostPlatform() src = fromPlatform.replace('-', '') dst = toPlatform.replace('-', '') funcName = "_switchEnv_%s_to_%s" % (src, dst) if fromPlatform == toPlatform: return try: func = globals()[funcName] except KeyError: msg = "requested platform switch (%s to %s) is not supported" % \ ( fromPlatform, toPlatform ) raise NotImplementedError(msg) func() FastScript.setEnv('MAKEFILE_PLATFORM', toPlatform)
def _patchCIA977( self, dryRun=False ): """ Updates the Makefile of a BBCM component to call "MakeBBCM.py" instead of "RunTemplate.php". """ if not self.details.isBBCM(): logging.debug( 'package is not a BBCM' ) return False srcFile = os.path.join( PackageCreator.templateDir, 'C_BBCM', 'Makefile' ) dstFile = 'Makefile' if not os.path.exists( dstFile ): logging.debug( 'package has no Makefile, patch does not apply' ) return False srcContent = FastScript.getFileContent( srcFile ) dstContent = FastScript.getFileContent( dstFile ) if srcContent != dstContent: if not dryRun: FastScript.copy( srcFile, dstFile ) else: logging.debug( '[DRY-RUN] cp %s %s', srcFile, dstFile ) return [ dstFile ] else: return False
def getSystemPackages(): """ Fetches the list of Debian packages installed on the system, returning a dict mapping "packageName" => "version". """ if not ProcessEnv.which('dpkg'): raise EnvironmentError('Not a Debian-based operating system') output = StringIO() regexp = re.compile("^ii\s+(.+?)\s+(.+?)\s.+$") result = {} try: FastScript.execProgram('dpkg -l', stdout=output) except OSError as details: raise OSError(details) for line in output.getvalue().splitlines(): if line.startswith('ii '): tmp = regexp.match(line) name = tmp.group(1) version = tmp.group(2) # try to cut-off the arch postfix (e.g. ":i386" or ":amd64") name = name.split(':')[0] result[name] = version return result
def test_addGlobalInstallLog( self ): msgType = 'NEW' message = 'Test message (unittest)' # create log entry logEntry = GlobalInstallLog( ToolBOSSettings.canonicalPath, isFirstInstall=False, msgType=msgType, message=message ) fileName = tempfile.mkstemp( prefix='test-' )[1] logEntry.setFileName( fileName ) logEntry.writeFile() Any.requireIsFileNonEmpty( fileName ) content = FastScript.getFileContent( fileName ) # check result self.assertTrue( content.find( msgType ) > 0, "log file incorrect" ) self.assertTrue( content.find( message ) > 0, "log file incorrect" ) # clean-up FastScript.remove( fileName )
def delUserConfigOption(varName): """ Removes a certain config option from the user's configfile. """ Any.requireIsTextNonEmpty(varName) # read current settings (if any) config = getUserConfigOptions() # remove setting try: del config[varName] logging.debug('deleted config option: %s', varName) # delete entire file if there are no settings left if config: _setUserConfigOptions(config) else: fileName = getSettingsFile_user() logging.debug('deleting empty configfile') logging.debug('rm %s', fileName) FastScript.remove(fileName) except KeyError: logging.debug('%s: No such user config option', varName)
def _removeProxyInstallations(sitRootPkgList, sitProxyPkgList, sitRoot, sitProxy, dryRun): """ ATTENTION: Unless dryRun=True, this function removes all packages that have been installed locally to your proxy! Use with caution! """ requireIsProxyDir(sitProxy) toDelete = findProxyInstallations() # list of absolute paths into proxy Any.requireIsList(toDelete) if len(toDelete) == 0: logging.info('no proxy installations to be deleted') result = 0 else: if dryRun: logging.info('-- DRY RUN -- not deleting anything') result = 0 else: logging.info('deleting all proxy-installations as requested:') result = len(toDelete) for installRoot in toDelete: if dryRun: logging.info('-- DRY RUN -- normally would now delete %s' % installRoot) else: logging.info('deleting %s' % installRoot) FastScript.remove(installRoot) return result
def _linkNewPackagesIntoProxy(sitRootPkgList, sitProxyPkgList, sitRoot, sitProxy, dryRun): """ Creates a symlink in the proxy for each newly globally installed package. """ Any.requireIsListNonEmpty(sitRootPkgList) Any.requireIsListNonEmpty(sitProxyPkgList) Any.requireIsDir(sitRoot) Any.requireIsDir(sitProxy) proxyChanged = False diffList = _getTreeDifferences(sitRootPkgList, sitProxyPkgList) diffList.sort() for project in diffList: pkgRootPath = os.path.join(sitRoot, project) pkgProxyPath = os.path.join(sitProxy, project) pkgBaseDir = os.path.dirname(pkgProxyPath) # make directory if it does not exist if not os.path.exists(pkgBaseDir): FastScript.mkdir(pkgBaseDir) try: os.symlink(pkgRootPath, pkgProxyPath) logging.info('linking %s' % project) proxyChanged = True except OSError: pass # after linking one path, the other one might be inside return proxyChanged
def copyModuleIndex(srcRoot, dstRoot): """ Copies all <srcDIT>/Modules/Index/*.def and <srcDIT>/Modules/Index/*.py files to <dstSIT>/Modules/Index/ """ Any.requireIsDir(srcRoot) Any.requireIsDir(dstRoot) srcDir = os.path.join(srcRoot, 'Modules', 'Index') dstDir = os.path.join(dstRoot, 'Modules', 'Index') # For the case that srcRoot is an SIT proxy: Some people do not have # any files in their Index directory, furthermore the directory could # be entirely missing if never a BBCM had been installed into the # user's proxy # # Any.requireIsDirNonEmpty( srcDir ) FastScript.mkdir(dstDir) for srcFile in FastScript.getFilesInDir(srcDir): if srcFile.endswith(".def") or srcFile.endswith(".py"): fileName = os.path.basename(srcFile) srcPath = os.path.join(srcDir, fileName) dstPath = os.path.join(dstDir, fileName) FastScript.copy(srcPath, dstPath)
def collapseHGR(string): """ Returns all computable values of HRI_GLOBAL_ROOT with an ${HRI_GLOBAL_ROOT} placeholder. Deprecated: $HRI_GLOBAL_ROOT is not supposed to be used anymore. If not defined this function uses the value of $SIT instead. """ envValue = FastScript.getEnv('HRI_GLOBAL_ROOT') # may no longer be defined, if so we use $SIT if not envValue: envValue = FastScript.getEnv('SIT') if not Any.isTextNonEmpty(envValue): raise EnvironmentError("Environment variable $SIT not defined") # replace all occurrences of ${HRI_GLOBAL_ROOT} or its value tmp = FastScript.collapseVar(string, 'HRI_GLOBAL_ROOT') # if existing, replace the path where ${HRI_GLOBAL_ROOT}/parentTree points to linkName = os.path.join(envValue, parentLink) try: linkTarget = os.readlink(linkName) tmp = tmp.replace(linkTarget + '/', '') except ( OSError, # probably has no such link AttributeError): # os.readlink n/a on Windows pass return tmp
def _copyBasePackage(src, dst, verbose, ignore=None, resolveLTS=None): """ Worker function which copies a particular package, passing the 'ignore'-callback to the underlying shutil.copytree() function. """ if verbose: logging.info('copying %s' % strip(src)) if os.path.islink(src): # make packageName directory try: FastScript.mkdir(os.path.dirname(dst)) except OSError: # may happen upon multi-thread race condition pass # distinguish if the link points to a patchlevel or into LTS target = os.readlink(src) if target.find(os.sep + 'LTS' + os.sep) > 0: _copyBasePackage_linkToLTS(src, dst, ignore, resolveLTS) else: _copyBasePackage_linkToPatchlevel(src, dst, ignore) elif os.path.isdir(src): # don't follow symlinks, keep them as they are shutil.copytree(src, dst, True, ignore) else: shutil.copy(src, dst)
def test_findProxyInstallations(self): # check if user has a valid proxy: sitRootPath = SIT.getParentPath() sitProxyPath = SIT.getPath() Any.requireIsDir(sitRootPath) Any.requireIsDir(sitProxyPath) ProxyDir.requireIsProxyDir(sitProxyPath) # create a fake package directory within the proxy... packageName = 'UnittestABCDEF123' goodNameDir = os.path.join(sitProxyPath, 'Libraries', packageName) goodVersionDir = os.path.join(goodNameDir, '42.0') badVersionDir = os.path.join(goodNameDir, '21.0') FastScript.mkdir(goodVersionDir) resultList = ProxyDir.findProxyInstallations() self.assertTrue( len(resultList) >= 1 ) # may be greater if developer has real software installed in proxy self.assertTrue(goodVersionDir in resultList) self.assertFalse(badVersionDir in resultList) # clean-up FastScript.remove(goodNameDir)
def getBuildDependencies(project, recursive=False): """ For now this simply calls getBuildDependenciesFromPkgInfo(), ignoring the case that the pkgInfo.py might not be present. Note: Unlike getDependencies(), the result of this function is a flat (non-nested) list. """ from ToolBOSCore.Storage.PkgInfo import getPkgInfoContent Any.requireIsTextNonEmpty(project) try: resultList = getPkgInfoContent(project)['buildDepends'] except (AssertionError, IOError, KeyError): resultList = [] if recursive: depList = getDependencies(project, recursive=True) depList = FastScript.flattenList(depList) for dep in depList: if dep.startswith('sit://'): try: buildDepList = getPkgInfoContent( SIT.strip(dep))['buildDepends'] except (AssertionError, IOError, KeyError): buildDepList = [] if buildDepList: resultList.append(buildDepList) resultList = FastScript.reduceList(resultList) return resultList
def __init__( self ): self._hostPlatform = Platforms.getHostPlatform() self._targetPlatform = self._hostPlatform self._oldCWD = os.getcwd() self._origEnv = copy.deepcopy( FastScript.getEnv() ) self._stdout = None self._stderr = None self._sourceTree = os.getcwd() self._binaryTree = self._sourceTree self._outOfTree = False self._buildDir = os.path.join( self._sourceTree, 'build', self._targetPlatform ) self._buildType = 'Release' self._crossCompiling = False self._isSetUp = False self._isConfigured = False self._isCompiled = False self._runScripts = FastScript.getEnv( 'BST_SKIP_SCRIPTS' ) != 'TRUE' self._cmakeModPath = None self._cmakeOptions = FastScript.getEnv( 'BST_CMAKE_OPTIONS' ) try: self._parallelJobs = int( FastScript.getEnv( 'BST_BUILD_JOBS' ) ) except ( KeyError, TypeError, ValueError ): self._parallelJobs = 1
def openPackage( self, topLevelDir ): topLevelDir = str(topLevelDir) oldcwd = os.getcwd() try: Any.requireIsTextNonEmpty( topLevelDir ) FastScript.changeDirectory( topLevelDir ) BuildSystemTools.requireTopLevelDir() except ( AssertionError, OSError, RuntimeError ) as details: FastScript.changeDirectory( oldcwd ) logging.error( details ) QMessageBox().critical( self.window, "Error", str(details), "OK" ) return logging.debug( 'opening package: %s', topLevelDir ) try: self.model.open( topLevelDir ) self.projectRoot = topLevelDir except ( NameError, SyntaxError, ValueError ) as details: logging.error( 'unable to read-in pkgInfo.py:' ) logging.error( details ) return self.taskButtons.setEnabled( True ) for terminal in self.terminals.values(): terminal.setPath( topLevelDir ) terminal.clear() self._runDependencyCheck( terminal )
def _setHostEnv( self ): """ Set some environment variables which are used by some CMakeLists.txt / packageVar.cmake files. Note: Target-related env.variables (TARGETARCH etc.) will be temp. modified by self._switchToTargetEnv() and set back with self._switchToHostEnv(). """ hostArch = Platforms.getHostArch() hostOS = Platforms.getHostOS() clangEnv = FastScript.getEnv( 'BST_USE_CLANG' ) if clangEnv is None: try: useClang = PkgInfo.getPkgInfoContent()['BST_useClang'] except ( AssertionError, KeyError ): useClang = getConfigOption( 'BST_useClang' ) clangEnv = 'TRUE' if useClang else 'FALSE' else: useClang = True if clangEnv == 'TRUE' else False logging.debug( 'use Clang/LLVM: %s', useClang ) envSettings = { 'BST_USE_CLANG': clangEnv, 'HOSTARCH': hostArch, 'HOSTOS': hostOS, 'TARGETARCH': hostArch, 'TARGETOS': hostOS } FastScript.getEnv().update( envSettings )
def runMakoEngine(srcFile, dstFile, values): """ Runs the templating engine, applying the given values onto the template file 'srcFile', writing results into 'dstFile'. """ Any.requireIsFile(srcFile) Any.requireIsText(dstFile) Any.requireIsDict(values) logging.info('processing %s' % dstFile) # First determine the directory of the template file, and tell Mako # to search there. In a second step tell Mako to search for a template # file in this search path. # # This is the only solution to get Mako's "include" working. lookup = TemplateLookup(directories=[os.path.dirname(srcFile)]) template = lookup.get_template(os.path.basename(srcFile)) dstContent = template.render(**values) Any.requireIsText(dstContent) FastScript.mkdir(os.path.dirname(dstFile)) # ensure dst dir. exists FastScript.setFileContent(dstFile, dstContent) Any.requireIsFile(dstFile) # Mako does not set the executable-flag on the generated output file. if os.access(srcFile, os.X_OK): # if executable os.chmod(dstFile, os.stat(srcFile)[0]) # copy mode bits
def run_symlink( self ): """ Symlinks all previously added / detected files within the output directory. """ logging.debug( 'linking %d files... (this may take some time)' % \ len( self.fileDict.keys() ) ) for original, target in self.fileDict.items(): srcFile = original dstFile = self.path + os.sep + target logging.debug( 'linking %s -> %s' % ( dstFile, srcFile ) ) FastScript.mkdir( os.path.dirname( dstFile ) ) try: os.symlink( srcFile, dstFile ) except OSError: fileName = os.path.basename( target ) linkTargetSupposed = srcFile linkTargetActual = os.readlink( dstFile ) if os.path.realpath( linkTargetActual ) != \ os.path.realpath( linkTargetSupposed ): logging.warning( '' ) logging.warning( 'library name clash: %s' % fileName ) logging.warning( 'symlink exists: %s (pointing to %s)' % ( dstFile, linkTargetActual ) ) logging.warning( 'attempting to create link %s pointing to %s' % ( dstFile, linkTargetSupposed ) ) logging.warning( '' )
def run(self): if not 'category' in self.values: self.values['category'] = 'DeviceIO' if not 'dependencies' in self.values: self.values['dependencies'] = [] if not 'buildRules' in self.values: self.values[ 'buildRules'] = '''# invoke kbuild for the actual building add_custom_target(${PACKAGE_NAME} ALL make WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY})''' self.createMainPackage() srcDir = os.path.join(self.templateDir, 'Linux_Kernel_Module') dstDir = self.dstDir self.templatize(os.path.join(srcDir, 'packageName.c.mako'), os.path.join(dstDir, 'src', '%s.c' % self.packageName)) self.templatize(os.path.join(srcDir, 'Makefile'), os.path.join(dstDir, 'Makefile')) FastScript.remove(os.path.join(dstDir, 'unittest.sh'))
def _setUserConfigOptions(config): """ Writes the dict 'config' in ASCII yet Pythonic style to the user's configfile, so that it can be edited manually and read-in using FastScript.execFile(). """ from ToolBOSCore.Packages.CopyrightHeader import getCopyrightHeader Any.requireIsDict(config) content = getCopyrightHeader('python', 'User-preferences for ToolBOS SDK') for key, value in config.items(): if Any.isText(value): value = "'%s'" % value # write Python string, not just value content += '%s = %s\n\n' % (key, str(value)) content += '\n# EOF\n' fileName = getSettingsFile_user() dirName = os.path.dirname(fileName) FastScript.mkdir(dirName) FastScript.setFileContent(fileName, content)
def run(self): if not 'category' in self.values: self.values['category'] = 'Libraries' if not 'dependencies' in self.values: self.values['dependencies'] = ['External/AllPython/2.7'] self.createMainPackage() srcDir = os.path.join(self.templateDir, 'Python') dstDir = self.dstDir FastScript.remove(os.path.join(dstDir, 'include')) self.copyVerbatim( os.path.join(srcDir, '__init__.py'), os.path.join(dstDir, 'include', self.packageName, '__init__.py')) self.copyVerbatim( os.path.join(srcDir, 'HelloWorld.py'), os.path.join(dstDir, 'include', self.packageName, 'HelloWorld.py')) self.copyVerbatim(os.path.join(srcDir, 'pkgInfo.py'), os.path.join(dstDir, 'pkgInfo.py')) self.copyVerbatim(os.path.join(srcDir, 'unittest.sh'), os.path.join(dstDir, 'unittest.sh')) self.templatize(os.path.join(srcDir, 'Unittest_HelloWorld.py.mako'), os.path.join(dstDir, 'test', 'Unittest_HelloWorld.py'))
def _patchCIA1147( self, dryRun=False ): """ Remove obsolete BBCM_INFO_CATEGORY. """ if not self.details.isBBCM(): logging.debug( 'package is not a BBCM' ) return False fileName = 'src/%s_info.c' % self.details.packageName if not os.path.exists( fileName ): return False lines = FastScript.getFileContent( fileName, splitLines=True ) modified = [] newContent = '' for line in lines: if line.startswith( 'BBCM_INFO_CATEGORY' ): modified.append( fileName ) else: newContent += line if modified and dryRun is False: FastScript.setFileContent( fileName, newContent ) return modified
def run(self): if not 'category' in self.values: self.values['category'] = 'Modules/RTMaps' if not 'dependencies' in self.values: self.values['dependencies'] = ['External/RTMaps/4.2'] if not 'buildRules' in self.values: self.values[ 'buildRules'] = '''file(GLOB SRC_FILES src/*.c src/*.cpp) bst_build_rtmaps_package("${SRC_FILES}" "${PROJECT_NAME}" "${BST_LIBRARIES_SHARED}")''' self.createMainPackage() srcDir = os.path.join(self.templateDir, 'RTMaps_Package') dstDir = self.dstDir self.copyVerbatim( os.path.join(srcDir, 'packageName.pckinfo'), os.path.join(dstDir, '%s.pckinfo' % self.packageName)) FastScript.remove(os.path.join(dstDir, 'unittest.sh')) # TBCORE-1837 Create empty 'src' directory FastScript.mkdir(os.path.join(dstDir, 'src'))
def save(self): """ Writes the user-settings in ASCII yet Pythonic style to the user's configfile, so that it can be edited manually and read-in using FastScript.execFile(). If there are no user-settings at all the fill be removed (if present). """ if self._userSettings: from ToolBOSCore.Packages.CopyrightHeader import getCopyrightHeader content = getCopyrightHeader('python', 'User preferences') for key, value in sorted(self._userSettings.items()): if Any.isText(value): value = "'%s'" % value # write Python string, not just value content += '%s = %s\n\n' % (key, str(value)) content += '\n# EOF\n' logging.debug('writing %s', self._userFile) FastScript.setFileContent(self._userFile, content) else: # delete entire file if there are no settings left logging.debug('deleting empty configfile') FastScript.remove(self._userFile)
def checkout(self, revision='HEAD', output=None): """ Fetches the specified revison from the given URL (which needs to point to a valid SVN repository). If the username to use for connecting to the server does not match your current username (e.g. on HRI-EU's Ext.SVN server), please use insertUsernameIntoURL() prior to this call. If 'output' is a StringIO object, the command's output will be redirected there (otherwise printed on screen). """ # suppress interactive password prompt for Ext.SVN (if any), # see JIRA ticket TBCORE-904 oldValue = FastScript.getEnv('SVN_SSH') if oldValue and not '-oBatchMode' in oldValue: # if SVN_SSH was already set then *append* our settings newValue = oldValue + ' -oBatchMode=yes' else: # set SVN_SSH newValue = 'ssh -oBatchMode=yes' FastScript.setEnv('SVN_SSH', newValue) cmd = self.getSourceCodeCommand(revision) return FastScript.execProgram(cmd, stdout=output, stderr=output)
def test_makeDocumentation( self ): tmpDir = tempfile.mkdtemp( prefix='test-' ) packageName = 'HelloWorld' packageVersion = '42.0' projectRoot = os.path.join( tmpDir, packageName, packageVersion ) # create package on-the-fly PackageCreator_C_Library( packageName, packageVersion, outputDir=tmpDir ).run() Any.requireIsDirNonEmpty( tmpDir ) # create docu output = StringIO() if Any.getDebugLevel() <= 3 else None d = DocumentationCreator( projectRoot, stdout=output, stderr=output ) d.generate() # check result Any.requireIsDirNonEmpty( os.path.join( projectRoot, 'doc' ) ) Any.requireIsDirNonEmpty( os.path.join( projectRoot, 'doc/html' ) ) Any.requireIsFileNonEmpty( os.path.join( projectRoot, 'doc/html/index.html' ) ) Any.requireIsFileNonEmpty( os.path.join( projectRoot, 'doc/html/doxygen.css' ) ) Any.requireIsFileNonEmpty( os.path.join( projectRoot, 'doc/html/doxygen.png' ) ) FastScript.remove( tmpDir )
def _distclean_outOfTree( self ): # Safety check (TBCORE-1635): # # We experienced that switching directories within Midnight # Commander and invoking a sub-shell with "BST.py -d" could lead # to an incorrect assumption that we perform an out-of-tree build # although it is a normal in-tree-build. # # In this case, the current package is considered to be a build # directory and deleted at "BST.py -d" -- effectively destroying # work results that have not been committed, yet. # # To prevent deletion in such cornercase we check for files and # directories that could indicate such cornercase: for candidate in ( 'CMakeLists.txt', 'packageVar.cmake', 'pkgInfo.py', 'src', 'build' ): if os.path.exists( candidate ): msg = 'TBCORE-1635 CORNERCASE DETECTED, PERFORMING EMERGENCY EXIT!' raise SystemExit( msg ) logging.debug( 'passed safety check' ) for entry in os.listdir( self._binaryTree ): try: FastScript.remove( entry ) except ( IOError, OSError ) as details: logging.error( details ) return True
def updateComponentIndex(sitRootPath, sitProxyPath, dryRun): """ Cleans the index directory and creates all symlinks from scratch. """ Any.requireIsDir(sitRootPath) Any.requireIsDir(sitProxyPath) Any.requireIsBool(dryRun) ProxyDir.requireIsProxyDir(sitProxyPath) indexBaseDir = getIndexBaseDir(sitProxyPath) # We would like to start with a fresh indexBaseDir, however cannot delete # it because it also contains the DTBOS *.def files. Hence we only remove # subdirectories (corresponding to the RTMaps versions) within this # directories and keep *.def files as they are. See TBCORE-974). # #FastScript.remove( indexBaseDir ) for subDir in FastScript.getDirsInDir(indexBaseDir): path = os.path.join(indexBaseDir, subDir) FastScript.remove(path) for version in getVersionsAvailable(sitRootPath): dstDir = os.path.join(indexBaseDir, version) logging.debug('mkdir %s', dstDir) if not dryRun: FastScript.mkdir(dstDir) logging.debug('updating RTMaps component index...') registerDistributionPackages(sitRootPath, sitProxyPath, dryRun) registerNormalPackages(sitRootPath, dryRun) registerNormalPackages(sitProxyPath, dryRun)
def _createAutoDoxyfile(self): content = 'TAGFILES = ' logging.debug('cross-linking doxygen documentation into %s', self.sitPath) if self.details.inheritedProjects: logging.debug('dependencies: %s', self.details.inheritedProjects) else: logging.debug('no dependencies found --> no cross-links') for dep in self.details.inheritedProjects: depRoot = os.path.join(self.sitPath, dep) depTagFile = os.path.join(depRoot, 'doc', 'doxygen.tag') depHTMLDir = os.path.join(depRoot, 'doc', 'html') # ignore if we can't cross-link depTagFileExists = os.path.exists(depTagFile) depHTMLDirExists = os.path.exists(depHTMLDir) logging.debug('processing dependency: %s', dep) logging.debug(' %s: %s', depTagFile, depTagFileExists) logging.debug(' %s: %s', depHTMLDir, depHTMLDirExists) if depTagFileExists and depHTMLDirExists: content += '%s=%s ' % (depTagFile, depHTMLDir) logging.debug(' linking %s', depTagFile) else: logging.debug(' not linking') logging.debug('') FastScript.setFileContent(self.autoDoxyfile, content)