def setupLegacyMSVC(configDir): from ToolBOSCore.Storage.SIT import getPath sitRootPath = getPath() packageName = 'Data/wine.net/0.1' handmadeDir = os.path.join(sitRootPath, packageName, 'config') userName = FastScript.getCurrentUserName() if not os.path.exists(handmadeDir): raise AssertionError('%s: No such package in SIT' % packageName) if not userName: raise AssertionError('Unable to query username :-(') # replace 'Program Files' and 'windows' directories in configDir by # symlinks to handmade directories in SIT for item in ('Program Files', 'windows'): path = os.path.join(configDir, 'drive_c', item) Any.requireIsDir(path) FastScript.remove(path) target = os.path.join(handmadeDir, 'drive_c', item) FastScript.link(target, path) # copy all the handmade *.reg files regFiles = glob.glob("%s/*.reg" % handmadeDir) Any.requireIsListNonEmpty(regFiles) for srcFilePath in regFiles: fileName = os.path.basename(srcFilePath) dstFilePath = os.path.join(configDir, fileName) logging.debug('cp %s %s', srcFilePath, dstFilePath) shutil.copyfile(srcFilePath, dstFilePath) Any.requireIsFileNonEmpty(dstFilePath) # replace occurrences of 'roberto' by username oldContent = FastScript.getFileContent(dstFilePath) newContent = oldContent.replace('roberto', userName) FastScript.setFileContent(dstFilePath, newContent)
#---------------------------------------------------------------------------- sitRootPath = SIT.getDefaultRootPath() sitProxyPath = SIT.getDefaultProxyPath() shell = FastScript.getEnv('SHELL') version = ToolBOSSettings.packageVersion subtitle = '~ Welcome to ToolBOS SDK %s ~' % version #---------------------------------------------------------------------------- # Commandline parsing #---------------------------------------------------------------------------- # Replace the username in the sitProxyPath by a generic placeholder so that # the unittests relying on the consistent output will pass, see TBCORE-1378. userName = FastScript.getCurrentUserName() sitProxyPathHelp = sitProxyPath.replace(userName, '<user>') desc = 'Configures your shell for using the ToolBOS SDK.' argman = ArgsManagerV2.ArgsManager(desc) argman.addArgument('-r', '--rootDir', metavar='PATH', default=sitRootPath, help='path to global SIT (default: %s)' % sitRootPath) argman.addArgument('-p', '--proxyDir', metavar='PATH',
def setupMSVC2012(configDir): """ Configures the Microsoft Visual Compiler to be used with Wine from the ToolBOS build system. You may provide a path to the directory where your Wine configuration is. If omitted, the path returned from getWineConfigDir() will be used. """ from ToolBOSCore.Storage.SIT import getPath if not os.path.exists(os.path.join(configDir, 'user.reg')): setupWineDotNet(configDir) Any.requireIsDir(configDir) if not os.path.exists(os.path.join(configDir, 'dosdevices')): setupWineDotNet(configDir) logging.info('setting up Visual Studio...') linkPath = os.path.join(configDir, 'dosdevices', 'c:') linkTarget = '../drive_c' FastScript.remove(linkPath) FastScript.link(linkTarget, linkPath) linkPath = os.path.join(configDir, 'dosdevices', 'z:') linkTarget = '/' FastScript.remove(linkPath) FastScript.link(linkTarget, linkPath) # create temp. directories driveC = os.path.join(configDir, 'drive_c') userName = FastScript.getCurrentUserName() userTempDir = os.path.join(driveC, 'users', userName, 'Temp') sysTempDir = os.path.join(driveC, 'temp') logging.debug('userTempDir=%s', userTempDir) FastScript.mkdir(userTempDir) FastScript.mkdir(sysTempDir) # ensure to NOT have the "h:" link, else wine would not find some links FastScript.remove(os.path.join(configDir, 'dosdevices', 'h:')) # replace "C:\Program Files" by symlink into SIT FastScript.remove(os.path.join(configDir, 'drive_c', 'Program Files')) sitPath = getPath() linkPath = os.path.join(configDir, 'drive_c', 'msvc-sdk') linkTarget = os.path.join(sitPath, 'External/MSVC/10.0/msvc-sdk') FastScript.remove(linkPath) FastScript.link(linkTarget, linkPath) linkPath = os.path.join(configDir, 'drive_c', 'Program Files') linkTarget = os.path.join(sitPath, 'External/MSVC/10.0/Program Files') FastScript.remove(linkPath) FastScript.link(linkTarget, linkPath) # copy a hancrafted system.reg srcFile = os.path.join( sitPath, 'External/MSVC/10.0/otherstuff/winevs2012/system.reg') dstFile = os.path.join(configDir, 'system.reg') shutil.copyfile(srcFile, dstFile) # force wine to use the MSVC native library userReg = os.path.join(configDir, 'user.reg') Any.requireIsFileNonEmpty(userReg) content = FastScript.getFileContent(userReg) if content.find('1413877490') == -1: content += \ ''' [Software\\\\Wine\\\\DllOverrides] 1413877490 "mscoree"="native" "msvcr110"="native" ''' logging.debug('updating %s', userReg) FastScript.setFileContent(userReg, content)
def _retrieveCurrentUser(self): self.userAccount = FastScript.getCurrentUserName() self.userName = FastScript.getCurrentUserFullName() if not self.userName: self.userName = self.userAccount