def baseSetupWine(configDir, msvc, stdout, stderr, postfix): if not configDir: configDir = getWineConfigDir(postfix) # safety check: exit if we are within CIA and configdir points to # home directories! if FastScript.getEnv('CIA') == 'TRUE' and configDir.startswith('/home'): raise SystemExit( 'SAFETY GUARD: Do not touch home directory within CIA!') sourceWindowsBSP(msvc) FastScript.setEnv('WINEPREFIX', configDir) FastScript.mkdir(configDir) logging.info('setting up Wine in %s', configDir) # temporarily unset the DISPLAY variable so that the 'winecfg' # utility does not show up oldDisplay = FastScript.getEnv('DISPLAY') FastScript.unsetEnv('DISPLAY') FastScript.execProgram('winecfg', stdout=stdout, stderr=stderr) # wait for wineserver shutdown (default: 3 seconds) waitWineServerShutdown(configDir, postfix) if oldDisplay: FastScript.setEnv('DISPLAY', oldDisplay) logging.info('Microsoft .NET support enabled')
def test_helpText(self): tcRoot = FastScript.getEnv('TOOLBOSCORE_ROOT') hostPlatform = Platforms.getHostPlatform() binDirNoArch = os.path.join(tcRoot, 'bin') Any.requireIsDirNonEmpty(binDirNoArch) pyScripts = glob.glob(os.path.join(binDirNoArch, '*.py')) shScripts = glob.glob(os.path.join(binDirNoArch, '*.sh')) executables = glob.glob(os.path.join(binDirNoArch, hostPlatform, '*')) # unset VERBOSE and BST_BUILD_JOBS to make output comparable origEnv = FastScript.getEnv() FastScript.unsetEnv('VERBOSE') FastScript.unsetEnv('BST_BUILD_JOBS') for program in pyScripts + shScripts + executables: basename = os.path.basename(program) Any.requireIsTextNonEmpty(basename) logging.info('processing %s', basename) output = StringIO() cmd = '%s --help' % program fileName = os.path.join('ReferenceData', '%s.txt' % basename) Any.requireIsTextNonEmpty(cmd) Any.requireIsTextNonEmpty(fileName) FastScript.execProgram(cmd, stdout=output, stderr=output) expected = FastScript.getFileContent(fileName) result = normalizeOutput(output.getvalue()) Any.isTextNonEmpty(expected) Any.isTextNonEmpty(result) if result != expected: logging.info('differences in output of %s:', basename) logging.info('<result>\n%s', result) logging.info('</result>') logging.info('<expected>\n%s', expected) logging.info('</expected>') self.fail('help text of %s differs' % basename) FastScript.setEnv(origEnv)
def _retrieveMetaInfo(self): """ Invokes "svn info" within a working copy. If 'output' is a StringIO object, the command's output will be redirected there (otherwise printed on screen). """ if not self._infoOutput: output = StringIO() # Temporarily unset the LANG environment variable, in order to always # get English output. Otherwise the "svn info" output might be German # or Japanese which would break the later parsing, see TBCORE-59. origEnv = FastScript.getEnv('LANG') if origEnv: FastScript.unsetEnv('LANG') cmd = 'svn info' FastScript.execProgram(cmd, stdout=output, stderr=output) if origEnv: FastScript.setEnv('LANG', origEnv) self._infoOutput = output.getvalue() self._repoRootFromInfo = re.search("Repository Root: (\S+)\n", self._infoOutput).group(1) logging.debug('found SVN repository root: %s', self._repoRootFromInfo) self._repoUrlFromInfo = re.search("URL: (\S+)\n", self._infoOutput).group(1) logging.debug('found SVN repository URL: %s', self._repoUrlFromInfo) self._revFromInfo = int( re.search("Revision\s?: (\d+?)\s", self._infoOutput).group(1)) logging.debug('found SVN revision: %d', self._revFromInfo) return self._infoOutput
def __init__( self, projectRoot=None ): QObject.__init__( self ) self.app = None self.console = None self.controlsLayout = None self.controlsWidget = None self.enabledCBs = [] self.externalTools = None self.globalInstDialog = None self.lock = threading.Lock() self.mainLayout = None self.mainWidget = None self.menuBar = None self.metaInfo = None self.model = QtPackageModel.BSTPackageModel() self.multiTermWidget = None self.optionsWidget = None self.platformCBs_nat = {} self.platformCBs_natLayout = None self.platformCBs_natWidget = None self.platformCBs_xcmp = {} self.platformCBs_xcmpLayout = None self.platformCBs_xcmpWidget = None self.projectRoot = projectRoot self.rightPaneLayout = None self.rightPaneWidget = None self.runningProcesses = 0 self.taskButtons = None self.terminals = {} self.visibleRemoteTerminals = set() self.window = None self._depCheckers = {} self._seqTasks = [] # task queue self._toolBOSConf = ToolBOSConf.getGlobalToolBOSConf() # unset VERBOSE environment variable as this would be inherited to # child processes, this is not intended -- instead we will rely on # the corresponding checkbox FastScript.unsetEnv( 'VERBOSE' )
def _switchEnv_linuxToWindows(targetPlatform): import logging from ToolBOSCore.Settings import ProcessEnv from ToolBOSCore.Settings import UserSetup from ToolBOSCore.Settings import ToolBOSSettings Any.requireIsTextNonEmpty(targetPlatform) def _set_msvc_2017_conf(): UserSetup.ensureMSVCSetup(sdk, postfix='.' + targetPlatform) Any.requireMsg(FastScript.getEnv('WINEPREFIX'), '$WINEPREFIX not set') msvcBasePath = r'c:\BuildTools\VC' msvcToolsBasePath = r'{}\Tools\MSVC\14.13.26128'.format(msvcBasePath) msvcAuxiliaryBasePath = r'{}\Auxiliary\VS'.format(msvcBasePath) wkitBasePath = r'c:\Program Files\Windows Kits\10' wsdkBasePath = r'c:\Program Files\Microsoft SDKs\Windows\v10.0A' wkitVersion = '10.0.16299.0' cpu = 'x64' if targetArch == 'amd64' else 'x86' FastScript.setEnv('TARGETOS', 'windows') FastScript.setEnv('TARGETARCH', targetArch) FastScript.setEnv('COMPILER', 'vs2017') FastScript.setEnv('INCLUDE', r'{}\include'.format(msvcBasePath)) FastScript.setEnv( 'LIB', r'{0}\lib\{3};{0}\lib\onecore\{3};{1}\Lib\{4}\um\{3};{1}\Lib\{4}\ucrt\{3};{2}\Lib' .format(msvcToolsBasePath, wkitBasePath, wsdkBasePath, cpu, wkitVersion)) FastScript.setEnv( 'CL', r'/I"{0}\UnitTest\include" /I"{0}\include" /I"{1}\atlmfc\include" /I"{1}\include" /I"{2}\Include\{3}\ucrt" /I"{2}\Include\{3}\um" /I"{2}\Include\{3}\shared"' .format(msvcAuxiliaryBasePath, msvcToolsBasePath, wkitBasePath, wkitVersion)) FastScript.setEnv( 'CL_CMD', r'{0}\bin\Host{1}\{1}\cl.exe'.format(msvcToolsBasePath, cpu)) FastScript.setEnv( 'LINK_CMD', r'{0}\bin\Host{1}\{1}\link.exe'.format(msvcToolsBasePath, cpu)) FastScript.setEnv('RC_CMD', r'{0}\bin\{1}\rc.Exe'.format(wkitBasePath, cpu)) FastScript.setEnv('MT_CMD', r'{0}\bin\{1}\mt.Exe'.format(wkitBasePath, cpu)) FastScript.setEnv( 'DUMPBIN_CMD', r'{0}\bin\Host{1}\{1}\dumpbin.exe'.format(msvcToolsBasePath, cpu)) FastScript.setEnv( 'WindowsLibPath', r'{0}\UnionMetadata\{1};{0}\References\{1}'.format( wkitBasePath, wkitVersion)) FastScript.setEnv( 'LIBPATH', r'{0}\atlmfc\lib\{2};{0}\lib\{2};{0}\lib\{2}\store\references;{1}\UnionMetadata\{3};{1}\References\{3}' .format(msvcToolsBasePath, wkitBasePath, cpu, wkitVersion)) if cpu == 'x86': compilerBasePath = r'{0}\bin\Hostx86\x86'.format(msvcToolsBasePath) compilerBasePath += r';{0}\bin\Hostx86\x86;{0}\bin\Hostx86\x64\1033;{0}\bin\Hostx86\x86\1033'.format( msvcToolsBasePath) elif cpu == 'x64': compilerBasePath = r'{0}\bin\Hostx64\x64'.format(msvcToolsBasePath) compilerBasePath += r';{0}\bin\Hostx64\x64\1033'.format( msvcToolsBasePath) FastScript.setEnv('Path', compilerBasePath) def _set_msvc_legacy_conf(): if sdk == 2008: compilerSuite = 'msvc' pdkVersion = 'v6.1' else: compilerSuite = 'vs%d' % sdk pdkVersion = 'v7.1' UserSetup.ensureMSVCSetup(sdk, postfix='.' + targetPlatform) Any.requireMsg(FastScript.getEnv('WINEPREFIX'), '$WINEPREFIX not set') basePath = '''c:\\msvc-sdk\\''' + compilerSuite + '''\\''' compilerBasePath = basePath + '''VC\\''' pdkBasePath = '''c:\\msvc-sdk\\Windows\\''' + pdkVersion + '''\\''' compilerCrossPath = '' x64 = '' amd64 = '' if targetArch == 'amd64': compilerCrossPath = '''\\x86_amd64''' x64 = '''\\x64''' amd64 = '''\\amd64''' FastScript.setEnv('TARGETOS', 'windows') FastScript.setEnv('TARGETARCH', targetArch) FastScript.setEnv('COMPILER', compilerSuite) FastScript.setEnv( 'Include', pdkBasePath + '''Include;''' + compilerBasePath + '''include''') FastScript.setEnv( 'Lib', compilerBasePath + '''lib''' + amd64 + ''';''' + pdkBasePath + '''Lib''' + x64) FastScript.setEnv( 'Path', compilerBasePath + '''bin''' + compilerCrossPath + ''';''' + compilerBasePath + '''bin''' + compilerCrossPath + '''\\1033;''' + compilerBasePath + '''bin;''' + basePath + '''Common7\\IDE;''' + pdkBasePath + '''Bin''') FastScript.setEnv( 'CL_CMD', compilerBasePath + '''bin''' + compilerCrossPath + '''\\cl.exe''') FastScript.setEnv( 'LINK_CMD', compilerBasePath + '''bin''' + compilerCrossPath + '''\\link.exe''') FastScript.setEnv('RC_CMD', pdkBasePath + '''Bin\\RC.Exe''') FastScript.setEnv('MT_CMD', pdkBasePath + '''Bin\\mt.exe''') FastScript.setEnv('DUMPBIN_CMD', compilerBasePath + '''Bin\\dumpbin.exe''') tmp = re.match("^(\S+)-(\S+)-vs(\d+)$", targetPlatform) targetArch = tmp.group(2) sdk = int(tmp.group(3)) Any.requireIsTextNonEmpty(targetArch) Any.requireIsIntNotZero(sdk) # source "ToolBOSPluginWindows" if not already done bspMap = ToolBOSSettings.getConfigOption('BST_crossCompileBSPs') Any.requireIsDictNonEmpty(bspMap) neededBSP = bspMap[targetPlatform] Any.requireIsTextNonEmpty(neededBSP) ProcessEnv.source(neededBSP) logging.debug('using wine from: %s', ProcessEnv.which('wine')) # setup Wine if not FastScript.getEnv('WINEDEBUG'): FastScript.setEnv('WINEDEBUG', '-all') if sdk == 2017: _set_msvc_2017_conf() else: _set_msvc_legacy_conf() # setup arguments which will be passed to CMake fileName = os.path.join(FastScript.getEnv('TOOLBOSCORE_ROOT'), 'include/CMake/Windows-WineMSVC.cmake') Any.requireIsFileNonEmpty(fileName) oldOptions = FastScript.getEnv('BST_CMAKE_OPTIONS') if oldOptions: newOptions = '-DCMAKE_TOOLCHAIN_FILE=%s %s' % (fileName, oldOptions) else: newOptions = '-DCMAKE_TOOLCHAIN_FILE=%s' % fileName FastScript.setEnv('BST_CMAKE_OPTIONS', newOptions) FastScript.unsetEnv('GLIBC_ALIAS') FastScript.unsetEnv('GLIBC_VERSION')
return result #---------------------------------------------------------------------------- # Main program #---------------------------------------------------------------------------- tcRoot = FastScript.getEnv('TOOLBOSCORE_ROOT') hostPlatform = Platforms.getHostPlatform() binDirNoArch = os.path.join(tcRoot, 'bin') Any.requireIsDirNonEmpty(binDirNoArch) # unset VERBOSE and BST_BUILD_JOBS make output comparable origEnv = FastScript.getEnv() FastScript.unsetEnv('VERBOSE') FastScript.unsetEnv('BST_BUILD_JOBS') pyScripts = glob.glob(os.path.join(binDirNoArch, '*.py')) shScripts = glob.glob(os.path.join(binDirNoArch, '*.sh')) executables = glob.glob(os.path.join(binDirNoArch, hostPlatform, '*')) for program in pyScripts + shScripts + executables: basename = os.path.basename(program) Any.requireIsTextNonEmpty(basename) logging.info('processing %s', basename) output = StringIO() cmd = '%s --help' % program