def _create_monica_config(self): mondir = os.path.join("files", "monica") if not os.path.exists(mondir): return def create_out(d): relpath = d.split(os.path.sep, 1)[-1] outd = os.path.join(self._installdir, relpath) if not os.path.exists(outd): os.makedirs(outd) return outd for d, i, files in os.walk(mondir): if d.find('.svn') == -1: if d == mondir: continue template = [tf for tf in files if tf.endswith(".template")] txt = [tf for tf in files if tf.endswith(".txt")] if not template: if not txt: continue outd = create_out(d) for t in txt: shutil.copy(os.path.join(d, t), outd) continue tf = os.path.join(d, template[0]) outd = create_out(d) of = os.path.join(outd, os.path.splitext(template[0])[0]) utils.run("msi -V -I{0} -I{1} -o{2} {3}".format( mondir, d, of, tf))
def _doc(self): self._add_slice_options() slicefiles = glob.glob('*.ice') slicefiles = ' '.join(slicefiles) if utils.in_code_tree(): utils.run('%s %s %s' % (self._bcom, self._opts, slicefiles), self.nowarnings)
def _functest(self): # use nose by default target = 'functests' setup = os.path.join(target, 'setup.py') if os.path.exists(target): if os.path.exists(setup): os.chdir(target) envstr = self._get_env() # handle explicit test target filetarget = "" for o in self._comopts: if o.startswith(target + "/"): filetarget = "--tests=" + os.path.split(o)[-1] cmd = "%s python setup.py -q nosetests --with-xunit " \ "--xunit-file=%s-junit-results.xml %s" \ % (envstr, target, filetarget) clncmd = "python setup.py -q clean" utils.run("%s" % cmd, self.nowarnings, ignore_traceback=True) utils.runcmd("%s" % clncmd) os.chdir(self._bdir) else: pass # fail quietly as they may have run scons tests. else: print "error: missing functests subdirectory in %s" % \ os.path.relpath(self._bdir, self._askaproot)
def _doc(self): self._add_slice_options() slicefiles = glob.glob('*.ice') slicefiles = ' '.join(slicefiles) if utils.in_code_tree(): utils.run('%s %s %s' % (self._bcom, self._opts, slicefiles), self.nowarnings)
def _clean(self): # Cleaning in Tools is done explicitly in rbuild script # and do not want it run a second time and complaining. if not 'Tools' in os.getcwd(): # i.e. in 3rdParty and Code if os.path.exists("setup.py"): utils.run("%s setup.py clean" % self._pycmd) Builder._clean(self)
def _configure(self): if self._ccom: if utils.in_tools_tree(): self._prefix = self._askaproot cmd = "./%s %s --prefix=%s" % (self._ccom, self._opts, self._prefix) utils.run(cmd, self.nowarnings)
def _install(self): self._add_ant_options() if not utils.in_code_tree(): self.add_option('-Dprefix=%s' % self._prefix) utils.run("%s %s install" % (self._icom, self._opts), self.nowarnings) if self._run_script: self._create_run_script()
def _clean(self): # Cleaning in Tools is done explicitly in rbuild script # and do not want it run a second time and complaining. if not 'Tools' in os.getcwd(): # i.e. in 3rdParty and Code if os.path.exists("setup.py"): utils.run("%s setup.py clean" % self._pycmd) Builder._clean(self)
def _clean(self): # Cleaning in Tools is done explicitly in rbuild script # and do not want it run a second time and complaining. if not utils.in_tools_tree(): if os.path.exists("setup.py"): utils.run("%s setup.py clean" % self._pycmd) Builder._clean(self)
def _patch(self): for patch in self._patches: # Always exit patching ok as -N will still return status>1 # for already applied patches. utils.q_print("info: applying patch '%s'." % patch) utils.run("patch -N -p0 -s -d %s < %s; exit 0" % (self._package, patch))
def _install(self): self._add_ant_options() if not utils.in_code_tree(): self.add_option('-Dprefix=%s' % self._prefix) utils.run("%s %s install" % (self._icom, self._opts), self.nowarnings) if self._run_script: self._create_run_script()
def _run_jar(self): for jarbunch in self._jar_cmdlist: if not self._quiet: print "mkdir -p %s" % jarbunch.outdir utils.run("mkdir -p %s" % jarbunch.outdir) if not self._quiet: print "%s %s" % (self._jarcmd, jarbunch.jarargs) utils.run("%s %s" % (self._jarcmd, jarbunch.jarargs))
def _configure(self): if self._ccom: if utils.in_tools_tree(): self._prefix = self._askaproot if not os.path.exists(self._cmakedir): os.makedirs(self._cmakedir) os.chdir(self._cmakedir) utils.run('%s %s -DCMAKE_INSTALL_PREFIX=%s ..' % (self._ccom, self._opts, self._prefix), self.nowarnings)
def _configure(self): if self._ccom: if os.path.abspath(os.curdir).find('Tools') > 0: self._prefix = self._askaproot if not os.path.exists(self._cmakedir): os.makedirs(self._cmakedir) os.chdir(self._cmakedir) utils.run('%s %s -DCMAKE_INSTALL_PREFIX=%s ..' % (self._ccom, self._opts, self._prefix), self.nowarnings)
def _install(self): Builder._install(self) # Create the install directory utils.run("mkdir -p %s" % self._installdir) self._run_copy_trees() # msi has to be first in the case we need to create jar files after # post-executing msi tool self._run_msi() self._run_jar() self._create_release_info(self._installdir)
def _clean(self): if os.path.exists(self._package): curdir = os.path.abspath(os.curdir) # Enter the untarred package directory os.chdir(self._package) if os.path.exists('Makefile'): utils.run("make clean") os.chdir(curdir) # Delete the reminder of the directories Builder._clean(self)
def _clean(self): if os.path.exists(self._package): curdir = os.path.abspath(os.curdir) # Enter the untarred package directory os.chdir(self._package) if os.path.exists('Makefile'): utils.run("make clean") os.chdir(curdir) # Delete the reminder of the directories Builder._clean(self)
def _testtgt(self, target): env = self._get_env() # handle explicit test target filetarget = target for o in self._comopts: if o.startswith(target+"/"): filetarget = o nose = self._pycmd.replace("python", "nosetests") cmd = "%s %s --with-xunit --xunit-file=%s/%s-junit-results.xml"\ " %s" % (env, nose, target, target, filetarget) utils.run("%s" % cmd, self.nowarnings, ignore_traceback=True)
def _testtgt(self, target): env = self._get_env() # handle explicit test target filetarget = target for o in self._comopts: if o.startswith(target+"/"): filetarget = o nose = self._pycmd.replace("python", "nosetests") cmd = "%s %s --with-xunit --xunit-file=%s/%s-junit-results.xml"\ " %s" % (env, nose, target, target, filetarget) utils.run("%s" % cmd, self.nowarnings, ignore_traceback=True)
def _run_msi(self): if not self._msi_in_dep: print "Error: MSI command tool is not in the dependencies. Skipping MSI files" return for msibunch in self._msi_cmdlist: if not self._quiet: print "mkdir -p %s" % msibunch.outdir utils.run("mkdir -p %s" % msibunch.outdir) if not self._quiet: print "%s %s" % (self._msicmd, msibunch.msiargs) utils.run("%s %s" % (self._msicmd, msibunch.msiargs)) if not self._quiet: print "Setting mode %o of output file %s" % (msibunch.fmode, msibunch.outfile) os.chmod(msibunch.outfile, msibunch.fmode)
def _clean(self): if utils.in_code_tree() and os.path.exists('setup.py'): utils.run("python setup.py clean") # Bug #2803 # An ASKAP/EPICS application (pkgname == '.') usually has a configure # directory in the root directory # as opposed to EPICS base and some support modules where the tarball # gets expanded in the pkgname directory. # This feature affects the way the package gets cleaned in order to # support idempotent cleaning command. # In case of ASKAP/EPICS applications, we need to check whether EPICS # base configure directory exists, otherwise # we cannot execute 'make clean' command. If epics base configure # directory exists, a RELEASE.<architecture> file # must exist in the configure directory in order to locate epics base # configure directory for the make command # to work correctly. if self._package == '.': if self._epicsbase_configure_exists(): # RELEASE.<arch> must exists in order to run make clean. # This prevents an error when running clean when the package # has already been cleaned. self._create_releasefile() if not os.path.exists(self._deps_file): open(self._deps_file, 'w').write("") shutil.copy(self._releasefile, os.path.join(self._package, "configure")) if self._oldreleasefile is not None: shutil.copy( self._releasefile, os.path.join(self._package, "configure", self._oldreleasefile)) curdir = os.path.abspath(os.curdir) # Enter the untarred package directory os.chdir(self._package) utils.run("make clean uninstall") os.chdir(curdir) else: utils.q_print( "WARNING: EPICS base configure directory does " "not exists (required by 'make clean'). " "Some temporary files inside the package will not" "be removed. Build EPICS base and re-run clean " "target or delete temporary files manually.") # Execute base class method, which removes install directory and # additional clean targets Builder._clean(self)
def _install(self): if os.path.exists("setupegg.py"): cmd = "%s setupegg.py install" % self._pycmd else: cmd = "%s setup.py install" % self._pycmd if os.getcwd().find("Tools") > 0: msg = "info: 'setuptools egg install', imports use default version." else: msg = "info: 'setuptools in local 'install' directory." installdir = os.path.join(self._bdir, self._installdir) cmd += " --prefix %s" % installdir utils.create_python_tree(installdir) utils.run("%s %s" % (self._get_env(), cmd), self.nowarnings) utils.q_print(msg) self._version_install()
def _install(self): if os.path.exists("setupegg.py"): cmd = "%s setupegg.py install" % self._pycmd else: cmd = "%s setup.py install" % self._pycmd if utils.in_tools_tree(): msg = "info: 'setuptools egg install', imports use default version." else: msg = "info: 'setuptools in local 'install' directory." installdir = os.path.join(self._bdir, self._installdir) cmd += " --prefix %s" % installdir utils.create_python_tree(installdir) utils.run("%s %s" % (self._get_env(), cmd), self.nowarnings) utils.q_print(msg) self._version_install()
def _create_monica_config(self): mondir = os.path.join("files", "monica") if not os.path.exists(mondir): return for d, i ,files in os.walk(mondir): if d.find('.svn') == -1: if d == mondir: continue template = [ tf for tf in files if tf.endswith(".template")] if not template: continue tf = os.path.join(d, template[0]) relpath = d.split(os.path.sep, 1)[-1] outd = os.path.join(self._installdir, relpath) os.makedirs(outd) of = os.path.join(outd, os.path.splitext(template[0])[0]) utils.run("msi -I{0} -I{1} -o{2} {3}".format(mondir, d, of, tf))
def _clean(self): if utils.in_code_tree() and os.path.exists('setup.py'): utils.run("python setup.py clean") # Bug #2803 # An ASKAP/EPICS application (pkgname == '.') usually has a configure # directory in the root directory # as opposed to EPICS base and some support modules where the tarball # gets expanded in the pkgname directory. # This feature affects the way the package gets cleaned in order to # support idempotent cleaning command. # In case of ASKAP/EPICS applications, we need to check whether EPICS # base configure directory exists, otherwise # we cannot execute 'make clean' command. If epics base configure # directory exists, a RELEASE.<architecture> file # must exist in the configure directory in order to locate epics base # configure directory for the make command # to work correctly. if self._package == '.': if self._epicsbase_configure_exists(): # RELEASE.<arch> must exists in order to run make clean. # This prevents an error when running clean when the package # has already been cleaned. self._create_releasefile() if not os.path.exists(self._deps_file): open(self._deps_file, 'w').write("") shutil.copy(self._releasefile, os.path.join(self._package, "configure")) if self._oldreleasefile is not None: shutil.copy(self._releasefile, os.path.join(self._package, "configure", self._oldreleasefile)) curdir = os.path.abspath(os.curdir) # Enter the untarred package directory os.chdir(self._package) utils.run("make clean uninstall") os.chdir(curdir) else: utils.q_print("WARNING: EPICS base configure directory does not ""exists (required by 'make clean'). Some temporary files inside the package will not be removed. Build EPICS base and re-run clean target or delete temporary files manually.") # Execute base class method, which removes install directory and # additional clean targets Builder._clean(self)
def _install_iocboot(self, appname, ioctemplatedir): #iocdir = 'ioc' + appname # jcg: name of the ioc dir should be the name of the ioctemplatedir # instead of appname # to support multiple ioc dirs with same appname iocdir = os.path.basename(ioctemplatedir) iocbootdir = os.path.join(self._installdir, 'iocBoot', iocdir) # Create list of auto-generated lines autogenlines = list() #autogenlines.append('#!../../bin/%s/%s\n' % (self._epicsarch, appname)) autogenlines.append('#!/usr/bin/env %s\n' % appname) autogenlines.append('epicsEnvSet(\"ARCH\", %s)\n' % self._epicsarch) autogenlines.append('epicsEnvSet(\"IOC\", %s)\n' % iocdir) autogenlines.append('epicsEnvSet("ENGINEER", "ASKAP Operations")\n') autogenlines.append('epicsEnvSet("LOCATION", "MRO")\n') autogenlines.append('cd ${IOC_ROOT}/iocBoot/${IOC}\n') if not os.path.exists(iocbootdir): os.makedirs(iocbootdir) # List files inside ioctemplatedir (where st.cmd.template and # other files are located) iocfilelist = os.listdir(ioctemplatedir) for iocfile in iocfilelist: if os.path.isdir(os.path.join(ioctemplatedir, iocfile)): continue # Skip directories if iocfile == 'st.cmd.template': # Open the startup script and add the auto-generated lines stcmdfile = os.path.join(iocbootdir, 'st.cmd') with open(stcmdfile, 'w') as stcmdfileobj: stcmdfileobj.writelines(autogenlines) # Open template file and write all its contents to stcmd with open(os.path.join(ioctemplatedir, 'st.cmd.template'), 'rU') \ as templfileobj: stcmdfileobj.writelines(templfileobj.readlines()) else: # Copy the file in installdir/iocBoot shutil.copy(os.path.join(ioctemplatedir, iocfile), iocbootdir) # Add executable permissions to st.cmd if os.path.exists(os.path.join(iocbootdir, 'st.cmd')): utils.run('chmod a+x %s' % os.path.join(iocbootdir, 'st.cmd'))
def _unpack(self): if (os.path.exists(self._package) and self.is_up_to_date()) \ or self._tarname is None: return suffdict = { ".gz": "tar zxf", ".tgz": "tar zxf", ".bz2": "tar jxf", ".zip": "unzip", ".jar": "jar xf" } found = False for key, value in suffdict.iteritems(): if self._tarname.endswith(key): unpack = value found = True break if not found: raise BuildError("source archive not found") if self._extractdir: unpack += " %s" % os.path.join(self._bdir, self._tarname) utils.run("mkdir -p %s" % self._extractdir) os.chdir(self._extractdir) utils.run("%s" % unpack) os.chdir(self._bdir) else: unpack += " %s" % self._tarname utils.run("%s" % unpack)
def _install_iocboot(self, appname, ioctemplatedir): #iocdir = 'ioc' + appname # jcg: name of the ioc dir should be the name of the ioctemplatedir # instead of appname # to support multiple ioc dirs with same appname iocdir = os.path.basename(ioctemplatedir) iocbootdir = os.path.join(self._installdir, 'iocBoot', iocdir) # Create list of auto-generated lines autogenlines = list() #autogenlines.append('#!../../bin/%s/%s\n' % (self._epicsarch, appname)) autogenlines.append('#!/usr/bin/env %s\n' % appname) autogenlines.append('epicsEnvSet(\"ARCH\", %s)\n' % self._epicsarch) autogenlines.append('epicsEnvSet(\"IOC\", %s)\n' % iocdir) autogenlines.append('epicsEnvSet("ENGINEER", "ASKAP Operations")\n') autogenlines.append('epicsEnvSet("LOCATION", "MRO")\n') autogenlines.append('cd ${IOC_ROOT}/iocBoot/${IOC}\n') if not os.path.exists(iocbootdir): os.makedirs(iocbootdir) # List files inside ioctemplatedir (where st.cmd.template and # other files are located) iocfilelist = os.listdir(ioctemplatedir) for iocfile in iocfilelist: if os.path.isdir(os.path.join(ioctemplatedir, iocfile)): continue # Skip directories if iocfile == 'st.cmd.template': # Open the startup script and add the auto-generated lines stcmdfile = os.path.join(iocbootdir, 'st.cmd') with open(stcmdfile, 'w') as stcmdfileobj: stcmdfileobj.writelines(autogenlines) # Open template file and write all its contents to stcmd with open(os.path.join(ioctemplatedir, 'st.cmd.template'), 'rU') \ as templfileobj: stcmdfileobj.writelines(templfileobj.readlines()) else: # Copy the file in installdir/iocBoot shutil.copy(os.path.join(ioctemplatedir, iocfile), iocbootdir) # Add executable permissions to st.cmd if os.path.exists(os.path.join(iocbootdir, 'st.cmd')): utils.run('chmod a+x %s' % os.path.join(iocbootdir, 'st.cmd'))
def _configure(self): if self._ccom: if os.path.abspath(os.curdir).find("Tools") > 0: self._prefix = self._askaproot cmd = "./%s %s --prefix=%s" % (self._ccom, self._opts, self._prefix) utils.run(cmd, self.nowarnings)
def _build(self): if self._bcom: for btgt in self._btargets: utils.run('%s %s %s' % (self._bcom, self.get_parallel_opt(), btgt), self.nowarnings)
def _build(self): if self._bcom: utils.run(self._bcom, self.nowarnings)
def _build(self): if self._bcom: for btgt in self._btargets: utils.run( '%s %s %s' % (self._bcom, self.get_parallel_opt(), btgt), self.nowarnings)
def _clean(self): if utils.in_code_tree(): utils.run("%s %s clean" % (self._icom, self._opts)) Builder._clean(self)
def _test(self): self._add_ant_options() if utils.in_code_tree(): utils.run("%s %s test" % (self._icom, self._opts))
def _build(self): if self._bcom: for btgt in self._btargets: cmd = "%s %s %s" % (self._bcom, self.get_parallel_opt(), btgt) utils.run(cmd, self.nowarnings)
def _doc(self): if not utils.in_code_tree() and not utils.in_dev_tree(): return env = self._get_env() cmd = "%s %s setup.py doc" % (env, self._pycmd) utils.run("%s" % cmd, self.nowarnings)
def _doc(self): if utils.in_code_tree() and os.path.exists('setup.py'): env = self._get_env() cmd = "%s python setup.py doc" % (env, ) utils.run("%s" % cmd, self.nowarnings)
def _configure(self): if self._ccom: utils.run("%s %s \"PKG_INSTALL_BASE=%s\"" % (self._ccom, self._opts, self._prefix), self.nowarnings)
def configure(): utils.run("./configure --prefix %s" % ASKAP_ROOT)
def _doc(self): if utils.in_code_tree() and os.path.exists('setup.py'): env = self._get_env() cmd = "%s python setup.py doc" % (env,) utils.run("%s" % cmd, self.nowarnings)
def _doc(self): self._add_ant_options() if utils.in_code_tree(): utils.run("%s %s doc" % (self._icom, self._opts))
def _test(self): self._add_ant_options() if utils.in_code_tree(): utils.run("%s %s test" % (self._icom, self._opts))
def _build(self): if not self.has_extension: return cmd = "%s setup.py build_ext %s" % (self._pycmd, self._opts) utils.run("%s" % cmd, self.nowarnings)
def _doc(self): self._add_ant_options() if utils.in_code_tree(): utils.run("%s %s doc" % (self._icom, self._opts))
def _doc(self): if not utils.in_code_tree() and not utils.in_dev_tree(): return env = self._get_env() cmd = "%s %s setup.py doc" % (env, self._pycmd) utils.run("%s" % cmd, self.nowarnings)
def _clean(self): if utils.in_code_tree(): utils.run("%s %s clean" % (self._icom, self._opts)) Builder._clean(self)
def _build(self): if not self.has_extension: return cmd = "%s setup.py build_ext %s" % (self._pycmd, self._opts) utils.run("%s" % cmd, self.nowarnings)
def _install(self): if self._icom: utils.run(self._icom, self.nowarnings) self._version_install()