def npm_install(skel_dir, options): shellCmd = ShellCmd() npm_install = 'npm install --loglevel warn' console.log("Adding Node.js modules...") shellCmd.execute(npm_install, skel_dir) if options.type == 'contribution': shellCmd.execute(npm_install, os.path.join(skel_dir, 'demo/default'))
def cleanDownloadCache(self): if self._downloads: downdir = self._downloads if os.path.splitdrive(downdir)[1] == os.sep: raise RuntimeError, "I'm not going to delete '/' recursively!" self._console.info("Deleting download cache") ShellCmd().rm_rf(downdir)
def getQooxdooRevision(): shellCmd = ShellCmd() rcode, out, err = shellCmd.execute_piped("svnversion") if rcode > 0 or out == "exported": return "unknown" else: return "unknown" #out.rstrip()
def runShellCommand(self, shellcmd): rc = 0 self._shellCmd = ShellCmd() self._console.info("Executing shell command \"%s\"..." % shellcmd) self._console.indent() rc = self._shellCmd.execute(shellcmd, self._config.getConfigDir()) if rc != 0: raise RuntimeError, "Shell command returned error code: %s" % repr(rc) self._console.outdent()
def runShellCommand(self, shellcmd, cmdnotfoundmsg=""): rc = 0 self._shellCmd = ShellCmd() self._console.info("Executing shell command \"%s\"..." % shellcmd) self._console.indent() rc = self._shellCmd.execute(shellcmd, self._config.getConfigDir()) if rc != 0: # BUG #7997 (sass may not be installed) # 127 = given cmd is not found within PATH sys var and it's not a built-in shell cmd if (rc == 127 or (rc == 1 and platform.system() == "Windows")) and cmdnotfoundmsg: self._console.info("Skipping shell command: %s" % cmdnotfoundmsg) else: raise RuntimeError, "Shell command returned error code: %s" % repr(rc) self._console.outdent()
def __init__(self, console_, data, path="", **letKwargs): global console # init members self._console = console_ self._data = None self._rawdata = None self._fname = None self._shellCmd = ShellCmd() self._includedConfigs = [] # to record included configs self._shadowedJobs = { } # to record shadowed jobs, of the form {<shadowed_job_obj>: <shadowing_job_obj>} console = console_ # dispatch on argument if isinstance(data, (types.DictType, types.ListType)): #self._console.debug("Creating config from data") self.__init__data(data, path) elif isinstance(data, types.StringTypes): #self._console.debug("Reading config file \"%s\"" % data) self.__init_fname(data) else: raise TypeError, str(data) # make sure there is at least an empty jobs map (for later filling) if isinstance(self._data, types.DictType) and Key.JOBS_KEY not in self._data: self._data[Key.JOBS_KEY] = {} # incorporate let macros from letkwargs if letKwargs: if not Key.LET_KEY in self._data: self._data[Key.LET_KEY] = {} self._data[Key.LET_KEY].update(letKwargs) # expand macros for some top-level keys self.expandTopLevelKeys() # fix job key tags (like "=key") self.fixJobsTags() # do some schema sanity checking # - off for bug#4441, it's called for the job in generator.py anyway #self.checkSchema() return
def runSimulation(jobconf): console = Context.console console.info("Running Simulation...") argv = [] javaBin = "java" javaClassPath = "-cp" argv.extend((javaBin, javaClassPath)) configClassPath = jobconf.get("simulate/java-classpath", []) qxSeleniumPath = jobconf.get("simulate/qxselenium-path", False) if qxSeleniumPath: configClassPath.append(qxSeleniumPath) classPathSeparator = ":" if util.getPlatformInfo()[0] == "Windows": classPathSeparator = ";" configClassPath = classPathSeparator.join(configClassPath) if "CYGWIN" in util.getPlatformInfo()[0]: configClassPath = "`cygpath -wp " + configClassPath + "`" argv.append(configClassPath) rhinoClass = jobconf.get("simulate/rhino-class", "org.mozilla.javascript.tools.shell.Main") runnerScript = jobconf.get("simulate/simulator-script") argv.extend((rhinoClass, runnerScript)) cmd = " ".join(textutil.quoteCommandArgs(argv)) settings = jobconf.get("environment", None) for key in settings: if type(settings[key]) == unicode: settings[key] = settings[key].replace(" ", "$") if settings: settings = json.dumps(settings, separators=(",", ":")) settings = settings.replace('"','\\"').replace("{", "\{").replace("}", "\}") settings = "settings=" + settings cmd += " " + settings console.debug("Selenium start command: " + cmd) shell = ShellCmd() shell.execute_logged(cmd, console, True)
def __init__(self, console_, data, path=""): global console # init members self._console = console_ self._data = None self._fname = None self._shellCmd = ShellCmd() console = console_ # dispatch on argument if isinstance(data, (types.DictType, types.ListType)): self.__init__data(data, path) elif isinstance(data, types.StringTypes): self.__init_fname(data) else: raise TypeError, str(data) # make sure there is at least an empty jobs map (for later filling) if isinstance(self._data, types.DictType) and self.JOBS_KEY not in self._data: self._data[self.JOBS_KEY] = {}
def runMigration(jobconf, libs): if not jobconf.get('migrate-files', False): return console = Context.console console.info( "Please heed the warnings from the configuration file parsing") console.info( "Migrating Javascript source code to most recent qooxdoo version...") console.indent() migSettings = jobconf.get('migrate-files') shellCmd = ShellCmd() migratorCmd = os.path.join(os.path.dirname(filetool.root()), "bin", "migrator.py") libPaths = [] for lib in libs: lib._init_from_manifest() # Lib()'s aren't initialized yet libPaths.append(os.path.join(lib.path, lib.classPath)) mig_opts = [] if migSettings.get('from-version', False): mig_opts.extend(["--from-version", migSettings.get('from-version')]) if migSettings.get('migrate-html'): mig_opts.append("--migrate-html") mig_opts.extend(["--class-path", ",".join(libPaths)]) shcmd = " ".join( textutil.quoteCommandArgs([sys.executable, migratorCmd] + mig_opts)) console.debug("Invoking migrator as: '%s'" % shcmd) shellCmd.execute(shcmd) console.outdent()
def npm_install(skelDir, options): shellCmd = ShellCmd() npm_install = 'npm install --loglevel warn' console.log("Running '" + npm_install + "'") shellCmd.execute(npm_install, skelDir)
def __init__(self, config, console_): self._config = config self._console = console_ self._shellCmd = ShellCmd()
import codecs import copy import tempfile scriptDir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(scriptDir, "../../pylib")) import demjson from generator.runtime.Log import Log from generator.runtime.ShellCmd import ShellCmd from misc import filetool global console console = Log(None, "info") global shell shell = ShellCmd() qxPatchReleases = { "3.0": "3.0.2", "2.1": "2.1.1", "2.0": "2.0.4", "1.6": "1.6.1", "1.5": "1.5.1", "1.4": "1.4.2", "1.3": "1.3.1", "1.2": "1.2.2", "1.1": "1.1.2", "1.0": "1.0.2" }
def npm_install(skel_dir, options): shellCmd = ShellCmd() shellCmd.execute('npm install', skel_dir) if options.type == 'contribution': shellCmd.execute('npm install', os.path.join(skel_dir, 'demo/default'))