rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
utils.logger.info( 'find single query execution - started' )
|
utils.logger.debug( 'find single query execution - started' )
|
def _find_single( self, match_class, **keywds ): utils.logger.info( 'find single query execution - started' ) start_time = time.clock() norm_keywds = self.__normalize_args( **keywds ) matcher = self.__create_matcher( match_class, **norm_keywds ) dtype = self.__findout_decl_type( match_class, **norm_keywds ) recursive_ = self.__findout_recursive( **norm_keywds ) decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) found = matcher_module.matcher.get_single( matcher, decls, False ) utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) return found
|
utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) )
|
utils.logger.debug( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) )
|
def _find_single( self, match_class, **keywds ): utils.logger.info( 'find single query execution - started' ) start_time = time.clock() norm_keywds = self.__normalize_args( **keywds ) matcher = self.__create_matcher( match_class, **norm_keywds ) dtype = self.__findout_decl_type( match_class, **norm_keywds ) recursive_ = self.__findout_recursive( **norm_keywds ) decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) found = matcher_module.matcher.get_single( matcher, decls, False ) utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) return found
|
utils.logger.info( 'find all query execution - started' )
|
utils.logger.debug( 'find all query execution - started' )
|
def _find_multiple( self, match_class, **keywds ): utils.logger.info( 'find all query execution - started' ) start_time = time.clock() norm_keywds = self.__normalize_args( **keywds ) matcher = self.__create_matcher( match_class, **norm_keywds ) dtype = self.__findout_decl_type( match_class, **norm_keywds ) recursive_ = self.__findout_recursive( **norm_keywds ) allow_empty = self.__findout_allow_empty( **norm_keywds ) decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) found = matcher_module.matcher.find( matcher, decls, False ) mfound = mdecl_wrapper.mdecl_wrapper_t( found ) utils.logger.info( '%d declaration(s) that match query' % len(mfound) ) utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) if not mfound and not allow_empty: raise RuntimeError( "Multi declaration query returned 0 declarations." ) return mfound
|
utils.logger.info( '%d declaration(s) that match query' % len(mfound) ) utils.logger.info( 'find single query execution - done( %f seconds )'
|
utils.logger.debug( '%d declaration(s) that match query' % len(mfound) ) utils.logger.debug( 'find single query execution - done( %f seconds )'
|
def _find_multiple( self, match_class, **keywds ): utils.logger.info( 'find all query execution - started' ) start_time = time.clock() norm_keywds = self.__normalize_args( **keywds ) matcher = self.__create_matcher( match_class, **norm_keywds ) dtype = self.__findout_decl_type( match_class, **norm_keywds ) recursive_ = self.__findout_recursive( **norm_keywds ) allow_empty = self.__findout_allow_empty( **norm_keywds ) decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) found = matcher_module.matcher.find( matcher, decls, False ) mfound = mdecl_wrapper.mdecl_wrapper_t( found ) utils.logger.info( '%d declaration(s) that match query' % len(mfound) ) utils.logger.info( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) if not mfound and not allow_empty: raise RuntimeError( "Multi declaration query returned 0 declarations." ) return mfound
|
defines a mapping between funcdamental type name and its synonym to the instance
|
defines a mapping between fundamental type name and its synonym to the instance
|
def __init__( self ): java_fundamental_t.__init__( self, jboolean_t.JNAME )
|
operator.name = 'operator' + operator.name
|
if 'new' in operator.name or 'delete' in operator.name: operator.name = 'operator ' + operator.name else: operator.name = 'operator' + operator.name
|
def __read_free_operator(self, attrs ): operator = self.__decl_factory.create_free_operator() self.__read_member_function( operator, attrs ) operator.name = 'operator' + operator.name return operator
|
, allow_empty=allow_empty)
|
, allow_empty=allow_empty) def __getitem__(self, name_or_function): """ Allow simple name based find of decls. Internally just calls decls() method. @param name_or_function Name of decl to lookup or finder function. """ return self.decls(name_or_function)
|
, decl_type=self._impl_decl_types[ scopedef_t.typedef ]
|
elif sys.platform == 'linux2':
|
elif sys.platform == 'linux2' or sys.platform == 'darwin':
|
def __raise_on_wrong_settings(self): if not os.path.isfile( self.__config.gccxml_path ): if sys.platform == 'win32': gccxml_name = 'gccxml' + '.exe' environment_var_delimiter = ';' elif sys.platform == 'linux2': gccxml_name = 'gccxml' environment_var_delimiter = ':' else: raise RuntimeError( 'unable to find out location of gccxml' ) may_be_gccxml = os.path.join( self.__config.gccxml_path, gccxml_name ) if os.path.isfile( may_be_gccxml ): self.__config.gccxml_path = may_be_gccxml else: for path in os.environ['PATH'].split( environment_var_delimiter ): gccxml_path = os.path.join( path, gccxml_name ) if os.path.isfile( gccxml_path ): self.__config.gccxml_path = gccxml_path break else: msg = 'gccxml_path("%s") should exists or to be a valid file name.' \ % self.__config.gccxml_path raise RuntimeError( msg ) if not os.path.isdir( self.__config.working_directory ): msg = 'working_directory("%s") should exists or to be a valid directory name.' \ % self.__config.working_directory raise RuntimeError( msg ) for include_path in self.__config.include_paths: if not os.path.isdir( include_path ): msg = 'include path "%s" should exists or to be a valid directory name.' \ % include_path raise RuntimeError( msg )
|
if 'win' in sys.platform:
|
if 'win32' in sys.platform:
|
def __create_command_line(self, file, xmlfile): assert isinstance( self.__config, config.config_t ) #returns cmd = [] #first is gccxml executable if 'win' in sys.platform: cmd.append( '"%s"' % os.path.normpath( self.__config.gccxml_path ) ) else: cmd.append( '%s' % os.path.normpath( self.__config.gccxml_path ) ) #second all additional includes directories cmd.append( ''.join( [' -I"%s"' % search_dir for search_dir in self.__search_directories] ) ) #third all additional defined symbols cmd.append( ''.join( [' -D"%s"' % defined_symbol for defined_symbol in self.__config.define_symbols] ) ) cmd.append( ''.join( [' -U"%s"' % undefined_symbol for undefined_symbol in self.__config.undefine_symbols] ) ) #fourth source file cmd.append( '"%s"' % file ) #five destination file cmd.append( '-fxml="%s"' % xmlfile ) if self.__config.start_with_declarations: cmd.append( '-fxml-start="%s"' % ','.join( self.__config.start_with_declarations ) ) cmd_line = ' '.join(cmd) if 'win' in sys.platform : cmd_line = '"%s"' % cmd_line logger.debug( 'gccxml cmd: %s' % cmd_line ) return cmd_line
|
type = remove_alias( type ) return remove_cv( type ).decl_string in decl_strings
|
if isinstance( type, types.StringTypes ): return type in decl_strings else: type = remove_alias( type ) return remove_cv( type ).decl_string in decl_strings
|
def is_std_string( type ): decl_strings = [ '::std::basic_string<char,std::char_traits<char>,std::allocator<char> >' , '::std::basic_string<char, std::char_traits<char>, std::allocator<char> >' , '::std::string' ] type = remove_alias( type ) return remove_cv( type ).decl_string in decl_strings
|
symcodes.append(j, i)
|
symcodes.append((j, i))
|
def _update_keymap(self, first_keycode, count):
|
self.request_queue.append(request, wait_for_response)
|
self.request_queue.append((request, wait_for_response))
|
def send_request(self, request, wait_for_response):
|
raise BadDataError('Invalid property data format %s' % format)
|
raise BadDataError('Invalid property data format %d' % format)
|
def pack_value(self, value):
|
request.PolSegment(display = self.display, onerror = onerror, drawable = self.id, gc = gc, segments = [(x1, y1, x2, y2)])
|
request.PolySegment(display = self.display, onerror = onerror, drawable = self.id, gc = gc, segments = [(x1, y1, x2, y2)])
|
def line(self, gc, x1, y1, x2, y2, onerror = None):
|
self.get_waiting_request(e.sequence_number)
|
self.get_waiting_request((e.sequence_number - 1) % 65536)
|
def parse_event_response(self, etype):
|
self.default_screen = max(self.default_screen, len(self.info.roots) - 1)
|
self.default_screen = min(self.default_screen, len(self.info.roots) - 1)
|
def __init__(self, display = None):
|
return map(lambda x: x[1], self._keymap_syms[keysym])
|
return map(lambda x: (x[1], x[0]), self._keymap_syms[keysym])
|
def keysym_to_keycodes(self, keysym):
|
for keysym, code in self._keymap_syms.items(): if code >= first_keycode and code < lastcode: symcodes = self._keymap_syms[keysym] i = 0 while i < len(symcodes): if symcodes[i][1] == code: del symcodes[i] else: i = i + 1
|
for keysym, codes in self._keymap_syms.items(): i = 0 while i < len(codes): code = codes[i][1] if code >= first_keycode and code < lastcode: del codes[i] else: i = i + 1
|
def _update_keymap(self, first_keycode, count):
|
i = first_keycode
|
code = first_keycode
|
def _update_keymap(self, first_keycode, count):
|
j = 0
|
index = 0
|
def _update_keymap(self, first_keycode, count):
|
symcodes.append((j, i))
|
symcodes.append((index, code))
|
def _update_keymap(self, first_keycode, count):
|
self._keymap_syms[sym] = [(j, i)]
|
self._keymap_syms[sym] = [(index, code)]
|
def _update_keymap(self, first_keycode, count):
|
j = j + 1 i = i + 1
|
index = index + 1 code = code + 1
|
def _update_keymap(self, first_keycode, count):
|
self._update_keymap(evt.first_keycode, evt.count)
|
if evt.request == X.MappingKeyboard: self._update_keymap(evt.first_keycode, evt.count)
|
def refresh_keyboard_mapping(self, evt): """This method should be called once when a MappingNotify event is received, to update the keymap cache. evt should be the event object."""
|
self._update_keymap(self, evt.first_keycode, evt.count)
|
self._update_keymap(evt.first_keycode, evt.count)
|
def refresh_keyboard_mapping(self, evt):
|
if recv:
|
if recv or flush:
|
def send_and_recv(self, flush = None, event = None, request = None, recv = None):
|
fcntl.fcntl(s.fileno(), FCNTL.F_SETFD, FCNTL.FD_CLOEXEC)
|
fcntl.fcntl(s.fileno(), F_SETFD, FD_CLOEXEC)
|
def get_socket(dname, host, dno): try: # If hostname (or IP) is provided, use TCP socket if host: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, 6000 + dno)) # Else use Unix socket else: s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.connect('/tmp/.X11-unix/X%d' % dno) except socket.error, val: raise error.DisplayConnectionError(dname, str(val)) # Make sure that the connection isn't inherited in child processes fcntl.fcntl(s.fileno(), FCNTL.F_SETFD, FCNTL.FD_CLOEXEC) return s
|
rq.Card8('key_click_percent,'), rq.Card8('bell_percent,'),
|
rq.Card8('key_click_percent'), rq.Card8('bell_percent'),
|
def __len__(self):
|
BaseSolver.initialize(self. application)
|
BaseSolver.initialize(self, application)
|
def initialize(self, application): BaseSolver.initialize(self. application)
|
__id__ = "$Id: Solver.py,v 1.18 2003/09/09 21:04:45 tan2 Exp $"
|
__id__ = "$Id: Solver.py,v 1.19 2003/09/26 21:54:11 ces74 Exp $"
|
def setProperties(self):
|
filename = '%s.cap%d.%d' % (prefix, i, step)
|
filename = '%s.cap%02d.%d' % (prefix, i, step)
|
def write(self, filename, grid): fp = file(filename, 'w') header = '%d x %d x %d\n' % (grid['nox'], grid['noy'], grid['noz']) #print header fp.write(header)
|
__inventory__ = [
|
inventory = [
|
def setProperties(self): import CitcomS.Regional as Regional
|
__id__ = "$Id: IC.py,v 1.3 2003/07/23 05:29:58 ces74 Exp $"
|
__id__ = "$Id: IC.py,v 1.4 2003/07/23 19:00:17 tan2 Exp $"
|
def setProperties(self): import CitcomS.Regional as Regional
|
__id__ = "$Id: __init__.py,v 1.1 2003/08/28 23:04:19 ces74 Exp $"
|
__id__ = "$Id: __init__.py,v 1.2 2003/08/28 23:12:43 ces74 Exp $"
|
def controller(name="controller"): return Controller(name)
|
print 'in output.py'
|
def setProperties(self): print 'in output.py' from CitcomSLib import Output_set_properties Output_set_properties(self.all_variables, self.inventory) return
|
|
ic.initTemperature = self.coupler.initTemperature
|
ic.initTemperature = self.exchanger.initTemperature
|
def launch(self, application): BaseSolver.launch(self, application)
|
__id__ = "$Id: Solver.py,v 1.33 2003/11/28 22:17:26 tan2 Exp $"
|
__id__ = "$Id: Solver.py,v 1.34 2003/12/24 22:46:56 ces74 Exp $"
|
def setProperties(self): self.CitcomModule.Solver_set_properties(self.all_variables, self.inventory)
|
nox = grid['nox'] noy = grid['noy'] noz = grid['noz']
|
nox = int(grid['nox']) noy = int(grid['noy']) noz = int(grid['noz'])
|
def join(self, data, me, grid, cap): # processor geometry nprocx = cap['nprocx'] nprocy = cap['nprocy'] nprocz = cap['nprocz']
|
n = (i+1) * nproc_per_cap - 1 crdfilename = '%s.coord.%d' % (prefix, n) surffilename = '%s.surf.%d.%d' % (prefix, n, step) print 'reading', surffilename data = cb.readData(crdfilename, surffilename, grid, cap) cb.join(data, n, grid, cap)
|
for n in range(i * nproc_per_cap + (cap['nprocz']-1), (i+1) * nproc_per_cap, cap['nprocz']): crdfilename = '%s.coord.%d' % (prefix, n) surffilename = '%s.surf.%d.%d' % (prefix, n, step) print 'reading', surffilename data = cb.readData(crdfilename, surffilename, grid, cap) cb.join(data, n, grid, cap)
|
def write(self, filename, grid, data): fp = file(filename, 'w') fp.write('%d x %d\n' % (grid['nox'], grid['noy'])) fp.writelines(data) return
|
pyre.properties.list("blob_center", default=[1.570800,1.570800,0.9246600]),
|
pyre.properties.list("blob_center", default=[-999.,-999.,-999.]),
|
def initViscosity(self): self.CitcomModule.initViscosity(self.all_variables) return
|
__id__ = "$Id: IC.py,v 1.14 2005/05/23 22:00:45 ces74 Exp $"
|
__id__ = "$Id: IC.py,v 1.15 2005/05/28 05:27:26 ces74 Exp $"
|
def initViscosity(self): self.CitcomModule.initViscosity(self.all_variables) return
|
else if self.inventory.Solver == "multigrid":
|
elif self.inventory.Solver == "multigrid":
|
def init(self, parent): if self.inventory.Solver == "cgrad": Regional.set_cg_defaults() else if self.inventory.Solver == "multigrid": Regional.set_mg_defaults() else if self.inventory.Solver == "multigrid-el": Regional.set_mg_el_defaults()
|
else if self.inventory.Solver == "multigrid-el":
|
elif self.inventory.Solver == "multigrid-el":
|
def init(self, parent): if self.inventory.Solver == "cgrad": Regional.set_cg_defaults() else if self.inventory.Solver == "multigrid": Regional.set_mg_defaults() else if self.inventory.Solver == "multigrid-el": Regional.set_mg_el_defaults()
|
__id__ = "$Id: Stokes_solver.py,v 1.7 2003/07/15 00:40:03 tan2 Exp $"
|
__id__ = "$Id: Stokes_solver.py,v 1.8 2003/07/15 21:47:05 tan2 Exp $"
|
def output(self, *args, **kwds):
|
if capnr==0: print iter
|
def citcom2vtk(t): print "Timestep:",t benchmarkstr = "" #Assign create_bottom and create_surface to bottom and surface #to make them valid in methods namespace bottom = create_bottom surface = create_surface ordered_points = [] #reset Sequences for points ordered_temperature = [] ordered_velocity = [] ordered_visc = [] #Surface and Bottom Points #Initialize empty sequences surf_vec = [] botm_vec = [] surf_topo = [] surf_hflux = [] botm_topo = [] botm_hflux = [] surf_points = [] botm_points = [] for capnr in xrange(nproc_surf): ###Benchmark Point 1 Start## #start = datetime.now() ############################ print "Processing cap",capnr+1,"of",nproc_surf cap = f.root._f_getChild("cap%02d" % capnr) temp_coords = [] # reset Coordinates, Velocity, Temperature Sequence temp_vel = [] temp_temp = [] temp_visc = [] #Information from hdf #This information needs to be read only once hdf_coords = cap.coord[:] hdf_velocity = cap.velocity[t] hdf_temperature = cap.temperature[t] hdf_viscosity = cap.viscosity[t] ###Benchmark Point 1 Stop## #delta = datetime.now() - start #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6) ###Benchmark Point 2 Start## #start = datetime.now() ############################ #Create Iterator to change data representation nx_redu_iter = reduce_iter(nx,nx_redu) ny_redu_iter = reduce_iter(ny,ny_redu) nz_redu_iter = reduce_iter(nz,nz_redu) vtk_i = vtk_iter(el_nx_redu,el_ny_redu,el_nz_redu) # read citcom data - zxy (z fastest) for j in xrange(el_ny_redu): j_redu = ny_redu_iter.next() nx_redu_iter = reduce_iter(nx,nx_redu) for i in xrange(el_nx_redu): i_redu = nx_redu_iter.next() nz_redu_iter = reduce_iter(nz,nz_redu) for k in xrange(el_nz_redu): k_redu = nz_redu_iter.next() thet , phi, r = map(float,hdf_coords[i_redu,j_redu,k_redu]) temp_coords.append((thet,phi,r)) vel_colat, vel_lon , vel_r = map(float,hdf_velocity[i_redu,j_redu,k_redu]) temperature = float(hdf_temperature[i_redu,j_redu,k_redu]) visc = float(hdf_viscosity[i_redu,j_redu,k_redu]) temp_vel.append((vel_colat,vel_lon,vel_r)) temp_temp.append(temperature) temp_visc.append(visc) ##Delete Objects for GC del hdf_coords del hdf_velocity del hdf_temperature del hdf_viscosity ###Benchmark Point 2 Stop## #delta = datetime.now() - start #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6) ###Benchmark Point 3 Start## #start = datetime.now() ############################ # rearange vtk data - xyz (x fastest). for n0 in xrange(el_nz_redu*el_ny_redu*el_nx_redu): iter = vtk_i.next() if capnr==0: print iter #print iter #Get Cartesian Coords from Coords #zxy Citcom to xyz Vtk colat, lon, r = temp_coords[iter] x_coord, y_coord, z_coord = RTF2XYZ(colat,lon,r) ordered_points.append((x_coord,y_coord,z_coord)) #Get Vectors in Cartesian Coords from Velocity vel_colat,vel_lon,vel_r = temp_vel[iter] x_velo, y_velo, z_velo = velocity2cart(vel_colat,vel_lon,vel_r, colat,lon , r) ordered_velocity.append((x_velo,y_velo,z_velo)) ordered_temperature.append(temp_temp[iter]) ordered_visc.append(temp_visc[iter]) ###Benchmark Point 3 Stop## #delta = datetime.now() - start #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6) ##Delete Unused Object for GC del temp_coords del temp_vel del temp_temp del temp_visc ###Benchmark Point 4 Start## #start = datetime.now() ############################ #Bottom Information from hdf if bottom == True: try: hdf_bottom_coord = cap.botm.coord[:] hdf_bottom_heatflux = cap.botm.heatflux[t] hdf_bottom_topography = cap.botm.topography[t] hdf_bottom_velocity = cap.botm.velocity[t] except: print "\tCould not find bottom information in file.\n \ Set create bottom to false" bottom = False #Surface Information from hdf if surface==True: try: hdf_surface_coord = cap.surf.coord[:] hdf_surface_heatflux = cap.surf.heatflux[t] hdf_surface_topography = cap.surf.topography[t] hdf_surface_velocity = cap.surf.velocity[t] except: print "\tCould not find surface information in file.\n \ Set create surface to false" surface = False ###Benchmark Point 4 Stop## #delta = datetime.now() - start #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6) ###Benchmark Point 5 Start## #start = datetime.now() ############################ #Compute surface/bottom topography mean if create_topo: surf_mean=0.0 botm_mean=0.0 if surface: for i in xrange(ny): surf_mean += numpy.mean(hdf_surface_topography[i]) surf_mean = surf_mean/ny if bottom: for i in xrange(ny): botm_mean += numpy.mean(hdf_bottom_topography[i]) botm_mean = botm_mean/ny ###Benchmark Point 5 Stop## #delta = datetime.now() - start #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6) ###Benchmark Point 6 Start## #start = datetime.now() ############################ #Read Surface and Bottom Data if bottom==True or surface == True: for i in xrange(ny): for j in xrange(nx): if bottom==True: #Bottom Coordinates if create_topo==True: colat, lon = hdf_bottom_coord[i,j] x,y,z = RTF2XYZ(colat,lon,radius_inner+float( (hdf_bottom_topography[i,j]-botm_mean)*(10**21)/(6371000**2/10**(-6))/(3300*10)/1000 )) botm_points.append((x,y,z)) else: colat, lon = hdf_bottom_coord[i,j] x,y,z = RTF2XYZ(colat, lon,radius_inner) botm_points.append((x,y,z)) #Bottom Heatflux botm_hflux.append(float(hdf_bottom_heatflux[i,j])) #Bottom Velocity vel_colat, vel_lon = map(float,hdf_bottom_velocity[i,j]) x,y,z = velocity2cart(vel_colat,vel_lon, radius_inner, colat, lon, radius_inner) botm_vec.append((x,y,z)) if surface==True: #Surface Information if create_topo==True: colat,lon = hdf_surface_coord[i,j] #637100 = Earth radius, 33000 = ? x,y,z = RTF2XYZ(colat,lon,radius_outer+float( (hdf_surface_topography[i,j]-surf_mean)*(10**21)/(6371000**2/10**(-6))/(3300*10)/1000 )) surf_points.append((x,y,z)) else: colat, lon = hdf_surface_coord[i,j] x,y,z = RTF2XYZ(colat, lon,radius_outer) surf_points.append((x,y,z)) #Surface Heatflux surf_hflux.append(float(hdf_surface_heatflux[i,j])) #Surface Velocity vel_colat, vel_lon = map(float,hdf_surface_velocity[i,j]) x,y,z = velocity2cart(vel_colat,vel_lon, radius_outer, colat, lon, radius_outer) surf_vec.append((x,y,z)) #del variables for GC if bottom==True: del hdf_bottom_coord del hdf_bottom_heatflux del hdf_bottom_velocity if surface==True: del hdf_surface_coord del hdf_surface_heatflux del hdf_surface_velocity ###Benchmark Point 6 Stop## #delta = datetime.now() - start #benchmarkstr += "%.5lf," % (delta.seconds + float(delta.microseconds)/1e6) ###Benchmark Point 7 Start## #start = datetime.now() ############################
|
|
output_ll_max = pyre.inventory.int("output_ll_max", default=20)
|
output_ll_max = inv.int("output_ll_max", default=20)
|
def setProperties(self, stream): from CitcomSLib import Output_set_properties Output_set_properties(self.all_variables, self.inventory, stream) return
|
import pyre.inventory
|
import pyre.inventory as inv
|
def finalize(self): from CitcomSLib import output_finalize output_finalize(self.all_variables) return
|
tsolver = pyre.inventory.facility("tsolver", factory=Advection_diffusion.temperature_diffadv) vsolver = pyre.inventory.facility("vsolver", factory=Stokes_solver.incompressibleNewtonian) bc = pyre.inventory.facility("bc", factory=BC) const = pyre.inventory.facility("const", factory=Const) ic = pyre.inventory.facility("ic", factory=IC) param = pyre.inventory.facility("param", factory=Param) phase = pyre.inventory.facility("phase", factory=Phase) tracer = pyre.inventory.facility("tracer", factory=Tracer) visc = pyre.inventory.facility("visc", factory=Visc) datadir = pyre.inventory.str("datadir", default=".") rayleigh = pyre.inventory.float("rayleigh", default=1e+05) Q0 = pyre.inventory.float("Q0", default=0.0) stokes_flow_only = pyre.inventory.bool("stokes_flow_only", default=False) output_format = pyre.inventory.str("output_format", default="ascii", validator=pyre.inventory.choice(["ascii", "hdf5"])) output_optional = pyre.inventory.str("output_optional", default="") verbose = pyre.inventory.bool("verbose", default=False) see_convergence = pyre.inventory.bool("see_convergence", default=True)
|
tsolver = inv.facility("tsolver", factory=Advection_diffusion.temperature_diffadv) vsolver = inv.facility("vsolver", factory=Stokes_solver.incompressibleNewtonian) bc = inv.facility("bc", factory=BC) const = inv.facility("const", factory=Const) ic = inv.facility("ic", factory=IC) param = inv.facility("param", factory=Param) phase = inv.facility("phase", factory=Phase) tracer = inv.facility("tracer", factory=Tracer) visc = inv.facility("visc", factory=Visc) datadir = inv.str("datadir", default=".") rayleigh = inv.float("rayleigh", default=1e+05) Q0 = inv.float("Q0", default=0.0) stokes_flow_only = inv.bool("stokes_flow_only", default=False) output_format = inv.str("output_format", default="ascii-local", validator=inv.choice(["ascii-local", "ascii", "hdf5"])) output_optional = inv.str("output_optional", default="") verbose = inv.bool("verbose", default=False) see_convergence = inv.bool("see_convergence", default=True)
|
def finalize(self): from CitcomSLib import output_finalize output_finalize(self.all_variables) return
|
self.saved = range(grid['nox'] * grid['noy'])
|
self.saved = [''] * (grid['nox'] * grid['noy'])
|
def __init__(self, grid): # data storage self.saved = range(grid['nox'] * grid['noy']) return
|
def readData(self, crdfilename, surffilename, grid):
|
def readData(self, crdfilename, surffilename, grid, cap):
|
def readData(self, crdfilename, surffilename, grid): fp1 = file(crdfilename, 'r') fp2 = file(surffilename, 'r')
|
snodes = nox*noy
|
mynox = 1 + (nox-1)/nprocx mynoy = 1 + (noy-1)/nprocy mynoz = 1 + (noz-1)/nprocz snodes = mynox * mynoy
|
def readData(self, crdfilename, surffilename, grid): fp1 = file(crdfilename, 'r') fp2 = file(surffilename, 'r')
|
if not (len(crd) == snodes*noz):
|
if not (len(crd) == snodes*mynoz):
|
def readData(self, crdfilename, surffilename, grid): fp1 = file(crdfilename, 'r') fp2 = file(surffilename, 'r')
|
x, y, z = crd[(i+1)*noz-1].split()
|
x, y, z = crd[(i+1)*mynoz-1].split()
|
def readData(self, crdfilename, surffilename, grid): fp1 = file(crdfilename, 'r') fp2 = file(surffilename, 'r')
|
data = cb.readData(crdfilename, surffilename, grid)
|
data = cb.readData(crdfilename, surffilename, grid, cap)
|
def write(self, filename, grid, data): fp = file(filename, 'w') fp.write('%d x %d\n' % (grid['nox'], grid['noy'])) fp.writelines(data) return
|
self.II = Inlet.VTInlet(self.interior, self.sink["Intr"], self.all_variables)
|
self.II = Inlet.TInlet(self.interior, self.sink["Intr"], self.all_variables)
|
def createII(self): import Inlet self.II = Inlet.VTInlet(self.interior, self.sink["Intr"], self.all_variables) return
|
__id__ = "$Id: CoarseGridExchanger.py,v 1.35 2004/05/29 01:19:31 tan2 Exp $"
|
__id__ = "$Id: CoarseGridExchanger.py,v 1.36 2004/08/06 20:22:30 tan2 Exp $"
|
def exchangeSignal(self, signal): newsgnl = self.module.exchangeSignal(signal, self.communicator.handle(), self.srcComm[0].handle(), self.srcComm[0].size - 1) return newsgnl
|
"%s: step %d: advancing the solution by dt = %s" % (self.name, self.step, dt))
|
"%s: step %d: advancing the solution by dt = %s" % (self.name, self.step, dt)) vsolver = self.inventory.vsolver vsolver.setup() tsolver = self.inventory.tsolver tsolver.setup()
|
def advance(self,dt): self._loopInfo.log( "%s: step %d: advancing the solution by dt = %s" % (self.name, self.step, dt)) tsolver.run(dt) vsolver.run()
|
__id__ = "$Id: Solver.py,v 1.10 2003/08/28 23:04:19 ces74 Exp $"
|
__id__ = "$Id: Solver.py,v 1.11 2003/08/28 23:18:10 ces74 Exp $"
|
def setProperties(self):
|
component = Facility.bind(configuration)
|
component = Facility.bind(self, configuration)
|
def bind(self, configuration): componentName = configuration.get(self.name)
|
__id__ = "$Id: VSolver.py,v 1.1 2003/06/23 20:43:32 tan2 Exp $"
|
__id__ = "$Id: VSolver.py,v 1.2 2003/06/23 21:01:03 tan2 Exp $"
|
def bind(self, configuration): componentName = configuration.get(self.name)
|
name = 'citcomsregional.sh' if self.inventory.solver.name == 'full': name = 'citcomsfull.sh' print 'usage: %s [<property>=<value>] [<facility>.<property>=<value>] ...' % name
|
print 'usage: citcoms [<property>=<value>] [<facility>.<property>=<value>] ...'
|
def usage(self): name = 'citcomsregional.sh' if self.inventory.solver.name == 'full': name = 'citcomsfull.sh' print 'usage: %s [<property>=<value>] [<facility>.<property>=<value>] ...' % name self.showUsage() print """\
|
try: from config import makefile list.append(makefile['pkgsysconfdir']) except ImportError, KeyError:
|
etc = join(dirname(dirname(__file__)), 'etc') if isdir(etc):
|
def _getPrivateDepositoryLocations(self): list = [] try: from config import makefile list.append(makefile['pkgsysconfdir']) except ImportError, KeyError: # The user is running directly from the source directory. from os.path import dirname, join etc = join(dirname(dirname(__file__)), 'etc') list.append(etc) return list
|
from os.path import dirname, join etc = join(dirname(dirname(__file__)), 'etc')
|
def _getPrivateDepositoryLocations(self): list = [] try: from config import makefile list.append(makefile['pkgsysconfdir']) except ImportError, KeyError: # The user is running directly from the source directory. from os.path import dirname, join etc = join(dirname(dirname(__file__)), 'etc') list.append(etc) return list
|
|
self.inventory.fixed_timestep = 0.0 self.inventory.finetunedt = 0.7
|
def __init__(self, name, facility): CitcomComponent.__init__(self, name, facility) self.inventory.ADV = True self.inventory.fixed_timestep = 0.0 self.inventory.finetunedt = 0.7
|
|
__id__ = "$Id: Advection_diffusion.py,v 1.19 2003/11/28 22:17:26 tan2 Exp $"
|
__id__ = "$Id: Advection_diffusion.py,v 1.20 2004/05/26 23:53:35 tan2 Exp $"
|
def stable_timestep(self): dt = self.CitcomModule.stable_timestep(self.all_variables) return dt
|
blob_radius = pyre.inventory.float("blob_radius", default=[0.063]) blob_dT = pyre.inventory.float("blob_dT", default=[0.18])
|
blob_radius = pyre.inventory.float("blob_radius", default=0.063) blob_dT = pyre.inventory.float("blob_dT", default=0.18)
|
def initViscosity(self): self.CitcomModule.initViscosity(self.all_variables) return
|
validator=pyre.properties.range(0, 1)),
|
validator=pyre.properties.choice([0, 1])),
|
def initViscosity(self): self.CitcomModule.initViscosity(self.all_variables) return
|
__id__ = "$Id: IC.py,v 1.12 2005/02/17 22:57:42 tan2 Exp $"
|
__id__ = "$Id: IC.py,v 1.13 2005/02/18 00:13:36 tan2 Exp $"
|
def initViscosity(self): self.CitcomModule.initViscosity(self.all_variables) return
|
outupt_alignment = inv.int("outupt_alignment", default=mega1/4) outupt_alignment_threshold = inv.int("outupt_alignment_threshold",
|
output_alignment = inv.int("output_alignment", default=mega1/4) output_alignment_threshold = inv.int("output_alignment_threshold",
|
def setProperties(self): from CitcomSLib import Output_set_properties Output_set_properties(self.all_variables, self.inventory) return
|
def __init__(self, communicator, boundary, sink, all_variables, mode='F'):
|
def __init__(self, boundary, sink, all_variables, mode='F'):
|
def __init__(self, communicator, boundary, sink, all_variables, mode='F'): import CitcomS.Exchanger as Exchanger self._handle = Exchanger.TractionInlet_create(communicator.handle(), boundary, sink, all_variables, mode) return
|
self._handle = Exchanger.TractionInlet_create(communicator.handle(), boundary,
|
self._handle = Exchanger.TractionInlet_create(boundary,
|
def __init__(self, communicator, boundary, sink, all_variables, mode='F'): import CitcomS.Exchanger as Exchanger self._handle = Exchanger.TractionInlet_create(communicator.handle(), boundary, sink, all_variables, mode) return
|
__id__ = "$Id: Inlet.py,v 1.3 2004/03/11 23:25:47 tan2 Exp $"
|
__id__ = "$Id: Inlet.py,v 1.4 2004/03/28 23:20:55 tan2 Exp $"
|
def __init__(self, communicator, boundary, sink, all_variables, mode='F'): import CitcomS.Exchanger as Exchanger self._handle = Exchanger.TractionInlet_create(communicator.handle(), boundary, sink, all_variables, mode) return
|
__id__ = "$Id: Visc.py,v 1.11 2005/01/19 18:55:00 tan2 Exp $"
|
__id__ = "$Id: Visc.py,v 1.12 2005/01/20 22:25:53 tan2 Exp $"
|
def updateMaterial(self): self.CitcomModule.Visc_update_material(self.all_variables) return
|
self.method = method
|
self.method = method.upper()
|
def __init__(self, parent, src, method="GET", root_path=""): """ http_generator constructor.
|
parameters = urllib.urlencode(self.parameter_children(self.child_results)) + q
|
parameters = urllib.urlencode(self.parameter_children(child_results)) + q
|
def _result(self, req, p_sibling_result=None, child_results=[]): """ Attempts to retrieve XML from the URI and return an ElementTree representation of it. """
|
response = conn.request("GET", urlparse.urlunparse(protocol, host, path, p, parameters, f))
|
conn.request("GET", urlparse.urlunparse((protocol, host, path, p, parameters, f))) response = conn.getresponse()
|
def _result(self, req, p_sibling_result=None, child_results=[]): """ Attempts to retrieve XML from the URI and return an ElementTree representation of it. """
|
response = conn.request("POST", urlparse.urlunparse(protocol, host, path, p, "", f), parameters)
|
conn.request("POST", urlparse.urlunparse((protocol, host, path, p, "", f)), parameters) response = conn.getresponse()
|
def _result(self, req, p_sibling_result=None, child_results=[]): """ Attempts to retrieve XML from the URI and return an ElementTree representation of it. """
|
except httplib.HTTPException, e: raise GeneratorError("http_generator: exception occured during HTTP request: \"%\"" % str(e))
|
def _result(self, req, p_sibling_result=None, child_results=[]): """ Attempts to retrieve XML from the URI and return an ElementTree representation of it. """
|
|
invk_syn.optional_attribs = ["allow-query"]
|
invk_syn.optional_attribs = ["allow-query", "required-parameters"]
|
def register_invokation_syntax(server): """ Allows the component to register the required XML element syntax for it's invokation in sitemap files with the sitemap_config_parse class. """ invk_syn = invokation_syntax() invk_syn.element_name = "match" invk_syn.allowed_parent_components = ["pipeline"] invk_syn.required_attribs = ["type", "pattern"] invk_syn.required_attrib_values = {"type": "uri"} invk_syn.optional_attribs = ["allow-query"] invk_syn.allowed_child_components = ["generate","transform","serialize","match","select"] server.component_syntaxes[("match", "uri")] = invk_syn return invk_syn
|
@pattern: the URI pattern string @allow_query: if True, then a URI including a query string will match (default: True)
|
def register_invokation_syntax(server): """ Allows the component to register the required XML element syntax for it's invokation in sitemap files with the sitemap_config_parse class. """ invk_syn = invokation_syntax() invk_syn.element_name = "match" invk_syn.allowed_parent_components = ["pipeline"] invk_syn.required_attribs = ["type", "pattern"] invk_syn.required_attrib_values = {"type": "uri"} invk_syn.optional_attribs = ["allow-query"] invk_syn.allowed_child_components = ["generate","transform","serialize","match","select"] server.component_syntaxes[("match", "uri")] = invk_syn return invk_syn
|
|
def __init__(self, parent, pattern, allow_query="yes", root_path=""):
|
def __init__(self, parent, pattern, allow_query="yes", required_parameters="", root_path=""): """ uri_matcher constructor. @pattern: the URI pattern string @allow_query: if True, then a URI including a query string will match (default: True) @required_parameters: a space separated list of parameters which must be specified in the query string in order for the matcher to match. (optional) (Note, this functionality can also be implemented by writing a query string matching pattern.) """
|
def __init__(self, parent, pattern, allow_query="yes", root_path=""): self.pattern = pattern
|
self.match_obj = self.regex.match(req.parsed_uri[apache.URI_PATH])
|
if self.regex.pattern.find("?") >= 0: self.match_obj = self.regex.match(req.unparsed_uri) else: self.match_obj = self.regex.match(req.parsed_uri[apache.URI_PATH])
|
def parse_uri(self, req): """ Parses the request URI into its constituent parts and stores them for later use. Returns True if the request uri matches this object's pattern, returns False otherwise. """ self.req = req
|
res = {}
|
res = {'dpi': [resolution, y_resolution], 'quality': self.quality, }
|
def save_options(self, resolution, y_resolution): if y_resolution == None: y_resolution = resolution res = {} return res
|
osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] os.dup2(si.fileno(), osi[1]) os.dup2(so.fileno(), oso[1]) os.dup2(se.fileno(), ose[1])
|
if not interact: osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] os.dup2(si.fileno(), osi[1]) os.dup2(so.fileno(), oso[1]) os.dup2(se.fileno(), ose[1])
|
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' varflag should contain a list of the directories you need created prior to execution. The last item in the list is where we will chdir/cd to. """ import sys deps = data.getVarFlag(func, 'deps', d) check = data.getVarFlag(func, 'check', d) if check in globals(): if globals()[check](func, deps): return global logfile t = data.getVar('T', d, 1) if not t: return 0 mkdirhier(t) logfile = "%s/log.%s.%s" % (t, func, str(os.getpid())) runfile = "%s/run.%s.%s" % (t, func, str(os.getpid())) f = open(runfile, "w") f.write("#!/bin/sh -e\n") if bb.debug_level > 0: f.write("set -x\n") data.emit_env(f, d) f.write("cd %s\n" % os.getcwd()) if func: f.write("%s\n" % func) f.close() os.chmod(runfile, 0775) if not func: error("Function not specified") raise FuncFailed() # open logs si = file('/dev/null', 'r') try: if bb.debug_level > 0: so = os.popen("tee \"%s\"" % logfile, "w") else: so = file(logfile, 'w') except OSError, e: bb.error("opening log file: %s" % e) pass se = so # dup the existing fds so we dont lose them osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] # replace those fds with our own os.dup2(si.fileno(), osi[1]) os.dup2(so.fileno(), oso[1]) os.dup2(se.fileno(), ose[1]) # execute function prevdir = os.getcwd() if data.getVarFlag(func, "fakeroot", d): maybe_fakeroot = "PATH=\"%s\" fakeroot " % bb.data.getVar("PATH", d, 1) else: maybe_fakeroot = '' ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile)) os.chdir(prevdir) # restore the backups os.dup2(osi[0], osi[1]) os.dup2(oso[0], oso[1]) os.dup2(ose[0], ose[1]) # close our logs si.close() so.close() se.close() # close the backup fds os.close(osi[0]) os.close(oso[0]) os.close(ose[0]) if ret==0: if bb.debug_level > 0: os.remove(runfile)
|
os.dup2(osi[0], osi[1]) os.dup2(oso[0], oso[1]) os.dup2(ose[0], ose[1]) si.close() so.close() se.close() os.close(osi[0]) os.close(oso[0]) os.close(ose[0])
|
if not interact: os.dup2(osi[0], osi[1]) os.dup2(oso[0], oso[1]) os.dup2(ose[0], ose[1]) si.close() so.close() se.close() os.close(osi[0]) os.close(oso[0]) os.close(ose[0])
|
def exec_func_shell(func, d): """Execute a shell BB 'function' Returns true if execution was successful. For this, it creates a bash shell script in the tmp dectory, writes the local data into it and finally executes. The output of the shell will end in a log file and stdout. Note on directory behavior. The 'dirs' varflag should contain a list of the directories you need created prior to execution. The last item in the list is where we will chdir/cd to. """ import sys deps = data.getVarFlag(func, 'deps', d) check = data.getVarFlag(func, 'check', d) if check in globals(): if globals()[check](func, deps): return global logfile t = data.getVar('T', d, 1) if not t: return 0 mkdirhier(t) logfile = "%s/log.%s.%s" % (t, func, str(os.getpid())) runfile = "%s/run.%s.%s" % (t, func, str(os.getpid())) f = open(runfile, "w") f.write("#!/bin/sh -e\n") if bb.debug_level > 0: f.write("set -x\n") data.emit_env(f, d) f.write("cd %s\n" % os.getcwd()) if func: f.write("%s\n" % func) f.close() os.chmod(runfile, 0775) if not func: error("Function not specified") raise FuncFailed() # open logs si = file('/dev/null', 'r') try: if bb.debug_level > 0: so = os.popen("tee \"%s\"" % logfile, "w") else: so = file(logfile, 'w') except OSError, e: bb.error("opening log file: %s" % e) pass se = so # dup the existing fds so we dont lose them osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] # replace those fds with our own os.dup2(si.fileno(), osi[1]) os.dup2(so.fileno(), oso[1]) os.dup2(se.fileno(), ose[1]) # execute function prevdir = os.getcwd() if data.getVarFlag(func, "fakeroot", d): maybe_fakeroot = "PATH=\"%s\" fakeroot " % bb.data.getVar("PATH", d, 1) else: maybe_fakeroot = '' ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile)) os.chdir(prevdir) # restore the backups os.dup2(osi[0], osi[1]) os.dup2(oso[0], oso[1]) os.dup2(ose[0], ose[1]) # close our logs si.close() so.close() se.close() # close the backup fds os.close(osi[0]) os.close(oso[0]) os.close(ose[0]) if ret==0: if bb.debug_level > 0: os.remove(runfile)
|
open(stamp, "w+")
|
if os.access(stamp, os.F_OK): os.remove(stamp) f = open(stamp, "w") f.close()
|
def mkstamp(task, d): """Creates/updates a stamp for a given task""" stamp = data.getVar('STAMP', d) if not stamp: return stamp = "%s.%s" % (data.expand(stamp, d), task) mkdirhier(os.path.dirname(stamp)) open(stamp, "w+")
|
if url not in urldata:
|
fn = bb.data.getVar('FILE', d, 1) if fn not in urldata: urldata[fn] = {} if url not in urldata[fn]:
|
def initdata(url, d): if url not in urldata: ud = FetchData() (ud.type, ud.host, ud.path, ud.user, ud.pswd, ud.parm) = bb.decodeurl(data.expand(url, d)) ud.date = Fetch.getSRCDate(d) for m in methods: if m.supports(url, ud, d): ud.localpath = m.localpath(url, ud, d) ud.md5 = ud.localpath + '.md5' # if user sets localpath for file, use it instead. if "localpath" in ud.parm: ud.localpath = ud.parm["localpath"] ud.method = m break urldata[url] = ud return urldata[url]
|
urldata[url] = ud return urldata[url]
|
urldata[fn][url] = ud return urldata[fn][url]
|
def initdata(url, d): if url not in urldata: ud = FetchData() (ud.type, ud.host, ud.path, ud.user, ud.pswd, ud.parm) = bb.decodeurl(data.expand(url, d)) ud.date = Fetch.getSRCDate(d) for m in methods: if m.supports(url, ud, d): ud.localpath = m.localpath(url, ud, d) ud.md5 = ud.localpath + '.md5' # if user sets localpath for file, use it instead. if "localpath" in ud.parm: ud.localpath = ud.parm["localpath"] ud.method = m break urldata[url] = ud return urldata[url]
|
ud = urldata[u] if ud.localfile and not m.forcefetch(u, ud, d) and os.path.exists(urldata[u].md5):
|
ud = urldata[fn][u] if ud.localfile and not m.forcefetch(u, ud, d) and os.path.exists(urldata[fn][u].md5):
|
def go(d): """Fetch all urls""" for m in methods: for u in m.urls: ud = urldata[u] if ud.localfile and not m.forcefetch(u, ud, d) and os.path.exists(urldata[u].md5): # File already present along with md5 stamp file # Touch md5 file to show activity os.utime(ud.md5, None) continue # RP - is olddir needed? # olddir = os.path.abspath(os.getcwd()) m.go(u, ud , d) # os.chdir(olddir) if ud.localfile and not m.forcefetch(u, ud, d): Fetch.write_md5sum(u, ud, d)
|
local.append(urldata[u].localpath)
|
local.append(urldata[fn][u].localpath)
|
def localpaths(d): """Return a list of the local filenames, assuming successful fetch""" local = [] for m in methods: for u in m.urls: local.append(urldata[u].localpath) return local
|
fdata.replace('@@'+key+'@@', bb.data.getVar(key, package))
|
fdata = fdata.replace('@@'+key+'@@', bb.data.getVar(key, package))
|
def write(self, package, template = None): # 1) Assemble new file contents in ram, either new from bitbake # metadata, or a combination of the template and that metadata. # 2) Open the path returned by the filefunc + the basedir for writing. # 3) Write the new bitbake data file. fdata = '' if template: f = file(template, 'r') fdata = f.read() f.close()
|
template = os.path.join(emitter.filefunc(package), '.in')
|
template = emitter.filefunc(package) + '.in'
|
def filefunc(package): # return a relative path to the bitbake .bb which will be written src_uri = bb.data.getVar('SRC_URI', package, 1) filename = bb.data.getVar('PN', package, 1) + '.bb' if not src_uri: return filename else: substr = src_uri[src_uri.find('xorg/'):] subdirlist = substr.split('/')[:2] subdir = '-'.join(subdirlist) return os.path.join(subdir, filename)
|
return os.path.join(data.getVar("DL_DIR", d, 1),data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, revision, date), d))
|
return os.path.join(data.getVar("DL_DIR", d, 1),data.expand('%s_%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, path.replace('/','.'), revision, date), d))
|
def localpath(url, d): (type, host, path, user, pswd, parm) = bb.decodeurl(data.expand(url, d)) if "localpath" in parm:
|
tarfn = data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, revision, date), localdata)
|
tarfn = data.expand('%s_%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, path.replace('/', '.'), revision, date), localdata)
|
def go(self, d, urls = []): """Fetch urls""" if not urls: urls = self.urls
|
print "ERROR: '%s' failed" % td.fn_index[fnid])
|
print "ERROR: '%s' failed" % td.fn_index[fnid]
|
def build( self, params, cmd = "build" ): """Build a providee""" globexpr = params[0] self._checkParsed() names = globfilter( cooker.status.pkg_pn.keys(), globexpr ) if len( names ) == 0: names = [ globexpr ] print "SHELL: Building %s" % ' '.join( names )
|
gettext.bindtextdomain('invest-applet', abspath(join(invest.defs.DATA_DIR, "locale"))) gettext.textdomain('invest-applet') locale.bindtextdomain('invest-applet', abspath(join(invest.defs.DATA_DIR, "locale"))) locale.textdomain('invest-applet')
|
gettext.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.GNOMELOCALEDIR) gettext.textdomain(invest.defs.GETTEXT_PACKAGE) locale.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.GNOMELOCALEDIR) locale.textdomain(invest.defs.GETTEXT_PACKAGE) gtk.glade.bindtextdomain(invest.defs.GETTEXT_PACKAGE, invest.defs.GNOMELOCALEDIR) gtk.glade.textdomain(invest.defs.GETTEXT_PACKAGE)
|
def _check(path): return exists(path) and isdir(path) and isfile(path+"/ChangeLog")
|
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {}
|
def GetScriptableInterface(f): """Returns a tuple of (constants, functions, properties) constants - a sorted list of (name, features) tuples, including all constants except for SCLEX_ constants which are presumed not used by scripts. The SCI_ constants for functions are omitted, since they can be derived, but the SCI_ constants for properties are included since they cannot be derived from the property names. functions - a sorted list of (name, features) tuples, for the features that should be exposed to script as functions. This includes all 'fun' functions; it is up to the program to decide if a given function cannot be scripted. It is also up to the caller to export the SCI_ constants for functions. properties - a sorted list of (name, property), where property is a dictionary containing these keys: "GetterValue", "SetterValue", "PropertyType", "IndexParamType", "IndexParamName", "GetterName", "SetterName", "GetterComment", "SetterComment", and "Category". If the property is read-only, SetterValue will be 0, and the other Setter attribtes will be None. Likewise for write-only properties, GetterValue will be 0 etc. If the getter and/or setter are not compatible with one another, or with our interpretation of how properties work, then the functions are instead added to the functions list. It is still up to the language binding to decide whether the property can / should be exposed to script.""" constants = [] functions = {} properties = {}
|
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] in ["fun","get","set"]: functions[name] = features if features["FeatureType"] == "get": propname = string.replace(name, "Get", "", 1) properties[propname] = (name, properties.get(propname,(None,None))[1]) elif features["FeatureType"] == "set": propname = string.replace(name, "Set", "", 1) properties[propname] = (properties.get(propname,(None,None))[0], name) for propname, (getterName, setterName) in properties.items(): getter = getterName and functions[getterName] setter = setterName and functions[setterName] getterValue, getterIndex, getterIndexName, getterType = 0, None, None, None setterValue, setterIndex, setterIndexName, setterType = 0, None, None, None propType, propIndex, propIndexName = None, None, None isok = (getterName or setterName) and not (getter is setter) if isok and getter: getterValue = getter['Value'] getterType = getter['ReturnType'] getterIndex = getter['Param1Type'] or 'void' getterIndexName = getter['Param1Name'] isok = ((getter['Param2Type'] or 'void') == 'void') if isok and setter: setterValue = setter['Value'] setterType = setter['Param1Type'] or 'void' setterIndex = 'void' if (setter['Param2Type'] or 'void') <> 'void': setterIndex = setterType setterIndexName = setter['Param1Name'] setterType = setter['Param2Type'] isok = (setter['ReturnType'] == 'void') if isok and getter and setter: isok = (getterType == setterType) and (getterIndex == setterIndex) propType = getterType or setterType propIndex = getterIndex or setterIndex propIndexName = getterIndexName or setterIndexName if isok: # do the types appear to be useable? THIS IS OVERRIDDEN BELOW isok = (propType in ('int', 'position', 'colour', 'bool', 'string') and propIndex in ('void','int','position','string','bool')) # If there were getters on string properties (which there are not), # they would have to follow a different protocol, and would not have # matched the signature above. I suggest this is the signature for # a string getter and setter: # get int funcname(void,stringresult) # set void funcname(void,string) # # For an indexed string getter and setter, the indexer goes in # wparam and must not be called 'int length', since 'int length' # has special meaning. # A bool indexer has a special meaning. It means "if the script # assigns the language's nil value to the property, call the # setter with args (0,0); otherwise call it with (1, value)." # # Although there are no getters indexed by bool, I suggest the # following protocol: If getter(1,0) returns 0, return nil to # the script. Otherwise return getter(0,0). if isok: properties[propname] = (getterValue, setterValue, propType, propIndex) # If it is exposed as a property, it should not be exposed as a function. if getter: constants.append( ("SCI_" + string.upper(getterName), getterValue) ) del(functions[getterName]) if setter: constants.append( ("SCI_" + string.upper(setterName), setterValue) ) del(functions[setterName]) else: del(properties[propname]) out.write("\nstatic IFaceConstant ifaceConstants[] = {") if constants: constants.sort() first = 1 for name, value in constants: if first: first = 0 else: out.write(",") out.write('\n\t{"%s",%s}' % (name, value)) out.write("\n};\n") else: out.write('{"",0}};\n') # Write an array of function descriptions. This can be # used as a sort of compiled typelib. out.write("\nstatic IFaceFunction ifaceFunctions[] = {") if functions: funclist = functions.items() funclist.sort() first = 1 for name, features in funclist: if first: first = 0 else: out.write(",") paramTypes = [ features["Param1Type"] or "void", features["Param2Type"] or "void" ] returnType = features["ReturnType"] # Fix-up: if a param is an int named length, change to iface_type_length. if features["Param1Type"] == "int" and features["Param1Name"] == "length": paramTypes[0] = "length" if features["Param2Type"] == "int" and features["Param2Name"] == "length": paramTypes[1] = "length" out.write('\n\t{"%s", %s, iface_%s, {iface_%s, iface_%s}}' % ( name, features["Value"], returnType, paramTypes[0], paramTypes[1] )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nstatic IFaceProperty ifaceProperties[] = {") if properties: proplist = properties.items() proplist.sort() first = 1 for propname, (getter, setter, valueType, paramType) in proplist: if first: first = 0 else: out.write(",") out.write('\n\t{"%s", %s, %s, iface_%s, iface_%s}' % ( propname, getter, setter, valueType, paramType )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nenum {\n") out.write("\tifaceFunctionCount = %d,\n" % len(functions)) out.write("\tifaceConstantCount = %d,\n" % len(constants)) out.write("\tifacePropertyCount = %d\n" % len(properties)) out.write("};\n\n")
|
constants.append( (name, features["Value"]) )
|
constants.append( (name, features) )
|
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] in ["fun","get","set"]: functions[name] = features if features["FeatureType"] == "get": propname = string.replace(name, "Get", "", 1) properties[propname] = (name, properties.get(propname,(None,None))[1]) elif features["FeatureType"] == "set": propname = string.replace(name, "Set", "", 1) properties[propname] = (properties.get(propname,(None,None))[0], name) for propname, (getterName, setterName) in properties.items(): getter = getterName and functions[getterName] setter = setterName and functions[setterName] getterValue, getterIndex, getterIndexName, getterType = 0, None, None, None setterValue, setterIndex, setterIndexName, setterType = 0, None, None, None propType, propIndex, propIndexName = None, None, None isok = (getterName or setterName) and not (getter is setter) if isok and getter: getterValue = getter['Value'] getterType = getter['ReturnType'] getterIndex = getter['Param1Type'] or 'void' getterIndexName = getter['Param1Name'] isok = ((getter['Param2Type'] or 'void') == 'void') if isok and setter: setterValue = setter['Value'] setterType = setter['Param1Type'] or 'void' setterIndex = 'void' if (setter['Param2Type'] or 'void') <> 'void': setterIndex = setterType setterIndexName = setter['Param1Name'] setterType = setter['Param2Type'] isok = (setter['ReturnType'] == 'void') if isok and getter and setter: isok = (getterType == setterType) and (getterIndex == setterIndex) propType = getterType or setterType propIndex = getterIndex or setterIndex propIndexName = getterIndexName or setterIndexName if isok: # do the types appear to be useable? THIS IS OVERRIDDEN BELOW isok = (propType in ('int', 'position', 'colour', 'bool', 'string') and propIndex in ('void','int','position','string','bool')) # If there were getters on string properties (which there are not), # they would have to follow a different protocol, and would not have # matched the signature above. I suggest this is the signature for # a string getter and setter: # get int funcname(void,stringresult) # set void funcname(void,string) # # For an indexed string getter and setter, the indexer goes in # wparam and must not be called 'int length', since 'int length' # has special meaning. # A bool indexer has a special meaning. It means "if the script # assigns the language's nil value to the property, call the # setter with args (0,0); otherwise call it with (1, value)." # # Although there are no getters indexed by bool, I suggest the # following protocol: If getter(1,0) returns 0, return nil to # the script. Otherwise return getter(0,0). if isok: properties[propname] = (getterValue, setterValue, propType, propIndex) # If it is exposed as a property, it should not be exposed as a function. if getter: constants.append( ("SCI_" + string.upper(getterName), getterValue) ) del(functions[getterName]) if setter: constants.append( ("SCI_" + string.upper(setterName), setterValue) ) del(functions[setterName]) else: del(properties[propname]) out.write("\nstatic IFaceConstant ifaceConstants[] = {") if constants: constants.sort() first = 1 for name, value in constants: if first: first = 0 else: out.write(",") out.write('\n\t{"%s",%s}' % (name, value)) out.write("\n};\n") else: out.write('{"",0}};\n') # Write an array of function descriptions. This can be # used as a sort of compiled typelib. out.write("\nstatic IFaceFunction ifaceFunctions[] = {") if functions: funclist = functions.items() funclist.sort() first = 1 for name, features in funclist: if first: first = 0 else: out.write(",") paramTypes = [ features["Param1Type"] or "void", features["Param2Type"] or "void" ] returnType = features["ReturnType"] # Fix-up: if a param is an int named length, change to iface_type_length. if features["Param1Type"] == "int" and features["Param1Name"] == "length": paramTypes[0] = "length" if features["Param2Type"] == "int" and features["Param2Name"] == "length": paramTypes[1] = "length" out.write('\n\t{"%s", %s, iface_%s, {iface_%s, iface_%s}}' % ( name, features["Value"], returnType, paramTypes[0], paramTypes[1] )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nstatic IFaceProperty ifaceProperties[] = {") if properties: proplist = properties.items() proplist.sort() first = 1 for propname, (getter, setter, valueType, paramType) in proplist: if first: first = 0 else: out.write(",") out.write('\n\t{"%s", %s, %s, iface_%s, iface_%s}' % ( propname, getter, setter, valueType, paramType )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nenum {\n") out.write("\tifaceFunctionCount = %d,\n" % len(functions)) out.write("\tifaceConstantCount = %d,\n" % len(constants)) out.write("\tifacePropertyCount = %d\n" % len(properties)) out.write("};\n\n")
|
functions[name] = features
|
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] in ["fun","get","set"]: functions[name] = features if features["FeatureType"] == "get": propname = string.replace(name, "Get", "", 1) properties[propname] = (name, properties.get(propname,(None,None))[1]) elif features["FeatureType"] == "set": propname = string.replace(name, "Set", "", 1) properties[propname] = (properties.get(propname,(None,None))[0], name) for propname, (getterName, setterName) in properties.items(): getter = getterName and functions[getterName] setter = setterName and functions[setterName] getterValue, getterIndex, getterIndexName, getterType = 0, None, None, None setterValue, setterIndex, setterIndexName, setterType = 0, None, None, None propType, propIndex, propIndexName = None, None, None isok = (getterName or setterName) and not (getter is setter) if isok and getter: getterValue = getter['Value'] getterType = getter['ReturnType'] getterIndex = getter['Param1Type'] or 'void' getterIndexName = getter['Param1Name'] isok = ((getter['Param2Type'] or 'void') == 'void') if isok and setter: setterValue = setter['Value'] setterType = setter['Param1Type'] or 'void' setterIndex = 'void' if (setter['Param2Type'] or 'void') <> 'void': setterIndex = setterType setterIndexName = setter['Param1Name'] setterType = setter['Param2Type'] isok = (setter['ReturnType'] == 'void') if isok and getter and setter: isok = (getterType == setterType) and (getterIndex == setterIndex) propType = getterType or setterType propIndex = getterIndex or setterIndex propIndexName = getterIndexName or setterIndexName if isok: # do the types appear to be useable? THIS IS OVERRIDDEN BELOW isok = (propType in ('int', 'position', 'colour', 'bool', 'string') and propIndex in ('void','int','position','string','bool')) # If there were getters on string properties (which there are not), # they would have to follow a different protocol, and would not have # matched the signature above. I suggest this is the signature for # a string getter and setter: # get int funcname(void,stringresult) # set void funcname(void,string) # # For an indexed string getter and setter, the indexer goes in # wparam and must not be called 'int length', since 'int length' # has special meaning. # A bool indexer has a special meaning. It means "if the script # assigns the language's nil value to the property, call the # setter with args (0,0); otherwise call it with (1, value)." # # Although there are no getters indexed by bool, I suggest the # following protocol: If getter(1,0) returns 0, return nil to # the script. Otherwise return getter(0,0). if isok: properties[propname] = (getterValue, setterValue, propType, propIndex) # If it is exposed as a property, it should not be exposed as a function. if getter: constants.append( ("SCI_" + string.upper(getterName), getterValue) ) del(functions[getterName]) if setter: constants.append( ("SCI_" + string.upper(setterName), setterValue) ) del(functions[setterName]) else: del(properties[propname]) out.write("\nstatic IFaceConstant ifaceConstants[] = {") if constants: constants.sort() first = 1 for name, value in constants: if first: first = 0 else: out.write(",") out.write('\n\t{"%s",%s}' % (name, value)) out.write("\n};\n") else: out.write('{"",0}};\n') # Write an array of function descriptions. This can be # used as a sort of compiled typelib. out.write("\nstatic IFaceFunction ifaceFunctions[] = {") if functions: funclist = functions.items() funclist.sort() first = 1 for name, features in funclist: if first: first = 0 else: out.write(",") paramTypes = [ features["Param1Type"] or "void", features["Param2Type"] or "void" ] returnType = features["ReturnType"] # Fix-up: if a param is an int named length, change to iface_type_length. if features["Param1Type"] == "int" and features["Param1Name"] == "length": paramTypes[0] = "length" if features["Param2Type"] == "int" and features["Param2Name"] == "length": paramTypes[1] = "length" out.write('\n\t{"%s", %s, iface_%s, {iface_%s, iface_%s}}' % ( name, features["Value"], returnType, paramTypes[0], paramTypes[1] )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nstatic IFaceProperty ifaceProperties[] = {") if properties: proplist = properties.items() proplist.sort() first = 1 for propname, (getter, setter, valueType, paramType) in proplist: if first: first = 0 else: out.write(",") out.write('\n\t{"%s", %s, %s, iface_%s, iface_%s}' % ( propname, getter, setter, valueType, paramType )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nenum {\n") out.write("\tifaceFunctionCount = %d,\n" % len(functions)) out.write("\tifaceConstantCount = %d,\n" % len(constants)) out.write("\tifacePropertyCount = %d\n" % len(properties)) out.write("};\n\n")
|
|
getter = getterName and functions[getterName] setter = setterName and functions[setterName]
|
getter = getterName and f.features[getterName] setter = setterName and f.features[setterName]
|
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] in ["fun","get","set"]: functions[name] = features if features["FeatureType"] == "get": propname = string.replace(name, "Get", "", 1) properties[propname] = (name, properties.get(propname,(None,None))[1]) elif features["FeatureType"] == "set": propname = string.replace(name, "Set", "", 1) properties[propname] = (properties.get(propname,(None,None))[0], name) for propname, (getterName, setterName) in properties.items(): getter = getterName and functions[getterName] setter = setterName and functions[setterName] getterValue, getterIndex, getterIndexName, getterType = 0, None, None, None setterValue, setterIndex, setterIndexName, setterType = 0, None, None, None propType, propIndex, propIndexName = None, None, None isok = (getterName or setterName) and not (getter is setter) if isok and getter: getterValue = getter['Value'] getterType = getter['ReturnType'] getterIndex = getter['Param1Type'] or 'void' getterIndexName = getter['Param1Name'] isok = ((getter['Param2Type'] or 'void') == 'void') if isok and setter: setterValue = setter['Value'] setterType = setter['Param1Type'] or 'void' setterIndex = 'void' if (setter['Param2Type'] or 'void') <> 'void': setterIndex = setterType setterIndexName = setter['Param1Name'] setterType = setter['Param2Type'] isok = (setter['ReturnType'] == 'void') if isok and getter and setter: isok = (getterType == setterType) and (getterIndex == setterIndex) propType = getterType or setterType propIndex = getterIndex or setterIndex propIndexName = getterIndexName or setterIndexName if isok: # do the types appear to be useable? THIS IS OVERRIDDEN BELOW isok = (propType in ('int', 'position', 'colour', 'bool', 'string') and propIndex in ('void','int','position','string','bool')) # If there were getters on string properties (which there are not), # they would have to follow a different protocol, and would not have # matched the signature above. I suggest this is the signature for # a string getter and setter: # get int funcname(void,stringresult) # set void funcname(void,string) # # For an indexed string getter and setter, the indexer goes in # wparam and must not be called 'int length', since 'int length' # has special meaning. # A bool indexer has a special meaning. It means "if the script # assigns the language's nil value to the property, call the # setter with args (0,0); otherwise call it with (1, value)." # # Although there are no getters indexed by bool, I suggest the # following protocol: If getter(1,0) returns 0, return nil to # the script. Otherwise return getter(0,0). if isok: properties[propname] = (getterValue, setterValue, propType, propIndex) # If it is exposed as a property, it should not be exposed as a function. if getter: constants.append( ("SCI_" + string.upper(getterName), getterValue) ) del(functions[getterName]) if setter: constants.append( ("SCI_" + string.upper(setterName), setterValue) ) del(functions[setterName]) else: del(properties[propname]) out.write("\nstatic IFaceConstant ifaceConstants[] = {") if constants: constants.sort() first = 1 for name, value in constants: if first: first = 0 else: out.write(",") out.write('\n\t{"%s",%s}' % (name, value)) out.write("\n};\n") else: out.write('{"",0}};\n') # Write an array of function descriptions. This can be # used as a sort of compiled typelib. out.write("\nstatic IFaceFunction ifaceFunctions[] = {") if functions: funclist = functions.items() funclist.sort() first = 1 for name, features in funclist: if first: first = 0 else: out.write(",") paramTypes = [ features["Param1Type"] or "void", features["Param2Type"] or "void" ] returnType = features["ReturnType"] # Fix-up: if a param is an int named length, change to iface_type_length. if features["Param1Type"] == "int" and features["Param1Name"] == "length": paramTypes[0] = "length" if features["Param2Type"] == "int" and features["Param2Name"] == "length": paramTypes[1] = "length" out.write('\n\t{"%s", %s, iface_%s, {iface_%s, iface_%s}}' % ( name, features["Value"], returnType, paramTypes[0], paramTypes[1] )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nstatic IFaceProperty ifaceProperties[] = {") if properties: proplist = properties.items() proplist.sort() first = 1 for propname, (getter, setter, valueType, paramType) in proplist: if first: first = 0 else: out.write(",") out.write('\n\t{"%s", %s, %s, iface_%s, iface_%s}' % ( propname, getter, setter, valueType, paramType )) out.write("\n};\n") else: out.write('{""}};\n') out.write("\nenum {\n") out.write("\tifaceFunctionCount = %d,\n" % len(functions)) out.write("\tifaceConstantCount = %d,\n" % len(constants)) out.write("\tifacePropertyCount = %d\n" % len(properties)) out.write("};\n\n")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.