def handle_describe_xml_file(): __has_expected_jar__ = False __found_jar__ = None __handled_expected_xml__ = False logger.info('Begin handling the describe.xml file.') for dirname,folders,files in _utils.walk(__source_build_deploy__): logger.info('Begin first pass through folders in "%s" while handling the describe.xml file.' % (dirname)) for f in folders: _f_ = dirname+os.sep+f if (_f_.find('%sbuild%sdeploy%s' % (os.sep,os.sep,os.sep)) > -1): if (__expected_jar__ in files): __has_expected_jar__ = True break else: found_jars = [n for n in files if (n.find('.jar') > -1)] __found_jar__ = found_jars[0] if (len(found_jars) > 0) else __found_jar__ logger.info('Done with first pass through folders in "%s" while handling the describe.xml file.' % (dirname)) for dirname,folders,files in _utils.walk(__source_conf__): if ((not __handled_expected_xml__) and __incrementbuildnumber__ and (dirname.find('%sbuild%sdeploy%s' % (os.sep,os.sep,os.sep)) == -1)): logger.info('Begin second pass through files in "%s" while handling the describe.xml file.' % (dirname)) for f in files: if (f == 'describe.xml'): _f_ = dirname+os.sep+f _b_ = _f_+'.new' logger.info('Opening "%s".' % (_f_)) fIn = open(_f_,'r') fOut = open(_b_,'w') logger.info('Opening "%s".' % (_b_)) for l in fIn: logger.info('Reading a line from "%s".' % (fIn.name)) if (l.find('<AdapterKind') > -1): so = SmartObject(dict([tuple(t.split('=')) for t in l.replace('<','').replace('>','').replace('AdapterKind ','').split(' ')])) if (so.version): so.version = '%d' % (int(so.version.replace('"','').strip())+1) if (not __override__) and (so.key.replace('"','') != __adaptername__): so.key = __adaptername__ logger.warning('Seems like your describe.xml file has a problem with the key field of the AdapterKind tag; the key should match the adaptername and this has been changed for you.') d = so.asPythonDict() v = ['%s="%s"' % (k,v) for k,v in d.iteritems()] l = '<AdapterKind %s>' % (' '.join(v)) l = l.replace('""','"') l = l.rstrip() if (len(l) > 0): print >>fOut, l logger.info('Writing a line into "%s".' % (fOut.name)) fOut.flush() fOut.close() logger.info('Closing "%s".' % (fOut.name)) fIn.close() logger.info('Closing "%s".' % (fIn.name)) os.remove(_f_) logger.info('Removed "%s".' % (_f_)) os.rename(_b_, _f_) logger.info('Renamed "%s" --> "%s".' % (_b_, _f_)) __handled_expected_xml__ = True break logger.info('Done with second pass through files in "%s" while handling the describe.xml file.' % (dirname)) logger.info('Done handling the describe.xml file.') return __has_expected_jar__, __found_jar__, __handled_expected_xml__
def _collectFromPath(fpath,option=PathCollectionOptions.collect_files,rejecting_re=None): '''See the PathCollectionOptions for the details.''' import os import logging from vyperlogix.hash import lists d_files = lists.HashedLists2() if (os.path.exists(fpath)): for root, dirs, files in _utils.walk(fpath, topdown=True, rejecting_re=rejecting_re): if (option.value == PathCollectionOptions.collect_files.value): for f in files: _fname = os.sep.join([root,f]) d_files[_fname] = _fname elif (option.value == PathCollectionOptions.collect_dirs.value): d_files[root] = dirs return d_files
dstname = __denormalize__(__dest__+''+source_root) sftp = __sftp__() cmd = 'mkdir %s' % (dstname) responses = sftp.exec_command(cmd) logger.info(cmd) logger.info('\n'.join(responses)) ######################################################################## ioTimeAnalysis.ioBeginTime(__pakbuilder_eclipse_project_tar_symbol__) __tar_dest__ = '%s%s%s.tar.gz' % (os.path.dirname(__source__),os.sep,os.path.basename(__source__)) logger.info('INFO: tar %s --> %s' % (__source__, __tar_dest__)) tarutils.tar_to_file_or_folder(__source__, __tar_dest__,compression=tarutils.TarCompressionTypes.gz) ioTimeAnalysis.ioEndTime(__pakbuilder_eclipse_project_tar_symbol__) ######################################################################## if (not _isExperimental): ioTimeAnalysis.ioBeginTime(__pakbuilder_eclipse_project_upload_symbol__) for dirname,folders,files in _utils.walk(__source__): for f in folders: dstname = __denormalize__(__dest__+''+dirname.replace(source_bias,'')+'/'+f) sftp = __sftp__() cmd = 'mkdir %s' % (dstname) responses = sftp.exec_command(cmd) logger.info(cmd) logger.info('\n'.join(responses)) for dirname,folders,files in _utils.walk(__source__): for f in files: src = dirname+os.sep+f dstname = __denormalize__(__dest__+''+dirname.replace(source_bias,'')+'/'+f) logger.info('%s --> %s' % (src,dstname)) sftp = __sftp__() client = sftp.getSFTPClient client.put(src, dstname, callback=__callback__)
_name = os.path.basename(os.path.basename(sys.argv[0])) print _name _rx=re.compile('[.]svn') fp = os.path.abspath('.') folders = [f for f in os.listdir(fp) if (os.path.isdir(f)) and (_rx.search(f) is None) and (f != 'dist')] folders.append(fp) compileall.compile_dir(fp, rx=re.compile('/[.]svn'), force=True) x = '%sdist' % (os.sep) d = {} for root, dirs, files in _utils.walk(fp,rejecting_re=_rx): inRoot = (root == fp) inLogs = (root.endswith('%slogs' % (os.sep))) if (root.find(x) == -1) and (not inLogs): if (inRoot): files = [f for f in files if (not f.startswith('compile-all.'))] d_ext = lists.HashedLists() for f in files: toks = os.path.splitext(f) d_ext[toks[-1]] = os.path.join(root,f) try: pyo_files = [os.path.join(root,f) for f in d_ext['.pyo']] except: pyo_files = [] for f in pyo_files: f_new = '.'.join([os.path.splitext(f)[0],'pyc'])