From jackjansen@users.sourceforge.net Tue Apr 1 13:32:20 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 05:32:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv6654 Modified Files: gensuitemodule.py Log Message: - All messages are now dependent on the --verbose option. - Added a --dump option that doesn't generate the module but dumps the pretty-printed aete resource(s) on stdout. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gensuitemodule.py 30 Mar 2003 22:39:39 -0000 1.2 --- gensuitemodule.py 1 Apr 2003 13:32:17 -0000 1.3 *************** *** 37,40 **** --- 37,42 ---- --edit old=new Edit suite names, use empty new to skip a suite (-e) --creator code Set creator code for package (-c) + --dump Dump aete resource to stdout in stead of creating module (-d) + --verbose Tell us what happens (-v) """) sys.exit(1) *************** *** 42,47 **** def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:c:" ! LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=") try: opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) --- 44,49 ---- def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:c:dv" ! LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=", "dump", "verbose") try: opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) *************** *** 54,57 **** --- 56,61 ---- edit_modnames = [] creatorsignature = None + dump = None + verbose = None for o, a in opts: *************** *** 72,75 **** --- 76,83 ---- sys.exit(1) creatorsignature = a + if o in ('-d', '--dump'): + dump = sys.stdout + if o in ('-v', '--verbose'): + verbose = sys.stderr *************** *** 80,84 **** for filename in args: process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames, creatorsignature=creatorsignature) else: main_interactive() --- 88,93 ---- for filename in args: process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames, creatorsignature=creatorsignature, ! dump=dump, verbose=verbose) else: main_interactive() *************** *** 104,113 **** return try: ! processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname) except MacOS.Error, arg: print "Error getting terminology:", arg print "Retry, manually parsing resources" processfile_fromresource(filename, edit_modnames=edit_modnames, ! basepkgname=basepkgname) def is_scriptable(application): --- 113,123 ---- return try: ! processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname, ! verbose=sys.stderr) except MacOS.Error, arg: print "Error getting terminology:", arg print "Retry, manually parsing resources" processfile_fromresource(filename, edit_modnames=edit_modnames, ! basepkgname=basepkgname, verbose=sys.stderr) def is_scriptable(application): *************** *** 133,142 **** def processfile_fromresource(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Process all resources in a single file""" ! if not is_scriptable(fullname): ! print "Warning: app does not seem scriptable: %s" % fullname cur = CurResFile() ! print "Processing", fullname rf = macresource.open_pathname(fullname) try: --- 143,153 ---- def processfile_fromresource(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, dump=None, verbose=None): """Process all resources in a single file""" ! if not is_scriptable(fullname) and verbose: ! print >>verbose, "Warning: app does not seem scriptable: %s" % fullname cur = CurResFile() ! if verbose: ! print >>verbose, "Processing", fullname rf = macresource.open_pathname(fullname) try: *************** *** 149,158 **** res = Get1IndResource('aeut', 1+i) resources.append(res) ! print "\nLISTING aete+aeut RESOURCES IN", `fullname` aetelist = [] for res in resources: ! print "decoding", res.GetResInfo(), "..." data = res.data ! aete = decode(data) aetelist.append((aete, res.GetResInfo())) finally: --- 160,171 ---- res = Get1IndResource('aeut', 1+i) resources.append(res) ! if verbose: ! print >>verbose, "\nLISTING aete+aeut RESOURCES IN", `fullname` aetelist = [] for res in resources: ! if verbose: ! print >>verbose, "decoding", res.GetResInfo(), "..." data = res.data ! aete = decode(data, verbose) aetelist.append((aete, res.GetResInfo())) finally: *************** *** 162,181 **** # switch back (needed for dialogs in Python) UseResFile(cur) compileaetelist(aetelist, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature) def processfile(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" ! if not is_scriptable(fullname): ! print "Warning: app does not seem scriptable: %s" % fullname ! print "\nASKING FOR aete DICTIONARY IN", `fullname` try: aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound ! print "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually" ! aedata, sig = getappterminology(fullname) if not creatorsignature: creatorsignature = sig --- 175,199 ---- # switch back (needed for dialogs in Python) UseResFile(cur) + if dump: + dumpaetelist(aetelist, dump) compileaetelist(aetelist, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature, verbose=verbose) def processfile(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, dump=None, ! verbose=None): """Ask an application for its terminology and process that""" ! if not is_scriptable(fullname) and verbose: ! print >>verbose, "Warning: app does not seem scriptable: %s" % fullname ! if verbose: ! print >>verbose, "\nASKING FOR aete DICTIONARY IN", `fullname` try: aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound ! if verbose: ! print >>verbose, "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually" ! aedata, sig = getappterminology(fullname, verbose=verbose) if not creatorsignature: creatorsignature = sig *************** *** 184,201 **** else: if launched: ! print "Launched", fullname raw = aetools.unpack(aedescobj) if not raw: ! print 'Unpack returned empty value:', raw return ! if not raw[0].data: ! print 'Unpack returned value without data:', raw return aedata = raw[0] ! aete = decode(aedata.data) compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature, edit_modnames=edit_modnames) ! def getappterminology(fullname): """Get application terminology by sending an AppleEvent""" # First check that we actually can send AppleEvents --- 202,226 ---- else: if launched: ! if verbose: ! print >>verbose, "Launched", fullname raw = aetools.unpack(aedescobj) if not raw: ! if verbose: ! print >>verbose, 'Unpack returned empty value:', raw return ! if not raw[0].data: ! if verbose: ! print >>verbose, 'Unpack returned value without data:', raw return aedata = raw[0] ! aete = decode(aedata.data, verbose) ! if dump: ! dumpaetelist([aete], dump) ! return compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature, edit_modnames=edit_modnames, ! verbose=verbose) ! def getappterminology(fullname, verbose=None): """Get application terminology by sending an AppleEvent""" # First check that we actually can send AppleEvents *************** *** 221,225 **** talker._start() except (MacOS.Error, aetools.Error), arg: ! print 'Warning: start() failed, continuing anyway:', arg reply = talker.send("ascr", "gdte") #reply2 = talker.send("ascr", "gdut") --- 246,251 ---- talker._start() except (MacOS.Error, aetools.Error), arg: ! if verbose: ! print >>verbose, 'Warning: start() failed, continuing anyway:', arg reply = talker.send("ascr", "gdte") #reply2 = talker.send("ascr", "gdut") *************** *** 229,239 **** def compileaetelist(aetelist, fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): for aete, resinfo in aetelist: compileaete(aete, resinfo, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature) ! ! def decode(data): """Decode a resource into a python data structure""" f = StringIO.StringIO(data) --- 255,269 ---- def compileaetelist(aetelist, fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, verbose=None): for aete, resinfo in aetelist: compileaete(aete, resinfo, fullname, output=output, basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature, verbose=verbose) ! ! def dumpaetelist(aetelist, output): ! import pprint ! pprint.pprint(aetelist, output) ! ! def decode(data, verbose=None): """Decode a resource into a python data structure""" f = StringIO.StringIO(data) *************** *** 243,248 **** unprocessed = len(f.read()) total = f.tell() ! if unprocessed: ! sys.stderr.write("%d processed + %d unprocessed = %d total\n" % (processed, unprocessed, total)) return aete --- 273,278 ---- unprocessed = len(f.read()) total = f.tell() ! if unprocessed and verbose: ! verbose.write("%d processed + %d unprocessed = %d total\n" % (processed, unprocessed, total)) return aete *************** *** 399,403 **** def compileaete(aete, resinfo, fname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete --- 429,433 ---- def compileaete(aete, resinfo, fname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None, verbose=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete *************** *** 439,443 **** for suite in suites: code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames) if not code: continue --- 469,473 ---- for suite in suites: code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames, verbose=verbose) if not code: continue *************** *** 448,452 **** for suiteinfo in allsuites: compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None)) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') --- 478,482 ---- for suiteinfo in allsuites: compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None), verbose=verbose) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') *************** *** 512,516 **** fp.close() ! def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared --- 542,547 ---- fp.close() ! def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None, ! verbose=None): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared *************** *** 549,553 **** findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None)) for cls in classes: objc.compileclass(cls) --- 580,585 ---- findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None), ! verbose=verbose) for cls in classes: objc.compileclass(cls) *************** *** 569,573 **** def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite --- 601,605 ---- def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1, verbose=None): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite *************** *** 625,629 **** fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact) for cls in classes: objc.compileclass(cls) --- 657,662 ---- fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact, ! verbose=verbose) for cls in classes: objc.compileclass(cls) *************** *** 779,783 **** class CodeNameMapper: ! def __init__(self, interact=1): self.code2name = { "property" : {}, --- 812,816 ---- class CodeNameMapper: ! def __init__(self, interact=1, verbose=None): self.code2name = { "property" : {}, *************** *** 795,798 **** --- 828,832 ---- self.star_imported = 0 self.can_interact = interact + self.verbose = verbose def addnamecode(self, type, name, code): *************** *** 838,846 **** class ObjectCompiler: ! def __init__(self, fp, basesuite=None, othernamemappers=None, interact=1): self.fp = fp self.basesuite = basesuite self.can_interact = interact ! self.namemappers = [CodeNameMapper(self.can_interact)] if othernamemappers: self.othernamemappers = othernamemappers[:] --- 872,882 ---- class ObjectCompiler: ! def __init__(self, fp, basesuite=None, othernamemappers=None, interact=1, ! verbose=None): self.fp = fp + self.verbose = verbose self.basesuite = basesuite self.can_interact = interact ! self.namemappers = [CodeNameMapper(self.can_interact, self.verbose)] if othernamemappers: self.othernamemappers = othernamemappers[:] *************** *** 848,852 **** self.othernamemappers = [] if basesuite: ! basemapper = CodeNameMapper(self.can_interact) basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) --- 884,888 ---- self.othernamemappers = [] if basesuite: ! basemapper = CodeNameMapper(self.can_interact, self.verbose) basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) *************** *** 882,886 **** m = None if not m: return None, None, None ! mapper = CodeNameMapper(self.can_interact) mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) --- 918,922 ---- m = None if not m: return None, None, None ! mapper = CodeNameMapper(self.can_interact, self.verbose) mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) *************** *** 888,892 **** def askdefinitionmodule(self, type, code): if not self.can_interact: ! print "** No definition for %s '%s' found" % (type, code) return None path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) --- 924,929 ---- def askdefinitionmodule(self, type, code): if not self.can_interact: ! if self.verbose: ! print >>self.verbose, "** No definition for %s '%s' found" % (type, code) return None path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) *************** *** 955,959 **** if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and properties[0][1] != 'c@#!')): ! print '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`) raise RuntimeError, "About to skip non-empty class" return --- 992,997 ---- if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and properties[0][1] != 'c@#!')): ! if self.verbose: ! print >>self.verbose, '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`) raise RuntimeError, "About to skip non-empty class" return From jackjansen@users.sourceforge.net Tue Apr 1 14:25:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 06:25:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv2273 Modified Files: gensuitemodule.py Log Message: Turned the suite compiler into an object. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gensuitemodule.py 1 Apr 2003 13:32:17 -0000 1.3 --- gensuitemodule.py 1 Apr 2003 14:25:49 -0000 1.4 *************** *** 468,473 **** allsuites = [] for suite in suites: ! code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames, verbose=verbose) if not code: continue --- 468,473 ---- allsuites = [] for suite in suites: ! compiler = SuiteCompiler(suite, basepackage, output, edit_modnames, verbose) ! code, modname, precompinfo = compiler.precompilesuite() if not code: continue *************** *** 475,482 **** suiteinfo = suite, pathname, modname suitelist.append((code, modname)) ! allsuites.append(suiteinfo) ! for suiteinfo in allsuites: ! compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None), verbose=verbose) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') --- 475,481 ---- suiteinfo = suite, pathname, modname suitelist.append((code, modname)) ! allsuites.append(compiler) ! for compiler in allsuites: ! compiler.compilesuite(major, minor, language, script, fname, allprecompinfo) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') *************** *** 541,806 **** fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() - - def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None, - verbose=None): - """Parse a single suite without generating the output. This step is needed - so we can resolve recursive references by suites to enums/comps/etc declared - in other suites""" - [name, desc, code, level, version, events, classes, comps, enums] = suite - - modname = identify(name) - if len(modname) > 28: - modname = modname[:27] - if edit_modnames is None: - pathname = EasyDialogs.AskFileForSave(message='Python output file', - savedFileName=modname+'.py') - else: - for old, new in edit_modnames: - if old == modname: - modname = new - if modname: - pathname = os.path.join(output, modname + '.py') - else: - pathname = None - if not pathname: - return None, None, None, None, None - - modname = os.path.splitext(os.path.split(pathname)[1])[0] - - if basepackage and basepackage._code_to_module.has_key(code): - # We are an extension of a baseclass (usually an application extending - # Standard_Suite or so). Import everything from our base module - basemodule = basepackage._code_to_module[code] - else: - # We are not an extension. - basemodule = None - - enumsneeded = {} - for event in events: - findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None), ! verbose=verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! ! for enum in enumsneeded.keys(): ! objc.checkforenum(enum) ! objc.dumpindex() ! ! precompinfo = objc.getprecompinfo(modname) ! ! return code, suite, pathname, modname, precompinfo ! ! def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1, verbose=None): ! """Generate code for a single suite""" ! [name, desc, code, level, version, events, classes, comps, enums] = suite ! # Sort various lists, so re-generated source is easier compared ! def class_sorter(k1, k2): ! """Sort classes by code, and make sure main class sorts before synonyms""" ! # [name, code, desc, properties, elements] = cls ! if k1[1] < k2[1]: return -1 ! if k1[1] > k2[1]: return 1 ! if not k2[3] or k2[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return -1 ! if not k1[3] or k1[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return 1 ! return 0 ! events.sort() ! classes.sort(class_sorter) ! comps.sort() ! enums.sort() ! ! fp = open(pathname, 'w') ! MacOS.SetCreatorAndType(pathname, 'Pyth', 'TEXT') ! fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) ! fp.write("Level %d, version %d\n\n" % (level, version)) ! fp.write("Generated from %s\n"%ascii(fname)) ! fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ ! (major, minor, language, script)) ! fp.write('"""\n\n') ! fp.write('import aetools\n') ! fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `code`) ! if basepackage and basepackage._code_to_module.has_key(code): ! # We are an extension of a baseclass (usually an application extending ! # Standard_Suite or so). Import everything from our base module ! fp.write('from %s import *\n'%basepackage._code_to_fullname[code][0]) ! basemodule = basepackage._code_to_module[code] ! elif basepackage and basepackage._code_to_module.has_key(code.lower()): ! # This is needed by CodeWarrior and some others. ! fp.write('from %s import *\n'%basepackage._code_to_fullname[code.lower()][0]) ! basemodule = basepackage._code_to_module[code.lower()] ! else: ! # We are not an extension. ! basemodule = None ! compileclassheader(fp, modname, basemodule) ! ! enumsneeded = {} ! if events: for event in events: ! compileevent(fp, event, enumsneeded) ! else: ! fp.write("\tpass\n\n") ! ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact, ! verbose=verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! for enum in enumsneeded.keys(): ! objc.checkforenum(enum) ! objc.dumpindex() ! return code, modname ! def compileclassheader(fp, name, module=None): ! """Generate class boilerplate""" ! classname = '%s_Events'%name ! if module: ! modshortname = string.split(module.__name__, '.')[-1] ! baseclassname = '%s_Events'%modshortname ! fp.write("class %s(%s):\n\n"%(classname, baseclassname)) ! else: ! fp.write("class %s:\n\n"%classname) ! def compileevent(fp, event, enumsneeded): ! """Generate code for a single event""" ! [name, desc, code, subcode, returns, accepts, arguments] = event ! funcname = identify(name) ! # ! # generate name->keyword map ! # ! if arguments: ! fp.write("\t_argmap_%s = {\n"%funcname) ! for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `a[1]`)) ! fp.write("\t}\n\n") ! # ! # Generate function header ! # ! has_arg = (not is_null(accepts)) ! opt_arg = (has_arg and is_optional(accepts)) ! ! fp.write("\tdef %s(self, "%funcname) ! if has_arg: ! if not opt_arg: ! fp.write("_object, ") # Include direct object, if it has one else: ! fp.write("_object=None, ") # Also include if it is optional ! else: ! fp.write("_no_object=None, ") # For argument checking ! fp.write("_attributes={}, **_arguments):\n") # include attribute dict and args ! # ! # Generate doc string (important, since it may be the only ! # available documentation, due to our name-remaping) ! # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) ! if has_arg: ! fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) ! elif opt_arg: ! fp.write("\t\tOptional argument: %s\n"%getdatadoc(accepts)) ! for arg in arguments: ! fp.write("\t\tKeyword argument %s: %s\n"%(identify(arg[0]), ! getdatadoc(arg[2]))) ! fp.write("\t\tKeyword argument _attributes: AppleEvent attribute dictionary\n") ! if not is_null(returns): ! fp.write("\t\tReturns: %s\n"%getdatadoc(returns)) ! fp.write('\t\t"""\n') ! # ! # Fiddle the args so everything ends up in 'arguments' dictionary ! # ! fp.write("\t\t_code = %s\n"% `code`) ! fp.write("\t\t_subcode = %s\n\n"% `subcode`) ! # ! # Do keyword name substitution ! # ! if arguments: ! fp.write("\t\taetools.keysubst(_arguments, self._argmap_%s)\n"%funcname) ! else: ! fp.write("\t\tif _arguments: raise TypeError, 'No optional args expected'\n") ! # ! # Stuff required arg (if there is one) into arguments ! # ! if has_arg: ! fp.write("\t\t_arguments['----'] = _object\n") ! elif opt_arg: ! fp.write("\t\tif _object:\n") ! fp.write("\t\t\t_arguments['----'] = _object\n") ! else: ! fp.write("\t\tif _no_object != None: raise TypeError, 'No direct arg expected'\n") ! fp.write("\n") ! # ! # Do enum-name substitution ! # ! for a in arguments: ! if is_enum(a[2]): ! kname = a[1] ! ename = a[2][0] ! if ename <> '****': ! fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`kname`, identify(ename))) ! enumsneeded[ename] = 1 ! fp.write("\n") ! # ! # Do the transaction ! # ! fp.write("\t\t_reply, _arguments, _attributes = self.send(_code, _subcode,\n") ! fp.write("\t\t\t\t_arguments, _attributes)\n") ! # ! # Error handling ! # ! fp.write("\t\tif _arguments.get('errn', 0):\n") ! fp.write("\t\t\traise aetools.Error, aetools.decodeerror(_arguments)\n") ! fp.write("\t\t# XXXX Optionally decode result\n") ! # ! # Decode result ! # ! fp.write("\t\tif _arguments.has_key('----'):\n") ! if is_enum(returns): ! fp.write("\t\t\t# XXXX Should do enum remapping here...\n") ! fp.write("\t\t\treturn _arguments['----']\n") ! fp.write("\n") - # print "\n# Command %s -- %s (%s, %s)" % (`name`, `desc`, `code`, `subcode`) - # print "# returns", compiledata(returns) - # print "# accepts", compiledata(accepts) - # for arg in arguments: - # compileargument(arg) - - def compileargument(arg): - [name, keyword, what] = arg - print "# %s (%s)" % (name, `keyword`), compiledata(what) - - def findenumsinevent(event, enumsneeded): - """Find all enums for a single event""" - [name, desc, code, subcode, returns, accepts, arguments] = event - for a in arguments: - if is_enum(a[2]): - ename = a[2][0] - if ename <> '****': - enumsneeded[ename] = 1 - # # This class stores the code<->name translations for a single module. It is used --- 540,810 ---- fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() ! class SuiteCompiler: ! def __init__(self, suite, basepackage, output, edit_modnames, verbose): ! self.suite = suite ! self.basepackage = basepackage ! self.edit_modnames = edit_modnames ! self.output = output ! self.verbose = verbose ! # Set by precompilesuite ! self.pathname = None ! self.modname = None ! # Set by compilesuite ! self.fp = None ! self.basemodule = None ! self.enumsneeded = {} ! ! def precompilesuite(self): ! """Parse a single suite without generating the output. This step is needed ! so we can resolve recursive references by suites to enums/comps/etc declared ! in other suites""" ! [name, desc, code, level, version, events, classes, comps, enums] = self.suite ! ! modname = identify(name) ! if len(modname) > 28: ! modname = modname[:27] ! if self.edit_modnames is None: ! self.pathname = EasyDialogs.AskFileForSave(message='Python output file', ! savedFileName=modname+'.py') ! else: ! for old, new in self.edit_modnames: ! if old == modname: ! modname = new ! if modname: ! self.pathname = os.path.join(self.output, modname + '.py') ! else: ! self.pathname = None ! if not self.pathname: ! return None, None, None ! self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0] ! ! if self.basepackage and self.basepackage._code_to_module.has_key(code): ! # We are an extension of a baseclass (usually an application extending ! # Standard_Suite or so). Import everything from our base module ! basemodule = self.basepackage._code_to_module[code] ! else: ! # We are not an extension. ! basemodule = None ! self.enumsneeded = {} for event in events: ! self.findenumsinevent(event) ! objc = ObjectCompiler(None, basemodule, interact=(self.edit_modnames is None), ! verbose=self.verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! for enum in self.enumsneeded.keys(): ! objc.checkforenum(enum) ! ! objc.dumpindex() ! ! precompinfo = objc.getprecompinfo(self.modname) ! ! return code, self.modname, precompinfo ! def compilesuite(self, major, minor, language, script, fname, precompinfo): ! """Generate code for a single suite""" ! [name, desc, code, level, version, events, classes, comps, enums] = self.suite ! # Sort various lists, so re-generated source is easier compared ! def class_sorter(k1, k2): ! """Sort classes by code, and make sure main class sorts before synonyms""" ! # [name, code, desc, properties, elements] = cls ! if k1[1] < k2[1]: return -1 ! if k1[1] > k2[1]: return 1 ! if not k2[3] or k2[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return -1 ! if not k1[3] or k1[3][0][1] == 'c@#!': ! # This is a synonym, the other one is better ! return 1 ! return 0 ! ! events.sort() ! classes.sort(class_sorter) ! comps.sort() ! enums.sort() ! ! self.fp = fp = open(self.pathname, 'w') ! MacOS.SetCreatorAndType(self.pathname, 'Pyth', 'TEXT') ! ! fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) ! fp.write("Level %d, version %d\n\n" % (level, version)) ! fp.write("Generated from %s\n"%ascii(fname)) ! fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ ! (major, minor, language, script)) ! fp.write('"""\n\n') ! ! fp.write('import aetools\n') ! fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `code`) ! if self.basepackage and self.basepackage._code_to_module.has_key(code): ! # We are an extension of a baseclass (usually an application extending ! # Standard_Suite or so). Import everything from our base module ! fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0]) ! basemodule = self.basepackage._code_to_module[code] ! elif self.basepackage and self.basepackage._code_to_module.has_key(code.lower()): ! # This is needed by CodeWarrior and some others. ! fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0]) ! basemodule = self.basepackage._code_to_module[code.lower()] ! else: ! # We are not an extension. ! basemodule = None ! self.basemodule = basemodule ! self.compileclassheader() ! self.enumsneeded = {} ! if events: ! for event in events: ! self.compileevent(event) ! else: ! fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=(self.edit_modnames is None), ! verbose=self.verbose) ! for cls in classes: ! objc.compileclass(cls) ! for cls in classes: ! objc.fillclasspropsandelems(cls) ! for comp in comps: ! objc.compilecomparison(comp) ! for enum in enums: ! objc.compileenumeration(enum) ! for enum in self.enumsneeded.keys(): ! objc.checkforenum(enum) ! ! objc.dumpindex() ! ! def compileclassheader(self): ! """Generate class boilerplate""" ! classname = '%s_Events'%self.modname ! if self.basemodule: ! modshortname = string.split(self.basemodule.__name__, '.')[-1] ! baseclassname = '%s_Events'%modshortname ! self.fp.write("class %s(%s):\n\n"%(classname, baseclassname)) else: ! self.fp.write("class %s:\n\n"%classname) ! ! def compileevent(self, event): ! """Generate code for a single event""" ! [name, desc, code, subcode, returns, accepts, arguments] = event ! fp = self.fp ! funcname = identify(name) ! # ! # generate name->keyword map ! # ! if arguments: ! fp.write("\t_argmap_%s = {\n"%funcname) ! for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `a[1]`)) ! fp.write("\t}\n\n") ! ! # ! # Generate function header ! # ! has_arg = (not is_null(accepts)) ! opt_arg = (has_arg and is_optional(accepts)) ! ! fp.write("\tdef %s(self, "%funcname) ! if has_arg: ! if not opt_arg: ! fp.write("_object, ") # Include direct object, if it has one ! else: ! fp.write("_object=None, ") # Also include if it is optional ! else: ! fp.write("_no_object=None, ") # For argument checking ! fp.write("_attributes={}, **_arguments):\n") # include attribute dict and args ! # ! # Generate doc string (important, since it may be the only ! # available documentation, due to our name-remaping) ! # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) ! if has_arg: ! fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) ! elif opt_arg: ! fp.write("\t\tOptional argument: %s\n"%getdatadoc(accepts)) ! for arg in arguments: ! fp.write("\t\tKeyword argument %s: %s\n"%(identify(arg[0]), ! getdatadoc(arg[2]))) ! fp.write("\t\tKeyword argument _attributes: AppleEvent attribute dictionary\n") ! if not is_null(returns): ! fp.write("\t\tReturns: %s\n"%getdatadoc(returns)) ! fp.write('\t\t"""\n') ! # ! # Fiddle the args so everything ends up in 'arguments' dictionary ! # ! fp.write("\t\t_code = %s\n"% `code`) ! fp.write("\t\t_subcode = %s\n\n"% `subcode`) ! # ! # Do keyword name substitution ! # ! if arguments: ! fp.write("\t\taetools.keysubst(_arguments, self._argmap_%s)\n"%funcname) ! else: ! fp.write("\t\tif _arguments: raise TypeError, 'No optional args expected'\n") ! # ! # Stuff required arg (if there is one) into arguments ! # ! if has_arg: ! fp.write("\t\t_arguments['----'] = _object\n") ! elif opt_arg: ! fp.write("\t\tif _object:\n") ! fp.write("\t\t\t_arguments['----'] = _object\n") ! else: ! fp.write("\t\tif _no_object != None: raise TypeError, 'No direct arg expected'\n") ! fp.write("\n") ! # ! # Do enum-name substitution ! # ! for a in arguments: ! if is_enum(a[2]): ! kname = a[1] ! ename = a[2][0] ! if ename <> '****': ! fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`kname`, identify(ename))) ! self.enumsneeded[ename] = 1 ! fp.write("\n") ! # ! # Do the transaction ! # ! fp.write("\t\t_reply, _arguments, _attributes = self.send(_code, _subcode,\n") ! fp.write("\t\t\t\t_arguments, _attributes)\n") ! # ! # Error handling ! # ! fp.write("\t\tif _arguments.get('errn', 0):\n") ! fp.write("\t\t\traise aetools.Error, aetools.decodeerror(_arguments)\n") ! fp.write("\t\t# XXXX Optionally decode result\n") ! # ! # Decode result ! # ! fp.write("\t\tif _arguments.has_key('----'):\n") ! if is_enum(returns): ! fp.write("\t\t\t# XXXX Should do enum remapping here...\n") ! fp.write("\t\t\treturn _arguments['----']\n") ! fp.write("\n") ! ! def findenumsinevent(self, event): ! """Find all enums for a single event""" ! [name, desc, code, subcode, returns, accepts, arguments] = event ! for a in arguments: ! if is_enum(a[2]): ! ename = a[2][0] ! if ename <> '****': ! self.enumsneeded[ename] = 1 # # This class stores the code<->name translations for a single module. It is used From fdrake@users.sourceforge.net Tue Apr 1 15:40:14 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 01 Apr 2003 07:40:14 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.93.6.9,2.93.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11239 Modified Files: Tag: release22-maint abstract.c Log Message: Remove trailing newline. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.93.6.9 retrieving revision 2.93.6.10 diff -C2 -d -r2.93.6.9 -r2.93.6.10 *** abstract.c 7 Dec 2002 10:15:38 -0000 2.93.6.9 --- abstract.c 1 Apr 2003 15:40:07 -0000 2.93.6.10 *************** *** 2097,2099 **** return result; } - --- 2097,2098 ---- From goodger@users.sourceforge.net Tue Apr 1 17:38:07 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 01 Apr 2003 09:38:07 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,NONE,1.1 pep-0000.txt,1.234,1.235 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv1712 Modified Files: pep-0000.txt Added Files: pep-0313.txt Log Message: added PEP 313, Adding Roman Numeral Literals to Python, by Mike Meyer --- NEW FILE: pep-0313.txt --- PEP: 313 Title: Adding Roman Numeral Literals to Python Version: $Revision $ Last-Modified: $Date $ Author: Mike Meyer Status: Draft Type: Standards Track Content-Type: text/plain Created: 01-Apr-2003 Python-Version: 2.4 Post-History: Abstract This PEP proposes adding Roman numerals as a literal type. It also proposes the new built-in function "roman", which converts an object to an integer, then converts the integer to a string that is the Roman numeral literal equivalent to the integer. Rationale Roman numerals are used in a number of areas, and adding them to Python as literals would make computations in those areas easier. For instance, Superbowls are counted with Roman numerals, and many older movies have copyright dates in Roman numerals. Further, LISP provides a Roman numerals literal package, so adding Roman numerals to Python will help ease the LISP-envy sometimes seen in comp.lang.python. Besides, the author thinks this is the easiest way to get his name on a PEP. Syntax for Roman literals Roman numeral literals will consist of the characters M, D, C, L, X, V and I, and only those characters. They must be in upper case, and represent an integer with the following rules: 1. Except as noted below, they must appear in the order M, D, C, L, X, V then I. Each occurence of each character adds 1000, 500, 100, 50, 10, 5 and 1 to the value of the literal, respectively. 2. Only one D, V or L may appear in any given literal. 3. At most three Is, Xs and Cs may appear in any given literal. 4. A single I may appear immediately to the left of the single V, followed by no Is, and adds 4 to the value of the literal. 5. A single I may likewise appear before the last X, followed by no Is or Vs, and adds 9 to the value. 6. X is to L and C as I is to V and X, except the values are 40 and 90, respectively. 7. C is to D and M as I is to V and X, except the values are 400 and 900, respectively. Any literal composed entirely of M, D, C, L, X, V and I characters that does not follow this format will raise a syntax error, because explicit is better than implicit. Builtin "roman" Function The new builtin function "roman" will aide the translation from integers to Roman numeral literals. It will accept a single object as an argument, and return a string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239 [1]) it will passed through the existing builtin "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal (see PEP 240 [2]) with the integers in the string being Roman numeral literals. Compatability Issues No new keywords are introduced by this proposal. Programs that use variable names that are all upper case and contain only the characters M, D, C, L, X, V and I will be affected by the new literals. These programs will now have syntax errors when those variables are assigned, and either syntax errors or subtle bugs when those variables are referenced in expressions. Since such variable names violate PEP 8 [3], the code is already broken, it just wasn't generating exceptions. This proposal corrects that oversight in the language. References [1] PEP 239, Adding a Rational Type to Python http://www.python.org/peps/pep-0239.html [2] PEP 240, Adding a Rational Literal to Python http://www.python.org/peps/pep-0240.html [3] PEP 8, Style Guide for Python Code http://www.python.org/peps/pep-0008.html Copyright This document has been placed in the public domain. ^L Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** pep-0000.txt 30 Mar 2003 14:46:54 -0000 1.234 --- pep-0000.txt 1 Apr 2003 17:37:46 -0000 1.235 *************** *** 115,118 **** --- 115,119 ---- S 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli + S 313 Adding Roman Numeral Literals to Python Meyer Finished PEPs (done, implemented in CVS) *************** *** 317,320 **** --- 318,322 ---- S 311 Simplified GIL Acquisition for Extensions Hammond S 312 Simple Implicit Lambda Suzi, Martelli + S 313 Adding Roman Numeral Literals to Python Meyer SR 666 Reject Foolish Indentation Creighton *************** *** 376,379 **** --- 378,382 ---- McNamara, Andrew andrewm@object-craft.com.au Mick, Trent trentm@activestate.com + Meyer, Mike mwm@mired.org Montanaro, Skip skip@pobox.com Moore, Paul gustav@morpheus.demon.co.uk From goodger@users.sourceforge.net Tue Apr 1 17:41:36 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 01 Apr 2003 09:41:36 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv3500 Modified Files: pep-0313.txt Log Message: keyword fix Index: pep-0313.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0313.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0313.txt 1 Apr 2003 17:38:03 -0000 1.1 --- pep-0313.txt 1 Apr 2003 17:41:34 -0000 1.2 *************** *** 1,6 **** PEP: 313 Title: Adding Roman Numeral Literals to Python ! Version: $Revision $ ! Last-Modified: $Date $ Author: Mike Meyer Status: Draft --- 1,6 ---- PEP: 313 Title: Adding Roman Numeral Literals to Python ! Version: $Revision$ ! Last-Modified: $Date$ Author: Mike Meyer Status: Draft From jackjansen@users.sourceforge.net Tue Apr 1 22:02:05 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:02:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv19534 Modified Files: gensuitemodule.py Log Message: Properties (like enums) are not in the global namespace but only valid within a certain context. Give them an _Prop_ prefix, so they don't accidentally obscure an element from another suite (as happened with the Finder). Comparisons I'm not sure about, so I left them as global names. Also got rid of the lists if declarations, they serve no useful purpose. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gensuitemodule.py 1 Apr 2003 14:25:49 -0000 1.4 --- gensuitemodule.py 1 Apr 2003 22:01:58 -0000 1.5 *************** *** 974,981 **** return if self.fp: ! self.fp.write("\n%s = %s\n"%(pname, othername)) else: if self.fp: ! self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) self.fp.write("\twhich = %s\n" % `code`) --- 974,981 ---- return if self.fp: ! self.fp.write("\n_Prop_%s = _Prop_%s\n"%(pname, othername)) else: if self.fp: ! self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) self.fp.write("\twhich = %s\n" % `code`) *************** *** 1042,1046 **** self.fp.write("%s._privpropdict = {\n"%cname) for n in plist: ! self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._privelemdict = {\n"%cname) --- 1042,1046 ---- self.fp.write("%s._privpropdict = {\n"%cname) for n in plist: ! self.fp.write("\t'%s' : _Prop_%s,\n"%(n, n)) self.fp.write("}\n") self.fp.write("%s._privelemdict = {\n"%cname) *************** *** 1095,1118 **** self.fp.write("}\n") ! self.fp.write("\n_propdeclarations = {\n") ! proplist = self.namemappers[0].getall('property') ! proplist.sort() ! for k, v in proplist: ! self.fp.write("\t%s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") ! ! self.fp.write("\n_compdeclarations = {\n") ! complist = self.namemappers[0].getall('comparison') ! complist.sort() ! for k, v in complist: ! self.fp.write("\t%s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") ! ! self.fp.write("\n_enumdeclarations = {\n") ! enumlist = self.namemappers[0].getall('enum') ! enumlist.sort() ! for k, v in enumlist: ! self.fp.write("\t%s : %s,\n" % (`k`, v)) ! self.fp.write("}\n") def compiledata(data): --- 1095,1118 ---- self.fp.write("}\n") ! ## self.fp.write("\n_propdeclarations = {\n") ! ## proplist = self.namemappers[0].getall('property') ! ## proplist.sort() ! ## for k, v in proplist: ! ## self.fp.write("\t%s : _Prop_%s,\n" % (`k`, v)) ! ## self.fp.write("}\n") ! ## ! ## self.fp.write("\n_compdeclarations = {\n") ! ## complist = self.namemappers[0].getall('comparison') ! ## complist.sort() ! ## for k, v in complist: ! ## self.fp.write("\t%s : %s,\n" % (`k`, v)) ! ## self.fp.write("}\n") ! ## ! ## self.fp.write("\n_enumdeclarations = {\n") ! ## enumlist = self.namemappers[0].getall('enum') ! ## enumlist.sort() ! ## for k, v in enumlist: ! ## self.fp.write("\t%s : %s,\n" % (`k`, v)) ! ## self.fp.write("}\n") def compiledata(data): From jackjansen@users.sourceforge.net Tue Apr 1 22:05:28 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.4,1.5 PowerPlant.py,1.3,1.4 Required_suite.py,1.2,1.3 Standard_Suite.py,1.3,1.4 Standard_URL_suite.py,1.2,1.3 Text.py,1.5,1.6 WorldWideWeb_suite.py,1.3,1.4 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Mozilla_suite.py 28 Mar 2003 23:37:57 -0000 1.4 --- Mozilla_suite.py 1 Apr 2003 22:04:44 -0000 1.5 *************** *** 256,269 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'comp' : _Enum_comp, - 'dire' : _Enum_dire, - 'ncmd' : _Enum_ncmd, - } --- 256,257 ---- Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PowerPlant.py 28 Mar 2003 22:07:18 -0000 1.3 --- PowerPlant.py 1 Apr 2003 22:04:45 -0000 1.4 *************** *** 75,86 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'dbac' : _Enum_dbac, - } --- 75,76 ---- Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Required_suite.py 1 Apr 2003 22:04:45 -0000 1.3 *************** *** 98,108 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 98,99 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 28 Mar 2003 23:37:57 -0000 1.3 --- Standard_Suite.py 1 Apr 2003 22:04:45 -0000 1.4 *************** *** 105,113 **** """application - An application program """ want = 'capp' ! class alert_application(aetools.NProperty): """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ which = 'ALAP' want = 'type' ! class kiosk_mode(aetools.NProperty): """kiosk mode - Kiosk mode leaves very few menus enabled """ which = 'KOSK' --- 105,113 ---- """application - An application program """ want = 'capp' ! class _Prop_alert_application(aetools.NProperty): """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ which = 'ALAP' want = 'type' ! class _Prop_kiosk_mode(aetools.NProperty): """kiosk mode - Kiosk mode leaves very few menus enabled """ which = 'KOSK' *************** *** 118,178 **** """window - A Window """ want = 'cwin' ! class URL(aetools.NProperty): """URL - Current URL """ which = 'curl' want = 'TEXT' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class busy(aetools.NProperty): """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ which = 'busy' want = 'long' ! class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class unique_ID(aetools.NProperty): """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' ! class visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' --- 118,178 ---- """window - A Window """ want = 'cwin' ! class _Prop_URL(aetools.NProperty): """URL - Current URL """ which = 'curl' want = 'TEXT' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_busy(aetools.NProperty): """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ which = 'busy' want = 'long' ! class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class _Prop_floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class _Prop_index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class _Prop_position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class _Prop_unique_ID(aetools.NProperty): """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' ! class _Prop_visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' *************** *** 180,185 **** application._superclassnames = [] application._privpropdict = { ! 'alert_application' : alert_application, ! 'kiosk_mode' : kiosk_mode, } application._privelemdict = { --- 180,185 ---- application._superclassnames = [] application._privpropdict = { ! 'alert_application' : _Prop_alert_application, ! 'kiosk_mode' : _Prop_kiosk_mode, } application._privelemdict = { *************** *** 188,206 **** window._superclassnames = [] window._privpropdict = { ! 'URL' : URL, ! 'bounds' : bounds, ! 'busy' : busy, ! 'closeable' : closeable, ! 'floating' : floating, ! 'index' : index, ! 'modal' : modal, ! 'name' : name, ! 'position' : position, ! 'resizable' : resizable, ! 'titled' : titled, ! 'unique_ID' : unique_ID, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 188,206 ---- window._superclassnames = [] window._privpropdict = { ! 'URL' : _Prop_URL, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'closeable' : _Prop_closeable, ! 'floating' : _Prop_floating, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'unique_ID' : _Prop_unique_ID, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 213,241 **** 'capp' : application, 'cwin' : window, - } - - _propdeclarations = { - 'ALAP' : alert_application, - 'KOSK' : kiosk_mode, - 'busy' : busy, - 'curl' : URL, - 'hclb' : closeable, - 'isfl' : floating, - 'iszm' : zoomable, - 'pbnd' : bounds, - 'pidx' : index, - 'pmod' : modal, - 'pnam' : name, - 'ppos' : position, - 'prsz' : resizable, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'wiid' : unique_ID, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 213,215 ---- Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_URL_suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Standard_URL_suite.py 1 Apr 2003 22:04:45 -0000 1.3 *************** *** 48,58 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 48,49 ---- Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Text.py 30 Mar 2003 22:41:48 -0000 1.5 --- Text.py 1 Apr 2003 22:04:46 -0000 1.6 *************** *** 20,40 **** """text - independent text view objects """ want = 'ctxt' ! class beginning(aetools.NProperty): """beginning - Beginning of element """ which = 'bgng' want = 'obj ' ! class end(aetools.NProperty): """end - Ending of element """ which = 'end ' want = 'obj ' ! class infront(aetools.NProperty): """infront - Immediately before element """ which = 'pBef' want = 'obj ' ! class justbehind(aetools.NProperty): """justbehind - Immediately after element """ which = 'pAft' want = 'obj ' ! class updateLevel(aetools.NProperty): """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ which = 'pUpL' --- 20,40 ---- """text - independent text view objects """ want = 'ctxt' ! class _Prop_beginning(aetools.NProperty): """beginning - Beginning of element """ which = 'bgng' want = 'obj ' ! class _Prop_end(aetools.NProperty): """end - Ending of element """ which = 'end ' want = 'obj ' ! class _Prop_infront(aetools.NProperty): """infront - Immediately before element """ which = 'pBef' want = 'obj ' ! class _Prop_justbehind(aetools.NProperty): """justbehind - Immediately after element """ which = 'pAft' want = 'obj ' ! class _Prop_updateLevel(aetools.NProperty): """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ which = 'pUpL' *************** *** 45,69 **** """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ want = 'stys' ! class color(aetools.NProperty): """color - the color """ which = 'colr' want = 'RGB ' ! class font(aetools.NProperty): """font - font name """ which = 'font' want = 'TEXT' ! class name(aetools.NProperty): """name - style name """ which = 'pnam' want = 'TEXT' ! class size(aetools.NProperty): """size - the size in points """ which = 'ptsz' want = 'long' ! class style(aetools.NProperty): """style - the text styles or face attributes """ which = 'txst' want = 'tsty' ! class writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' --- 45,69 ---- """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ want = 'stys' ! class _Prop_color(aetools.NProperty): """color - the color """ which = 'colr' want = 'RGB ' ! class _Prop_font(aetools.NProperty): """font - font name """ which = 'font' want = 'TEXT' ! class _Prop_name(aetools.NProperty): """name - style name """ which = 'pnam' want = 'TEXT' ! class _Prop_size(aetools.NProperty): """size - the size in points """ which = 'ptsz' want = 'long' ! class _Prop_style(aetools.NProperty): """style - the text styles or face attributes """ which = 'txst' want = 'tsty' ! class _Prop_writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' *************** *** 73,81 **** text._superclassnames = [] text._privpropdict = { ! 'beginning' : beginning, ! 'end' : end, ! 'infront' : infront, ! 'justbehind' : justbehind, ! 'updateLevel' : updateLevel, } text._privelemdict = { --- 73,81 ---- text._superclassnames = [] text._privpropdict = { ! 'beginning' : _Prop_beginning, ! 'end' : _Prop_end, ! 'infront' : _Prop_infront, ! 'justbehind' : _Prop_justbehind, ! 'updateLevel' : _Prop_updateLevel, } text._privelemdict = { *************** *** 84,93 **** styleset._superclassnames = [] styleset._privpropdict = { ! 'color' : color, ! 'font' : font, ! 'name' : name, ! 'size' : size, ! 'style' : style, ! 'writing_code' : writing_code, } styleset._privelemdict = { --- 84,93 ---- styleset._superclassnames = [] styleset._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'name' : _Prop_name, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'writing_code' : _Prop_writing_code, } styleset._privelemdict = { *************** *** 100,122 **** 'ctxt' : text, 'stys' : styleset, - } - - _propdeclarations = { - 'bgng' : beginning, - 'colr' : color, - 'end ' : end, - 'font' : font, - 'pAft' : justbehind, - 'pBef' : infront, - 'pUpL' : updateLevel, - 'pnam' : name, - 'psct' : writing_code, - 'ptsz' : size, - 'txst' : style, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 100,102 ---- Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WorldWideWeb_suite.py 28 Mar 2003 22:07:20 -0000 1.3 --- WorldWideWeb_suite.py 1 Apr 2003 22:04:47 -0000 1.4 *************** *** 416,426 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 416,417 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 30 Mar 2003 22:41:49 -0000 1.5 --- __init__.py 1 Apr 2003 22:04:48 -0000 1.6 *************** *** 62,67 **** getbaseclasses(window) getbaseclasses(application) - getbaseclasses(text) - getbaseclasses(styleset) getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.character) --- 62,65 ---- *************** *** 71,74 **** --- 69,74 ---- getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.text) + getbaseclasses(text) + getbaseclasses(styleset) # *************** *** 78,83 **** 'cwin' : window, 'capp' : application, - 'ctxt' : text, - 'stys' : styleset, 'cflo' : StdSuites.Text_Suite.text_flow, 'cha ' : StdSuites.Text_Suite.character, --- 78,81 ---- *************** *** 87,90 **** --- 85,90 ---- 'cpar' : StdSuites.Text_Suite.paragraph, 'ctxt' : StdSuites.Text_Suite.text, + 'ctxt' : text, + 'stys' : styleset, } From jackjansen@users.sourceforge.net Tue Apr 1 22:05:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:24 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Containers_and_folders.py,1.6,1.7 Enumerations.py,1.5,1.6 Files.py,1.1,1.2 Finder_Basics.py,1.4,1.5 Finder_items.py,1.4,1.5 Legacy_suite.py,1.1,1.2 Standard_Suite.py,1.4,1.5 Type_Definitions.py,1.6,1.7 Window_classes.py,1.6,1.7 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Finder Modified Files: Containers_and_folders.py Enumerations.py Files.py Finder_Basics.py Finder_items.py Legacy_suite.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Containers_and_folders.py 30 Mar 2003 22:41:48 -0000 1.6 --- Containers_and_folders.py 1 Apr 2003 22:04:35 -0000 1.7 *************** *** 19,51 **** """disk - A disk """ want = 'cdis' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the container class """ which = 'c@#^' want = 'ctnr' ! class capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'comp' ! class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class format(aetools.NProperty): """format - the filesystem format of this disk """ which = 'dfmt' want = 'edfm' ! class free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'comp' ! class ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' --- 19,51 ---- """disk - A disk """ want = 'cdis' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the container class """ which = 'c@#^' want = 'ctnr' ! class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'comp' ! class _Prop_ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class _Prop_format(aetools.NProperty): """format - the filesystem format of this disk """ which = 'dfmt' want = 'edfm' ! class _Prop_free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'comp' ! class _Prop_ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class _Prop_local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' *************** *** 98,118 **** """container - An item that contains other items """ want = 'ctnr' ! class completely_expanded(aetools.NProperty): """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ which = 'pexc' want = 'bool' ! class container_window(aetools.NProperty): """container window - the container window for this folder """ which = 'cwnd' want = 'obj ' ! class entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ which = 'ects' want = 'obj ' ! class expandable(aetools.NProperty): """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ which = 'pexa' want = 'bool' ! class expanded(aetools.NProperty): """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ which = 'pexp' --- 98,118 ---- """container - An item that contains other items """ want = 'ctnr' ! class _Prop_completely_expanded(aetools.NProperty): """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ which = 'pexc' want = 'bool' ! class _Prop_container_window(aetools.NProperty): """container window - the container window for this folder """ which = 'cwnd' want = 'obj ' ! class _Prop_entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ which = 'ects' want = 'obj ' ! class _Prop_expandable(aetools.NProperty): """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ which = 'pexa' want = 'bool' ! class _Prop_expanded(aetools.NProperty): """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ which = 'pexp' *************** *** 134,138 **** """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ want = 'ctrs' ! class warns_before_emptying(aetools.NProperty): """warns before emptying - Display a dialog when emptying the trash? """ which = 'warn' --- 134,138 ---- """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ want = 'ctrs' ! class _Prop_warns_before_emptying(aetools.NProperty): """warns before emptying - Display a dialog when emptying the trash? """ which = 'warn' *************** *** 152,163 **** import Finder_items disk._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'capacity' : capacity, ! 'ejectable' : ejectable, ! 'format' : format, ! 'free_space' : free_space, ! 'ignore_privileges' : ignore_privileges, ! 'local_volume' : local_volume, ! 'startup' : startup, } disk._privelemdict = { --- 152,163 ---- import Finder_items disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'startup' : _Prop_startup, } disk._privelemdict = { *************** *** 175,179 **** desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { --- 175,179 ---- desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { *************** *** 192,196 **** folder._superclassnames = ['container'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } folder._privelemdict = { --- 192,196 ---- folder._superclassnames = ['container'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } folder._privelemdict = { *************** *** 208,217 **** container._superclassnames = ['item'] container._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'completely_expanded' : completely_expanded, ! 'container_window' : container_window, ! 'entire_contents' : entire_contents, ! 'expandable' : expandable, ! 'expanded' : expanded, } container._privelemdict = { --- 208,217 ---- container._superclassnames = ['item'] container._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'completely_expanded' : _Prop_completely_expanded, ! 'container_window' : _Prop_container_window, ! 'entire_contents' : _Prop_entire_contents, ! 'expandable' : _Prop_expandable, ! 'expanded' : _Prop_expanded, } container._privelemdict = { *************** *** 229,234 **** trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'warns_before_emptying' : warns_before_emptying, } trash_2d_object._privelemdict = { --- 229,234 ---- trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'warns_before_emptying' : _Prop_warns_before_emptying, } trash_2d_object._privelemdict = { *************** *** 254,279 **** 'ctnr' : container, 'ctrs' : trash_2d_object, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'capa' : capacity, - 'cwnd' : container_window, - 'dfmt' : format, - 'ects' : entire_contents, - 'frsp' : free_space, - 'igpr' : ignore_privileges, - 'isej' : ejectable, - 'isrv' : local_volume, - 'istd' : startup, - 'pexa' : expandable, - 'pexc' : completely_expanded, - 'pexp' : expanded, - 'warn' : warns_before_emptying, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 254,256 ---- Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Enumerations.py 29 Mar 2003 00:13:13 -0000 1.5 --- Enumerations.py 1 Apr 2003 22:04:36 -0000 1.6 *************** *** 125,145 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'earr' : _Enum_earr, - 'ecvw' : _Enum_ecvw, - 'edfm' : _Enum_edfm, - 'elsv' : _Enum_elsv, - 'ipnl' : _Enum_ipnl, - 'isiz' : _Enum_isiz, - 'lvic' : _Enum_lvic, - 'priv' : _Enum_priv, - 'sodr' : _Enum_sodr, - 'vwby' : _Enum_vwby, - } --- 125,126 ---- Index: Files.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Files.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Files.py 29 Mar 2003 00:13:14 -0000 1.1 --- Files.py 1 Apr 2003 22:04:37 -0000 1.2 *************** *** 19,27 **** """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the file class """ which = 'c@#^' want = 'file' ! class original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ which = 'orig' --- 19,27 ---- """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the file class """ which = 'c@#^' want = 'file' ! class _Prop_original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ which = 'orig' *************** *** 33,57 **** """application file - An application's file on disk """ want = 'appf' ! class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ which = 'isab' want = 'bool' ! class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class minimum_size(aetools.NProperty): """minimum size - the smallest memory size with which the application can be launched """ which = 'mprt' want = 'long' ! class opens_in_Classic(aetools.NProperty): """opens in Classic - Should the application launch in the Classic environment? """ which = 'Clsc' want = 'bool' ! class preferred_size(aetools.NProperty): """preferred size - the memory size with which the application will be launched """ which = 'appt' want = 'long' ! class suggested_size(aetools.NProperty): """suggested size - the memory size with which the developer recommends the application be launched """ which = 'sprt' --- 33,57 ---- """application file - An application's file on disk """ want = 'appf' ! class _Prop_accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ which = 'isab' want = 'bool' ! class _Prop_has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class _Prop_minimum_size(aetools.NProperty): """minimum size - the smallest memory size with which the application can be launched """ which = 'mprt' want = 'long' ! class _Prop_opens_in_Classic(aetools.NProperty): """opens in Classic - Should the application launch in the Classic environment? """ which = 'Clsc' want = 'bool' ! class _Prop_preferred_size(aetools.NProperty): """preferred size - the memory size with which the application will be launched """ which = 'appt' want = 'long' ! class _Prop_suggested_size(aetools.NProperty): """suggested size - the memory size with which the developer recommends the application be launched """ which = 'sprt' *************** *** 63,67 **** """clipping - A clipping """ want = 'clpf' ! class clipping_window(aetools.NProperty): """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ which = 'lwnd' --- 63,67 ---- """clipping - A clipping """ want = 'clpf' ! class _Prop_clipping_window(aetools.NProperty): """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ which = 'lwnd' *************** *** 79,99 **** """file - A file """ want = 'file' ! class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' ! class file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the item """ which = 'asty' want = 'type' ! class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'utxt' ! class stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' ! class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' --- 79,99 ---- """file - A file """ want = 'file' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the item """ which = 'asty' want = 'type' ! class _Prop_product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'utxt' ! class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' ! class _Prop_version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' *************** *** 105,109 **** """internet location file - An file containing an internet location """ want = 'inlf' ! class location(aetools.NProperty): """location - the internet location """ which = 'iloc' --- 105,109 ---- """internet location file - An file containing an internet location """ want = 'inlf' ! class _Prop_location(aetools.NProperty): """location - the internet location """ which = 'iloc' *************** *** 119,124 **** alias_file._superclassnames = ['file'] alias_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'original_item' : original_item, } alias_file._privelemdict = { --- 119,124 ---- alias_file._superclassnames = ['file'] alias_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'original_item' : _Prop_original_item, } alias_file._privelemdict = { *************** *** 126,136 **** application_file._superclassnames = ['file'] application_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'accepts_high_level_events' : accepts_high_level_events, ! 'has_scripting_terminology' : has_scripting_terminology, ! 'minimum_size' : minimum_size, ! 'opens_in_Classic' : opens_in_Classic, ! 'preferred_size' : preferred_size, ! 'suggested_size' : suggested_size, } application_file._privelemdict = { --- 126,136 ---- application_file._superclassnames = ['file'] application_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'minimum_size' : _Prop_minimum_size, ! 'opens_in_Classic' : _Prop_opens_in_Classic, ! 'preferred_size' : _Prop_preferred_size, ! 'suggested_size' : _Prop_suggested_size, } application_file._privelemdict = { *************** *** 138,143 **** clipping._superclassnames = ['file'] clipping._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'clipping_window' : clipping_window, } clipping._privelemdict = { --- 138,143 ---- clipping._superclassnames = ['file'] clipping._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'clipping_window' : _Prop_clipping_window, } clipping._privelemdict = { *************** *** 145,149 **** document_file._superclassnames = ['file'] document_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } document_file._privelemdict = { --- 145,149 ---- document_file._superclassnames = ['file'] document_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } document_file._privelemdict = { *************** *** 152,161 **** file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'creator_type' : creator_type, ! 'file_type' : file_type, ! 'product_version' : product_version, ! 'stationery' : stationery, ! 'version' : version, } file._privelemdict = { --- 152,161 ---- file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'product_version' : _Prop_product_version, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { *************** *** 163,168 **** internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'location' : location, } internet_location_file._privelemdict = { --- 163,168 ---- internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'location' : _Prop_location, } internet_location_file._privelemdict = { *************** *** 170,174 **** package._superclassnames = ['item'] package._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } package._privelemdict = { --- 170,174 ---- package._superclassnames = ['item'] package._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } package._privelemdict = { *************** *** 186,212 **** 'inlf' : internet_location_file, 'pack' : package, - } - - _propdeclarations = { - 'Clsc' : opens_in_Classic, - 'appt' : preferred_size, - 'asty' : file_type, - 'c@#^' : _3c_Inheritance_3e_, - 'fcrt' : creator_type, - 'hscr' : has_scripting_terminology, - 'iloc' : location, - 'isab' : accepts_high_level_events, - 'lwnd' : clipping_window, - 'mprt' : minimum_size, - 'orig' : original_item, - 'pspd' : stationery, - 'sprt' : suggested_size, - 'ver2' : product_version, - 'vers' : version, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 186,188 ---- Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Finder_Basics.py 29 Mar 2003 00:13:14 -0000 1.4 --- Finder_Basics.py 1 Apr 2003 22:04:38 -0000 1.5 *************** *** 62,114 **** """application - The Finder """ want = 'capp' ! class Finder_preferences(aetools.NProperty): """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ which = 'pfrp' want = 'cprf' ! class clipboard(aetools.NProperty): """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' ! class desktop(aetools.NProperty): """desktop - the desktop """ which = 'desk' want = 'cdsk' ! class frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' ! class home(aetools.NProperty): """home - the home directory """ which = 'home' want = 'cfol' ! class insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' ! class name(aetools.NProperty): """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' ! class product_version(aetools.NProperty): """product version - the version of the System software running on this computer """ which = 'ver2' want = 'utxt' ! class selection(aetools.NProperty): """selection - the selection in the frontmost Finder window """ which = 'sele' want = 'obj ' ! class startup_disk(aetools.NProperty): """startup disk - the startup disk """ which = 'sdsk' want = 'cdis' ! class trash(aetools.NProperty): """trash - the trash """ which = 'trsh' want = 'ctrs' ! class version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'utxt' ! class visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' --- 62,114 ---- """application - The Finder """ want = 'capp' ! class _Prop_Finder_preferences(aetools.NProperty): """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ which = 'pfrp' want = 'cprf' ! class _Prop_clipboard(aetools.NProperty): """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' ! class _Prop_desktop(aetools.NProperty): """desktop - the desktop """ which = 'desk' want = 'cdsk' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' ! class _Prop_home(aetools.NProperty): """home - the home directory """ which = 'home' want = 'cfol' ! class _Prop_insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' ! class _Prop_name(aetools.NProperty): """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' ! class _Prop_product_version(aetools.NProperty): """product version - the version of the System software running on this computer """ which = 'ver2' want = 'utxt' ! class _Prop_selection(aetools.NProperty): """selection - the selection in the frontmost Finder window """ which = 'sele' want = 'obj ' ! class _Prop_startup_disk(aetools.NProperty): """startup disk - the startup disk """ which = 'sdsk' want = 'cdis' ! class _Prop_trash(aetools.NProperty): """trash - the trash """ which = 'trsh' want = 'ctrs' ! class _Prop_version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'utxt' ! class _Prop_visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' *************** *** 134,150 **** import Finder_items application._privpropdict = { ! 'Finder_preferences' : Finder_preferences, ! 'clipboard' : clipboard, ! 'desktop' : desktop, ! 'frontmost' : frontmost, ! 'home' : home, ! 'insertion_location' : insertion_location, ! 'name' : name, ! 'product_version' : product_version, ! 'selection' : selection, ! 'startup_disk' : startup_disk, ! 'trash' : trash, ! 'version' : version, ! 'visible' : visible, } application._privelemdict = { --- 134,150 ---- import Finder_items application._privpropdict = { ! 'Finder_preferences' : _Prop_Finder_preferences, ! 'clipboard' : _Prop_clipboard, ! 'desktop' : _Prop_desktop, ! 'frontmost' : _Prop_frontmost, ! 'home' : _Prop_home, ! 'insertion_location' : _Prop_insertion_location, ! 'name' : _Prop_name, ! 'product_version' : _Prop_product_version, ! 'selection' : _Prop_selection, ! 'startup_disk' : _Prop_startup_disk, ! 'trash' : _Prop_trash, ! 'version' : _Prop_version, ! 'visible' : _Prop_visible, } application._privelemdict = { *************** *** 170,194 **** _classdeclarations = { 'capp' : application, - } - - _propdeclarations = { - 'desk' : desktop, - 'home' : home, - 'pcli' : clipboard, - 'pfrp' : Finder_preferences, - 'pins' : insertion_location, - 'pisf' : frontmost, - 'pnam' : name, - 'pvis' : visible, - 'sdsk' : startup_disk, - 'sele' : selection, - 'trsh' : trash, - 'ver2' : product_version, - 'vers' : version, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 170,172 ---- Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Finder_items.py 29 Mar 2003 00:13:14 -0000 1.4 --- Finder_items.py 1 Apr 2003 22:04:39 -0000 1.5 *************** *** 169,277 **** """item - An item """ want = 'cobj' ! class bounds(aetools.NProperty): """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ which = 'pbnd' want = 'qdrt' ! class comment(aetools.NProperty): """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' want = 'utxt' ! class container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' ! class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = 'ldt ' ! class description(aetools.NProperty): """description - a description of the item """ which = 'dscr' want = 'utxt' ! class disk(aetools.NProperty): """disk - the disk on which the item is stored """ which = 'cdis' want = 'obj ' ! class displayed_name(aetools.NProperty): """displayed name - the user-visible name of the item """ which = 'dnam' want = 'utxt' ! class everyones_privileges(aetools.NProperty): """everyones privileges - """ which = 'gstp' want = 'priv' ! class extension_hidden(aetools.NProperty): """extension hidden - Is the item's extension hidden from the user? """ which = 'hidx' want = 'bool' ! class group(aetools.NProperty): """group - the user or group that has special access to the container """ which = 'sgrp' want = 'utxt' ! class group_privileges(aetools.NProperty): """group privileges - """ which = 'gppr' want = 'priv' ! class icon(aetools.NProperty): """icon - the icon bitmap of the item """ which = 'iimg' want = 'ifam' ! class index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class information_window(aetools.NProperty): """information window - the information window for the item """ which = 'iwnd' want = 'obj ' ! class kind(aetools.NProperty): """kind - the kind of the item """ which = 'kind' want = 'utxt' ! class label_index(aetools.NProperty): """label index - the label of the item """ which = 'labi' want = 'long' ! class locked(aetools.NProperty): """locked - Is the file locked? """ which = 'aslk' want = 'bool' ! class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class name_extension(aetools.NProperty): """name extension - the name extension of the item (such as \xd2txt\xd3) """ which = 'nmxt' want = 'utxt' ! class owner(aetools.NProperty): """owner - the user that owns the container """ which = 'sown' want = 'utxt' ! class owner_privileges(aetools.NProperty): """owner privileges - """ which = 'ownr' want = 'priv' ! class physical_size(aetools.NProperty): """physical size - the actual space used by the item on disk """ which = 'phys' want = 'comp' ! class position(aetools.NProperty): """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ which = 'posn' want = 'QDpt' ! class properties(aetools.NProperty): """properties - every property of an item """ which = 'pALL' want = 'reco' ! class size(aetools.NProperty): """size - the logical size of the item """ which = 'ptsz' want = 'comp' ! class url(aetools.NProperty): """url - the url of the item """ which = 'pURL' --- 169,277 ---- """item - An item """ want = 'cobj' ! class _Prop_bounds(aetools.NProperty): """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ which = 'pbnd' want = 'qdrt' ! class _Prop_comment(aetools.NProperty): """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' want = 'utxt' ! class _Prop_container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' ! class _Prop_creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = 'ldt ' ! class _Prop_description(aetools.NProperty): """description - a description of the item """ which = 'dscr' want = 'utxt' ! class _Prop_disk(aetools.NProperty): """disk - the disk on which the item is stored """ which = 'cdis' want = 'obj ' ! class _Prop_displayed_name(aetools.NProperty): """displayed name - the user-visible name of the item """ which = 'dnam' want = 'utxt' ! class _Prop_everyones_privileges(aetools.NProperty): """everyones privileges - """ which = 'gstp' want = 'priv' ! class _Prop_extension_hidden(aetools.NProperty): """extension hidden - Is the item's extension hidden from the user? """ which = 'hidx' want = 'bool' ! class _Prop_group(aetools.NProperty): """group - the user or group that has special access to the container """ which = 'sgrp' want = 'utxt' ! class _Prop_group_privileges(aetools.NProperty): """group privileges - """ which = 'gppr' want = 'priv' ! class _Prop_icon(aetools.NProperty): """icon - the icon bitmap of the item """ which = 'iimg' want = 'ifam' ! class _Prop_index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class _Prop_information_window(aetools.NProperty): """information window - the information window for the item """ which = 'iwnd' want = 'obj ' ! class _Prop_kind(aetools.NProperty): """kind - the kind of the item """ which = 'kind' want = 'utxt' ! class _Prop_label_index(aetools.NProperty): """label index - the label of the item """ which = 'labi' want = 'long' ! class _Prop_locked(aetools.NProperty): """locked - Is the file locked? """ which = 'aslk' want = 'bool' ! class _Prop_modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class _Prop_name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class _Prop_name_extension(aetools.NProperty): """name extension - the name extension of the item (such as \xd2txt\xd3) """ which = 'nmxt' want = 'utxt' ! class _Prop_owner(aetools.NProperty): """owner - the user that owns the container """ which = 'sown' want = 'utxt' ! class _Prop_owner_privileges(aetools.NProperty): """owner privileges - """ which = 'ownr' want = 'priv' ! class _Prop_physical_size(aetools.NProperty): """physical size - the actual space used by the item on disk """ which = 'phys' want = 'comp' ! class _Prop_position(aetools.NProperty): """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ which = 'posn' want = 'QDpt' ! class _Prop_properties(aetools.NProperty): """properties - every property of an item """ which = 'pALL' want = 'reco' ! class _Prop_size(aetools.NProperty): """size - the logical size of the item """ which = 'ptsz' want = 'comp' ! class _Prop_url(aetools.NProperty): """url - the url of the item """ which = 'pURL' *************** *** 281,311 **** item._superclassnames = [] item._privpropdict = { ! 'bounds' : bounds, ! 'comment' : comment, ! 'container' : container, ! 'creation_date' : creation_date, ! 'description' : description, ! 'disk' : disk, ! 'displayed_name' : displayed_name, ! 'everyones_privileges' : everyones_privileges, ! 'extension_hidden' : extension_hidden, ! 'group' : group, ! 'group_privileges' : group_privileges, ! 'icon' : icon, ! 'index' : index, ! 'information_window' : information_window, ! 'kind' : kind, ! 'label_index' : label_index, ! 'locked' : locked, ! 'modification_date' : modification_date, ! 'name' : name, ! 'name_extension' : name_extension, ! 'owner' : owner, ! 'owner_privileges' : owner_privileges, ! 'physical_size' : physical_size, ! 'position' : position, ! 'properties' : properties, ! 'size' : size, ! 'url' : url, } item._privelemdict = { --- 281,311 ---- item._superclassnames = [] item._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'comment' : _Prop_comment, ! 'container' : _Prop_container, ! 'creation_date' : _Prop_creation_date, ! 'description' : _Prop_description, ! 'disk' : _Prop_disk, ! 'displayed_name' : _Prop_displayed_name, ! 'everyones_privileges' : _Prop_everyones_privileges, ! 'extension_hidden' : _Prop_extension_hidden, ! 'group' : _Prop_group, ! 'group_privileges' : _Prop_group_privileges, ! 'icon' : _Prop_icon, ! 'index' : _Prop_index, ! 'information_window' : _Prop_information_window, ! 'kind' : _Prop_kind, ! 'label_index' : _Prop_label_index, ! 'locked' : _Prop_locked, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'owner' : _Prop_owner, ! 'owner_privileges' : _Prop_owner_privileges, ! 'physical_size' : _Prop_physical_size, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'url' : _Prop_url, } item._privelemdict = { *************** *** 317,355 **** _classdeclarations = { 'cobj' : item, - } - - _propdeclarations = { - 'ascd' : creation_date, - 'aslk' : locked, - 'asmo' : modification_date, - 'cdis' : disk, - 'comt' : comment, - 'ctnr' : container, - 'dnam' : displayed_name, - 'dscr' : description, - 'gppr' : group_privileges, - 'gstp' : everyones_privileges, - 'hidx' : extension_hidden, - 'iimg' : icon, - 'iwnd' : information_window, - 'kind' : kind, - 'labi' : label_index, - 'nmxt' : name_extension, - 'ownr' : owner_privileges, - 'pALL' : properties, - 'pURL' : url, - 'pbnd' : bounds, - 'phys' : physical_size, - 'pidx' : index, - 'pnam' : name, - 'posn' : position, - 'ptsz' : size, - 'sgrp' : group, - 'sown' : owner, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 317,319 ---- Index: Legacy_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Legacy_suite.py 29 Mar 2003 00:13:14 -0000 1.1 --- Legacy_suite.py 1 Apr 2003 22:04:40 -0000 1.2 *************** *** 74,78 **** """application - The Finder """ want = 'capp' ! class desktop_picture(aetools.NProperty): """desktop picture - the desktop picture of the main monitor """ which = 'dpic' --- 74,78 ---- """application - The Finder """ want = 'capp' ! class _Prop_desktop_picture(aetools.NProperty): """desktop picture - the desktop picture of the main monitor """ which = 'dpic' *************** *** 82,90 **** """application process - A process launched from an application file """ want = 'pcap' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the process class """ which = 'c@#^' want = 'prcs' ! class application_file(aetools.NProperty): """application file - the application file from which this process was launched """ which = 'appf' --- 82,90 ---- """application process - A process launched from an application file """ want = 'pcap' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the process class """ which = 'c@#^' want = 'prcs' ! class _Prop_application_file(aetools.NProperty): """application file - the application file from which this process was launched """ which = 'appf' *************** *** 96,100 **** """desk accessory process - A process launched from a desk accessory file """ want = 'pcda' ! class desk_accessory_file(aetools.NProperty): """desk accessory file - the desk accessory file from which this process was launched """ which = 'dafi' --- 96,100 ---- """desk accessory process - A process launched from a desk accessory file """ want = 'pcda' ! class _Prop_desk_accessory_file(aetools.NProperty): """desk accessory file - the desk accessory file from which this process was launched """ which = 'dafi' *************** *** 106,150 **** """process - A process running on this computer """ want = 'prcs' ! class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'type' ! class file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = 'obj ' ! class file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'type' ! class frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process? """ which = 'pisf' want = 'bool' ! class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'itxt' ! class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' ! class total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'long' ! class visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' --- 106,150 ---- """process - A process running on this computer """ want = 'prcs' ! class _Prop_accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class _Prop_accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'type' ! class _Prop_file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = 'obj ' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'type' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process? """ which = 'pisf' want = 'bool' ! class _Prop_has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'itxt' ! class _Prop_partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' ! class _Prop_total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'long' ! class _Prop_visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' *************** *** 154,158 **** application._superclassnames = [] application._privpropdict = { ! 'desktop_picture' : desktop_picture, } application._privelemdict = { --- 154,158 ---- application._superclassnames = [] application._privpropdict = { ! 'desktop_picture' : _Prop_desktop_picture, } application._privelemdict = { *************** *** 160,165 **** application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'application_file' : application_file, } application_process._privelemdict = { --- 160,165 ---- application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'application_file' : _Prop_application_file, } application_process._privelemdict = { *************** *** 167,172 **** desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'desk_accessory_file' : desk_accessory_file, } desk_accessory_process._privelemdict = { --- 167,172 ---- desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'desk_accessory_file' : _Prop_desk_accessory_file, } desk_accessory_process._privelemdict = { *************** *** 174,188 **** process._superclassnames = [] process._privpropdict = { ! 'accepts_high_level_events' : accepts_high_level_events, ! 'accepts_remote_events' : accepts_remote_events, ! 'creator_type' : creator_type, ! 'file' : file, ! 'file_type' : file_type, ! 'frontmost' : frontmost, ! 'has_scripting_terminology' : has_scripting_terminology, ! 'name' : name, ! 'partition_space_used' : partition_space_used, ! 'total_partition_size' : total_partition_size, ! 'visible' : visible, } process._privelemdict = { --- 174,188 ---- process._superclassnames = [] process._privpropdict = { ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'accepts_remote_events' : _Prop_accepts_remote_events, ! 'creator_type' : _Prop_creator_type, ! 'file' : _Prop_file, ! 'file_type' : _Prop_file_type, ! 'frontmost' : _Prop_frontmost, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'name' : _Prop_name, ! 'partition_space_used' : _Prop_partition_space_used, ! 'total_partition_size' : _Prop_total_partition_size, ! 'visible' : _Prop_visible, } process._privelemdict = { *************** *** 197,223 **** 'pcda' : desk_accessory_process, 'prcs' : process, - } - - _propdeclarations = { - 'appf' : application_file, - 'appt' : total_partition_size, - 'asty' : file_type, - 'c@#^' : _3c_Inheritance_3e_, - 'dafi' : desk_accessory_file, - 'dpic' : desktop_picture, - 'fcrt' : creator_type, - 'file' : file, - 'hscr' : has_scripting_terminology, - 'isab' : accepts_high_level_events, - 'pisf' : frontmost, - 'pnam' : name, - 'pusd' : partition_space_used, - 'pvis' : visible, - 'revt' : accepts_remote_events, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 197,199 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 29 Mar 2003 00:13:14 -0000 1.4 --- Standard_Suite.py 1 Apr 2003 22:04:41 -0000 1.5 *************** *** 325,335 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 325,326 ---- Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Type_Definitions.py 30 Mar 2003 22:41:48 -0000 1.6 --- Type_Definitions.py 1 Apr 2003 22:04:41 -0000 1.7 *************** *** 23,35 **** """label - (NOT AVAILABLE YET) A Finder label (name and color) """ want = 'clbl' ! class color(aetools.NProperty): """color - the color associated with the label """ which = 'colr' want = 'cRGB' ! class index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class name(aetools.NProperty): """name - the name associated with the label """ which = 'pnam' --- 23,35 ---- """label - (NOT AVAILABLE YET) A Finder label (name and color) """ want = 'clbl' ! class _Prop_color(aetools.NProperty): """color - the color associated with the label """ which = 'colr' want = 'cRGB' ! class _Prop_index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ which = 'pidx' want = 'long' ! class _Prop_name(aetools.NProperty): """name - the name associated with the label """ which = 'pnam' *************** *** 39,123 **** """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ want = 'cprf' ! class button_view_arrangement(aetools.NProperty): """button view arrangement - the method of arrangement of icons in default Finder button view windows """ which = 'barr' want = 'earr' ! class button_view_icon_size(aetools.NProperty): """button view icon size - the size of icons displayed in Finder button view windows. """ which = 'bisz' want = 'long' ! class calculates_folder_sizes(aetools.NProperty): """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ which = 'sfsz' want = 'bool' ! class delay_before_springing(aetools.NProperty): """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ which = 'dela' want = 'shor' ! class list_view_icon_size(aetools.NProperty): """list view icon size - the size of icons displayed in Finder list view windows. """ which = 'lisz' want = 'long' ! class shows_comments(aetools.NProperty): """shows comments - Are comments displayed in default Finder list view windows? """ which = 'scom' want = 'bool' ! class shows_creation_date(aetools.NProperty): """shows creation date - Are creation dates displayed in default Finder list view windows? """ which = 'scda' want = 'bool' ! class shows_kind(aetools.NProperty): """shows kind - Are document kinds displayed in default Finder list view windows? """ which = 'sknd' want = 'bool' ! class shows_label(aetools.NProperty): """shows label - Are labels displayed in default Finder list view windows? """ which = 'slbl' want = 'bool' ! class shows_modification_date(aetools.NProperty): """shows modification date - Are modification dates displayed in default Finder list view windows? """ which = 'sdat' want = 'bool' ! class shows_size(aetools.NProperty): """shows size - Are file sizes displayed in default Finder list view windows? """ which = 'ssiz' want = 'bool' ! class shows_version(aetools.NProperty): """shows version - Are file versions displayed in default Finder list view windows? """ which = 'svrs' want = 'bool' ! class spatial_view_arrangement(aetools.NProperty): """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ which = 'iarr' want = 'earr' ! class spatial_view_icon_size(aetools.NProperty): """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ which = 'iisz' want = 'long' ! class spring_open_folders(aetools.NProperty): """spring open folders - Spring open folders after the specified delay? """ which = 'sprg' want = 'bool' ! class uses_relative_dates(aetools.NProperty): """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ which = 'urdt' want = 'bool' ! class uses_simple_menus(aetools.NProperty): """uses simple menus - Use simplified Finder menus? """ which = 'usme' want = 'bool' ! class uses_wide_grid(aetools.NProperty): """uses wide grid - Space icons on a wide grid? """ which = 'uswg' want = 'bool' ! class view_font(aetools.NProperty): """view font - the id of the font used in Finder views. """ which = 'vfnt' want = 'long' ! class view_font_size(aetools.NProperty): """view font size - the size of the font used in Finder views """ which = 'vfsz' want = 'long' ! class window(aetools.NProperty): """window - the window that would open if Finder preferences was opened """ which = 'cwin' --- 39,123 ---- """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ want = 'cprf' ! class _Prop_button_view_arrangement(aetools.NProperty): """button view arrangement - the method of arrangement of icons in default Finder button view windows """ which = 'barr' want = 'earr' ! class _Prop_button_view_icon_size(aetools.NProperty): """button view icon size - the size of icons displayed in Finder button view windows. """ which = 'bisz' want = 'long' ! class _Prop_calculates_folder_sizes(aetools.NProperty): """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ which = 'sfsz' want = 'bool' ! class _Prop_delay_before_springing(aetools.NProperty): """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ which = 'dela' want = 'shor' ! class _Prop_list_view_icon_size(aetools.NProperty): """list view icon size - the size of icons displayed in Finder list view windows. """ which = 'lisz' want = 'long' ! class _Prop_shows_comments(aetools.NProperty): """shows comments - Are comments displayed in default Finder list view windows? """ which = 'scom' want = 'bool' ! class _Prop_shows_creation_date(aetools.NProperty): """shows creation date - Are creation dates displayed in default Finder list view windows? """ which = 'scda' want = 'bool' ! class _Prop_shows_kind(aetools.NProperty): """shows kind - Are document kinds displayed in default Finder list view windows? """ which = 'sknd' want = 'bool' ! class _Prop_shows_label(aetools.NProperty): """shows label - Are labels displayed in default Finder list view windows? """ which = 'slbl' want = 'bool' ! class _Prop_shows_modification_date(aetools.NProperty): """shows modification date - Are modification dates displayed in default Finder list view windows? """ which = 'sdat' want = 'bool' ! class _Prop_shows_size(aetools.NProperty): """shows size - Are file sizes displayed in default Finder list view windows? """ which = 'ssiz' want = 'bool' ! class _Prop_shows_version(aetools.NProperty): """shows version - Are file versions displayed in default Finder list view windows? """ which = 'svrs' want = 'bool' ! class _Prop_spatial_view_arrangement(aetools.NProperty): """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ which = 'iarr' want = 'earr' ! class _Prop_spatial_view_icon_size(aetools.NProperty): """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ which = 'iisz' want = 'long' ! class _Prop_spring_open_folders(aetools.NProperty): """spring open folders - Spring open folders after the specified delay? """ which = 'sprg' want = 'bool' ! class _Prop_uses_relative_dates(aetools.NProperty): """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ which = 'urdt' want = 'bool' ! class _Prop_uses_simple_menus(aetools.NProperty): """uses simple menus - Use simplified Finder menus? """ which = 'usme' want = 'bool' ! class _Prop_uses_wide_grid(aetools.NProperty): """uses wide grid - Space icons on a wide grid? """ which = 'uswg' want = 'bool' ! class _Prop_view_font(aetools.NProperty): """view font - the id of the font used in Finder views. """ which = 'vfnt' want = 'long' ! class _Prop_view_font_size(aetools.NProperty): """view font size - the size of the font used in Finder views """ which = 'vfsz' want = 'long' ! class _Prop_window(aetools.NProperty): """window - the window that would open if Finder preferences was opened """ which = 'cwin' *************** *** 129,134 **** want = 'icop' ! arrangement = spatial_view_arrangement ! class icon_size(aetools.NProperty): """icon size - the size of icons displayed in the icon view """ which = 'lvis' --- 129,134 ---- want = 'icop' ! _Prop_arrangement = _Prop_spatial_view_arrangement ! class _Prop_icon_size(aetools.NProperty): """icon size - the size of icons displayed in the icon view """ which = 'lvis' *************** *** 138,176 **** """icon family - (NOT AVAILABLE YET) A family of icons """ want = 'ifam' ! class large_32_bit_icon(aetools.NProperty): """large 32 bit icon - the large 32-bit color icon """ which = 'il32' want = 'il32' ! class large_4_bit_icon(aetools.NProperty): """large 4 bit icon - the large 4-bit color icon """ which = 'icl4' want = 'icl4' ! class large_8_bit_icon(aetools.NProperty): """large 8 bit icon - the large 8-bit color icon """ which = 'icl8' want = 'icl8' ! class large_8_bit_mask(aetools.NProperty): """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ which = 'l8mk' want = 'l8mk' ! class large_monochrome_icon_and_mask(aetools.NProperty): """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ which = 'ICN#' want = 'ICN#' ! class small_32_bit_icon(aetools.NProperty): """small 32 bit icon - the small 32-bit color icon """ which = 'is32' want = 'is32' ! class small_4_bit_icon(aetools.NProperty): """small 4 bit icon - the small 4-bit color icon """ which = 'ics4' want = 'ics4' ! class small_8_bit_icon(aetools.NProperty): """small 8 bit icon - the small 8-bit color icon """ which = 'ics8' want = 'ics8' ! small_8_bit_mask = small_8_bit_icon ! class small_monochrome_icon_and_mask(aetools.NProperty): """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ which = 'ics#' --- 138,176 ---- """icon family - (NOT AVAILABLE YET) A family of icons """ want = 'ifam' ! class _Prop_large_32_bit_icon(aetools.NProperty): """large 32 bit icon - the large 32-bit color icon """ which = 'il32' want = 'il32' ! class _Prop_large_4_bit_icon(aetools.NProperty): """large 4 bit icon - the large 4-bit color icon """ which = 'icl4' want = 'icl4' ! class _Prop_large_8_bit_icon(aetools.NProperty): """large 8 bit icon - the large 8-bit color icon """ which = 'icl8' want = 'icl8' ! class _Prop_large_8_bit_mask(aetools.NProperty): """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ which = 'l8mk' want = 'l8mk' ! class _Prop_large_monochrome_icon_and_mask(aetools.NProperty): """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ which = 'ICN#' want = 'ICN#' ! class _Prop_small_32_bit_icon(aetools.NProperty): """small 32 bit icon - the small 32-bit color icon """ which = 'is32' want = 'is32' ! class _Prop_small_4_bit_icon(aetools.NProperty): """small 4 bit icon - the small 4-bit color icon """ which = 'ics4' want = 'ics4' ! class _Prop_small_8_bit_icon(aetools.NProperty): """small 8 bit icon - the small 8-bit color icon """ which = 'ics8' want = 'ics8' ! _Prop_small_8_bit_mask = _Prop_small_8_bit_icon ! class _Prop_small_monochrome_icon_and_mask(aetools.NProperty): """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ which = 'ics#' *************** *** 180,192 **** """column - a column of a list view """ want = 'lvcl' ! class sort_direction(aetools.NProperty): """sort direction - The direction in which the window is sorted """ which = 'sord' want = 'sodr' ! class visible(aetools.NProperty): """visible - is this column visible """ which = 'pvis' want = 'bool' ! class width(aetools.NProperty): """width - the width of this column """ which = 'clwd' --- 180,192 ---- """column - a column of a list view """ want = 'lvcl' ! class _Prop_sort_direction(aetools.NProperty): """sort direction - The direction in which the window is sorted """ which = 'sord' want = 'sodr' ! class _Prop_visible(aetools.NProperty): """visible - is this column visible """ which = 'pvis' want = 'bool' ! class _Prop_width(aetools.NProperty): """width - the width of this column """ which = 'clwd' *************** *** 198,202 **** """list view options - the list view options """ want = 'lvop' ! class sort_column(aetools.NProperty): """sort column - the column that the list view is sorted on """ which = 'srtc' --- 198,202 ---- """list view options - the list view options """ want = 'lvop' ! class _Prop_sort_column(aetools.NProperty): """sort column - the column that the list view is sorted on """ which = 'srtc' *************** *** 210,216 **** label._superclassnames = [] label._privpropdict = { ! 'color' : color, ! 'index' : index, ! 'name' : name, } label._privelemdict = { --- 210,216 ---- label._superclassnames = [] label._privpropdict = { ! 'color' : _Prop_color, ! 'index' : _Prop_index, ! 'name' : _Prop_name, } label._privelemdict = { *************** *** 218,242 **** preferences._superclassnames = [] preferences._privpropdict = { ! 'button_view_arrangement' : button_view_arrangement, ! 'button_view_icon_size' : button_view_icon_size, ! 'calculates_folder_sizes' : calculates_folder_sizes, ! 'delay_before_springing' : delay_before_springing, ! 'list_view_icon_size' : list_view_icon_size, ! 'shows_comments' : shows_comments, ! 'shows_creation_date' : shows_creation_date, ! 'shows_kind' : shows_kind, ! 'shows_label' : shows_label, ! 'shows_modification_date' : shows_modification_date, ! 'shows_size' : shows_size, ! 'shows_version' : shows_version, ! 'spatial_view_arrangement' : spatial_view_arrangement, ! 'spatial_view_icon_size' : spatial_view_icon_size, ! 'spring_open_folders' : spring_open_folders, ! 'uses_relative_dates' : uses_relative_dates, ! 'uses_simple_menus' : uses_simple_menus, ! 'uses_wide_grid' : uses_wide_grid, ! 'view_font' : view_font, ! 'view_font_size' : view_font_size, ! 'window' : window, } preferences._privelemdict = { --- 218,242 ---- preferences._superclassnames = [] preferences._privpropdict = { ! 'button_view_arrangement' : _Prop_button_view_arrangement, ! 'button_view_icon_size' : _Prop_button_view_icon_size, ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'delay_before_springing' : _Prop_delay_before_springing, ! 'list_view_icon_size' : _Prop_list_view_icon_size, ! 'shows_comments' : _Prop_shows_comments, ! 'shows_creation_date' : _Prop_shows_creation_date, ! 'shows_kind' : _Prop_shows_kind, ! 'shows_label' : _Prop_shows_label, ! 'shows_modification_date' : _Prop_shows_modification_date, ! 'shows_size' : _Prop_shows_size, ! 'shows_version' : _Prop_shows_version, ! 'spatial_view_arrangement' : _Prop_spatial_view_arrangement, ! 'spatial_view_icon_size' : _Prop_spatial_view_icon_size, ! 'spring_open_folders' : _Prop_spring_open_folders, ! 'uses_relative_dates' : _Prop_uses_relative_dates, ! 'uses_simple_menus' : _Prop_uses_simple_menus, ! 'uses_wide_grid' : _Prop_uses_wide_grid, ! 'view_font' : _Prop_view_font, ! 'view_font_size' : _Prop_view_font_size, ! 'window' : _Prop_window, } preferences._privelemdict = { *************** *** 245,250 **** icon_view_options._superclassnames = [] icon_view_options._privpropdict = { ! 'arrangement' : arrangement, ! 'icon_size' : icon_size, } icon_view_options._privelemdict = { --- 245,250 ---- icon_view_options._superclassnames = [] icon_view_options._privpropdict = { ! 'arrangement' : _Prop_arrangement, ! 'icon_size' : _Prop_icon_size, } icon_view_options._privelemdict = { *************** *** 252,265 **** icon_family._superclassnames = [] icon_family._privpropdict = { ! 'large_32_bit_icon' : large_32_bit_icon, ! 'large_4_bit_icon' : large_4_bit_icon, ! 'large_8_bit_icon' : large_8_bit_icon, ! 'large_8_bit_mask' : large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, ! 'small_32_bit_icon' : small_32_bit_icon, ! 'small_4_bit_icon' : small_4_bit_icon, ! 'small_8_bit_icon' : small_8_bit_icon, ! 'small_8_bit_mask' : small_8_bit_mask, ! 'small_monochrome_icon_and_mask' : small_monochrome_icon_and_mask, } icon_family._privelemdict = { --- 252,265 ---- icon_family._superclassnames = [] icon_family._privpropdict = { ! 'large_32_bit_icon' : _Prop_large_32_bit_icon, ! 'large_4_bit_icon' : _Prop_large_4_bit_icon, ! 'large_8_bit_icon' : _Prop_large_8_bit_icon, ! 'large_8_bit_mask' : _Prop_large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : _Prop_large_monochrome_icon_and_mask, ! 'small_32_bit_icon' : _Prop_small_32_bit_icon, ! 'small_4_bit_icon' : _Prop_small_4_bit_icon, ! 'small_8_bit_icon' : _Prop_small_8_bit_icon, ! 'small_8_bit_mask' : _Prop_small_8_bit_mask, ! 'small_monochrome_icon_and_mask' : _Prop_small_monochrome_icon_and_mask, } icon_family._privelemdict = { *************** *** 267,275 **** column._superclassnames = [] column._privpropdict = { ! 'index' : index, ! 'name' : name, ! 'sort_direction' : sort_direction, ! 'visible' : visible, ! 'width' : width, } column._privelemdict = { --- 267,275 ---- column._superclassnames = [] column._privpropdict = { ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'sort_direction' : _Prop_sort_direction, ! 'visible' : _Prop_visible, ! 'width' : _Prop_width, } column._privelemdict = { *************** *** 277,284 **** list_view_options._superclassnames = [] list_view_options._privpropdict = { ! 'calculates_folder_sizes' : calculates_folder_sizes, ! 'icon_size' : icon_size, ! 'sort_column' : sort_column, ! 'uses_relative_dates' : uses_relative_dates, } list_view_options._privelemdict = { --- 277,284 ---- list_view_options._superclassnames = [] list_view_options._privpropdict = { ! 'calculates_folder_sizes' : _Prop_calculates_folder_sizes, ! 'icon_size' : _Prop_icon_size, ! 'sort_column' : _Prop_sort_column, ! 'uses_relative_dates' : _Prop_uses_relative_dates, } list_view_options._privelemdict = { *************** *** 297,346 **** 'lvcl' : column, 'lvop' : list_view_options, - } - - _propdeclarations = { - 'ICN#' : large_monochrome_icon_and_mask, - 'barr' : button_view_arrangement, - 'bisz' : button_view_icon_size, - 'clwd' : width, - 'colr' : color, - 'cwin' : window, - 'dela' : delay_before_springing, - 'iarr' : spatial_view_arrangement, - 'icl4' : large_4_bit_icon, - 'icl8' : large_8_bit_icon, - 'ics#' : small_monochrome_icon_and_mask, - 'ics4' : small_4_bit_icon, - 'ics8' : small_8_bit_icon, - 'iisz' : spatial_view_icon_size, - 'il32' : large_32_bit_icon, - 'is32' : small_32_bit_icon, - 'l8mk' : large_8_bit_mask, - 'lisz' : list_view_icon_size, - 'lvis' : icon_size, - 'pidx' : index, - 'pnam' : name, - 'pvis' : visible, - 'scda' : shows_creation_date, - 'scom' : shows_comments, - 'sdat' : shows_modification_date, - 'sfsz' : calculates_folder_sizes, - 'sknd' : shows_kind, - 'slbl' : shows_label, - 'sord' : sort_direction, - 'sprg' : spring_open_folders, - 'srtc' : sort_column, - 'ssiz' : shows_size, - 'svrs' : shows_version, - 'urdt' : uses_relative_dates, - 'usme' : uses_simple_menus, - 'uswg' : uses_wide_grid, - 'vfnt' : view_font, - 'vfsz' : view_font_size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 297,299 ---- Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Window_classes.py 30 Mar 2003 22:41:48 -0000 1.6 --- Window_classes.py 1 Apr 2003 22:04:43 -0000 1.7 *************** *** 19,39 **** """Finder window - A file viewer window """ want = 'brow' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the window class """ which = 'c@#^' want = 'cwin' ! class current_view(aetools.NProperty): """current view - the current view for the container window """ which = 'pvew' want = 'ecvw' ! class icon_view_options(aetools.NProperty): """icon view options - the icon view options for the container window """ which = 'icop' want = 'icop' ! class list_view_options(aetools.NProperty): """list view options - the list view options for the container window """ which = 'lvop' want = 'lvop' ! class target(aetools.NProperty): """target - the container at which this file viewer is targeted """ which = 'fvtg' --- 19,39 ---- """Finder window - A file viewer window """ want = 'brow' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the window class """ which = 'c@#^' want = 'cwin' ! class _Prop_current_view(aetools.NProperty): """current view - the current view for the container window """ which = 'pvew' want = 'ecvw' ! class _Prop_icon_view_options(aetools.NProperty): """icon view options - the icon view options for the container window """ which = 'icop' want = 'icop' ! class _Prop_list_view_options(aetools.NProperty): """list view options - the list view options for the container window """ which = 'lvop' want = 'lvop' ! class _Prop_target(aetools.NProperty): """target - the container at which this file viewer is targeted """ which = 'fvtg' *************** *** 45,109 **** """window - A window """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class collapsed(aetools.NProperty): """collapsed - Is the window collapsed """ which = 'wshd' want = 'bool' ! class floating(aetools.NProperty): """floating - Does the window have a title bar? """ which = 'isfl' want = 'bool' ! class id(aetools.NProperty): """id - the unique id for this window """ which = 'ID ' want = 'magn' ! class index(aetools.NProperty): """index - the number of the window in the front-to-back layer ordering """ which = 'pidx' want = 'long' ! class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class name(aetools.NProperty): """name - the name of the window """ which = 'pnam' want = 'utxt' ! class position(aetools.NProperty): """position - the upper left position of the window """ which = 'posn' want = 'QDpt' ! class properties(aetools.NProperty): """properties - every property of a window """ which = 'pALL' want = 'reco' ! class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Is the window visible (always true for open Finder windows)? """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' want = 'bool' ! class zoomed_full_size(aetools.NProperty): """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ which = 'zumf' --- 45,109 ---- """window - A window """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class _Prop_collapsed(aetools.NProperty): """collapsed - Is the window collapsed """ which = 'wshd' want = 'bool' ! class _Prop_floating(aetools.NProperty): """floating - Does the window have a title bar? """ which = 'isfl' want = 'bool' ! class _Prop_id(aetools.NProperty): """id - the unique id for this window """ which = 'ID ' want = 'magn' ! class _Prop_index(aetools.NProperty): """index - the number of the window in the front-to-back layer ordering """ which = 'pidx' want = 'long' ! class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the window """ which = 'pnam' want = 'utxt' ! class _Prop_position(aetools.NProperty): """position - the upper left position of the window """ which = 'posn' want = 'QDpt' ! class _Prop_properties(aetools.NProperty): """properties - every property of a window """ which = 'pALL' want = 'reco' ! class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Is the window visible (always true for open Finder windows)? """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' want = 'bool' ! class _Prop_zoomed_full_size(aetools.NProperty): """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ which = 'zumf' *************** *** 115,123 **** """information window - An inspector window (opened by \xd2Show Info\xd3) """ want = 'iwnd' ! class current_panel(aetools.NProperty): """current panel - the current panel in the information window """ which = 'panl' want = 'ipnl' ! class item(aetools.NProperty): """item - the item from which this window was opened """ which = 'cobj' --- 115,123 ---- """information window - An inspector window (opened by \xd2Show Info\xd3) """ want = 'iwnd' ! class _Prop_current_panel(aetools.NProperty): """current panel - the current panel in the information window """ which = 'panl' want = 'ipnl' ! class _Prop_item(aetools.NProperty): """item - the item from which this window was opened """ which = 'cobj' *************** *** 135,143 **** Finder_window._superclassnames = ['window'] Finder_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'current_view' : current_view, ! 'icon_view_options' : icon_view_options, ! 'list_view_options' : list_view_options, ! 'target' : target, } Finder_window._privelemdict = { --- 135,143 ---- Finder_window._superclassnames = ['window'] Finder_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_view' : _Prop_current_view, ! 'icon_view_options' : _Prop_icon_view_options, ! 'list_view_options' : _Prop_list_view_options, ! 'target' : _Prop_target, } Finder_window._privelemdict = { *************** *** 145,164 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'collapsed' : collapsed, ! 'floating' : floating, ! 'id' : id, ! 'index' : index, ! 'modal' : modal, ! 'name' : name, ! 'position' : position, ! 'properties' : properties, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, ! 'zoomed_full_size' : zoomed_full_size, } window._privelemdict = { --- 145,164 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'collapsed' : _Prop_collapsed, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'properties' : _Prop_properties, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, ! 'zoomed_full_size' : _Prop_zoomed_full_size, } window._privelemdict = { *************** *** 166,172 **** information_window._superclassnames = ['window'] information_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'current_panel' : current_panel, ! 'item' : item, } information_window._privelemdict = { --- 166,172 ---- information_window._superclassnames = ['window'] information_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, ! 'item' : _Prop_item, } information_window._privelemdict = { *************** *** 174,178 **** clipping_window._superclassnames = ['window'] clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } clipping_window._privelemdict = { --- 174,178 ---- clipping_window._superclassnames = ['window'] clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } clipping_window._privelemdict = { *************** *** 180,185 **** preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'current_panel' : current_panel, } preferences_window._privelemdict = { --- 180,185 ---- preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'current_panel' : _Prop_current_panel, } preferences_window._privelemdict = { *************** *** 195,229 **** 'lwnd' : clipping_window, 'pwnd' : preferences_window, - } - - _propdeclarations = { - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'cobj' : item, - 'fvtg' : target, - 'hclb' : closeable, - 'icop' : icon_view_options, - 'isfl' : floating, - 'iszm' : zoomable, - 'lvop' : list_view_options, - 'pALL' : properties, - 'panl' : current_panel, - 'pbnd' : bounds, - 'pidx' : index, - 'pmod' : modal, - 'pnam' : name, - 'posn' : position, - 'prsz' : resizable, - 'ptit' : titled, - 'pvew' : current_view, - 'pvis' : visible, - 'pzum' : zoomed, - 'wshd' : collapsed, - 'zumf' : zoomed_full_size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 195,197 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 30 Mar 2003 22:41:48 -0000 1.6 --- __init__.py 1 Apr 2003 22:04:44 -0000 1.7 *************** *** 68,72 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(item) getbaseclasses(application) getbaseclasses(trash_2d_object) --- 68,71 ---- *************** *** 75,78 **** --- 74,78 ---- getbaseclasses(folder) getbaseclasses(disk) + getbaseclasses(item) getbaseclasses(package) getbaseclasses(file) *************** *** 87,90 **** --- 87,94 ---- getbaseclasses(clipping_window) getbaseclasses(information_window) + getbaseclasses(process) + getbaseclasses(application_process) + getbaseclasses(desk_accessory_process) + getbaseclasses(application) getbaseclasses(icon_view_options) getbaseclasses(label) *************** *** 94,101 **** getbaseclasses(icon_family) getbaseclasses(list_view_options) - getbaseclasses(process) - getbaseclasses(application_process) - getbaseclasses(desk_accessory_process) - getbaseclasses(application) getbaseclasses(StdSuites.Type_Names_Suite.double_integer) getbaseclasses(StdSuites.Type_Names_Suite.version) --- 98,101 ---- *************** *** 133,137 **** getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.null) --- 133,137 ---- getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.string) getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.null) *************** *** 143,147 **** # _classdeclarations = { - 'cobj' : item, 'capp' : application, 'ctrs' : trash_2d_object, --- 143,146 ---- *************** *** 150,153 **** --- 149,153 ---- 'cfol' : folder, 'cdis' : disk, + 'cobj' : item, 'pack' : package, 'file' : file, *************** *** 162,165 **** --- 162,169 ---- 'lwnd' : clipping_window, 'iwnd' : information_window, + 'prcs' : process, + 'pcap' : application_process, + 'pcda' : desk_accessory_process, + 'capp' : application, 'icop' : icon_view_options, 'clbl' : label, *************** *** 169,176 **** 'ifam' : icon_family, 'lvop' : list_view_options, - 'prcs' : process, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'capp' : application, 'comp' : StdSuites.Type_Names_Suite.double_integer, 'vers' : StdSuites.Type_Names_Suite.version, --- 173,176 ---- *************** *** 208,212 **** 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, 'sing' : StdSuites.Type_Names_Suite.small_real, 'null' : StdSuites.Type_Names_Suite.null, --- 208,212 ---- 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, 'sing' : StdSuites.Type_Names_Suite.small_real, 'null' : StdSuites.Type_Names_Suite.null, From jackjansen@users.sourceforge.net Tue Apr 1 22:05:37 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.5,1.6 Metrowerks_Shell_Suite.py,1.5,1.6 Required.py,1.2,1.3 Standard_Suite.py,1.4,1.5 __init__.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv20940/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CodeWarrior_suite.py 30 Mar 2003 22:41:47 -0000 1.5 --- CodeWarrior_suite.py 1 Apr 2003 22:04:25 -0000 1.6 *************** *** 248,252 **** """single class browser - a single class browser """ want = '1BRW' ! class inherits(aetools.NProperty): """inherits - all properties and elements of the given class are inherited by this class. """ which = 'c@#^' --- 248,252 ---- """single class browser - a single class browser """ want = '1BRW' ! class _Prop_inherits(aetools.NProperty): """inherits - all properties and elements of the given class are inherited by this class. """ which = 'c@#^' *************** *** 312,316 **** """project document - a project document """ want = 'PRJD' ! class current_target(aetools.NProperty): """current target - the current target """ which = 'CURT' --- 312,316 ---- """project document - a project document """ want = 'PRJD' ! class _Prop_current_target(aetools.NProperty): """current target - the current target """ which = 'CURT' *************** *** 323,331 **** """subtarget - a target that is prerequisite for another target """ want = 'SBTG' ! class link_against_output(aetools.NProperty): """link against output - is the output of this subtarget linked into its dependent target? """ which = 'LNKO' want = 'bool' ! class target(aetools.NProperty): """target - the target that is dependent on this subtarget """ which = 'TrgT' --- 323,331 ---- """subtarget - a target that is prerequisite for another target """ want = 'SBTG' ! class _Prop_link_against_output(aetools.NProperty): """link against output - is the output of this subtarget linked into its dependent target? """ which = 'LNKO' want = 'bool' ! class _Prop_target(aetools.NProperty): """target - the target that is dependent on this subtarget """ which = 'TrgT' *************** *** 337,401 **** """target file - a source or header file in a target """ want = 'SRCF' ! class code_size(aetools.NProperty): """code size - the size of the code (in bytes) produced by compiling this source file """ which = 'CSZE' want = 'long' ! class compiled_date(aetools.NProperty): """compiled date - the date and this source file was last compiled """ which = 'CMPD' want = 'ldt ' ! class data_size(aetools.NProperty): """data size - the size of the date (in bytes) produced by compiling this source file """ which = 'DSZE' want = 'long' ! class debug(aetools.NProperty): """debug - is debugging information generated for this source file? """ which = 'DBUG' want = 'bool' ! class dependents(aetools.NProperty): """dependents - the source files that need this source file in order to build """ which = 'DPND' want = 'list' ! class id(aetools.NProperty): """id - the unique ID number of the target file """ which = 'ID ' want = 'long' ! class init_before(aetools.NProperty): """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' ! class link_index(aetools.NProperty): """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' ! class linked(aetools.NProperty): """linked - is the source file in the link order of its target? """ which = 'LINK' want = 'bool' ! class location(aetools.NProperty): """location - the location of the target file on disk """ which = 'FILE' want = 'fss ' ! class merge_output(aetools.NProperty): """merge output - is this shared library merged into another code fragment? """ which = 'MRGE' want = 'bool' ! class modified_date(aetools.NProperty): """modified date - the date and time this source file was last modified """ which = 'MODD' want = 'ldt ' ! class path(aetools.NProperty): """path - the path of the source file on disk """ which = 'Path' want = 'itxt' ! class prerequisites(aetools.NProperty): """prerequisites - the source files needed to build this source file """ which = 'PRER' want = 'list' ! class type(aetools.NProperty): """type - the type of source file """ which = 'FTYP' want = 'FTYP' ! class weak_link(aetools.NProperty): """weak link - is this shared library linked weakly? """ which = 'WEAK' --- 337,401 ---- """target file - a source or header file in a target """ want = 'SRCF' ! class _Prop_code_size(aetools.NProperty): """code size - the size of the code (in bytes) produced by compiling this source file """ which = 'CSZE' want = 'long' ! class _Prop_compiled_date(aetools.NProperty): """compiled date - the date and this source file was last compiled """ which = 'CMPD' want = 'ldt ' ! class _Prop_data_size(aetools.NProperty): """data size - the size of the date (in bytes) produced by compiling this source file """ which = 'DSZE' want = 'long' ! class _Prop_debug(aetools.NProperty): """debug - is debugging information generated for this source file? """ which = 'DBUG' want = 'bool' ! class _Prop_dependents(aetools.NProperty): """dependents - the source files that need this source file in order to build """ which = 'DPND' want = 'list' ! class _Prop_id(aetools.NProperty): """id - the unique ID number of the target file """ which = 'ID ' want = 'long' ! class _Prop_init_before(aetools.NProperty): """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' ! class _Prop_link_index(aetools.NProperty): """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' ! class _Prop_linked(aetools.NProperty): """linked - is the source file in the link order of its target? """ which = 'LINK' want = 'bool' ! class _Prop_location(aetools.NProperty): """location - the location of the target file on disk """ which = 'FILE' want = 'fss ' ! class _Prop_merge_output(aetools.NProperty): """merge output - is this shared library merged into another code fragment? """ which = 'MRGE' want = 'bool' ! class _Prop_modified_date(aetools.NProperty): """modified date - the date and time this source file was last modified """ which = 'MODD' want = 'ldt ' ! class _Prop_path(aetools.NProperty): """path - the path of the source file on disk """ which = 'Path' want = 'itxt' ! class _Prop_prerequisites(aetools.NProperty): """prerequisites - the source files needed to build this source file """ which = 'PRER' want = 'list' ! class _Prop_type(aetools.NProperty): """type - the type of source file """ which = 'FTYP' want = 'FTYP' ! class _Prop_weak_link(aetools.NProperty): """weak link - is this shared library linked weakly? """ which = 'WEAK' *************** *** 419,427 **** """target - a target in a project """ want = 'TRGT' ! class name(aetools.NProperty): """name - """ which = 'pnam' want = 'itxt' ! class project_document(aetools.NProperty): """project document - the project document that contains this target """ which = 'PrjD' --- 419,427 ---- """target - a target in a project """ want = 'TRGT' ! class _Prop_name(aetools.NProperty): """name - """ which = 'pnam' want = 'itxt' ! class _Prop_project_document(aetools.NProperty): """project document - the project document that contains this target """ which = 'PrjD' *************** *** 435,443 **** """text document - a document that contains text """ want = 'TXTD' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class selection(aetools.NProperty): """selection - the selection visible to the user """ which = 'sele' --- 435,443 ---- """text document - a document that contains text """ want = 'TXTD' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class _Prop_selection(aetools.NProperty): """selection - the selection visible to the user """ which = 'sele' *************** *** 451,455 **** single_class_browser._superclassnames = ['text_document'] single_class_browser._privpropdict = { ! 'inherits' : inherits, } single_class_browser._privelemdict = { --- 451,455 ---- single_class_browser._superclassnames = ['text_document'] single_class_browser._privpropdict = { ! 'inherits' : _Prop_inherits, } single_class_browser._privelemdict = { *************** *** 458,462 **** single_class_hierarchy._superclassnames = ['document'] single_class_hierarchy._privpropdict = { ! 'inherits' : inherits, } single_class_hierarchy._privelemdict = { --- 458,462 ---- single_class_hierarchy._superclassnames = ['document'] single_class_hierarchy._privpropdict = { ! 'inherits' : _Prop_inherits, } single_class_hierarchy._privelemdict = { *************** *** 464,468 **** class_browser._superclassnames = ['text_document'] class_browser._privpropdict = { ! 'inherits' : inherits, } class_browser._privelemdict = { --- 464,468 ---- class_browser._superclassnames = ['text_document'] class_browser._privpropdict = { ! 'inherits' : _Prop_inherits, } class_browser._privelemdict = { *************** *** 470,474 **** file_compare_document._superclassnames = ['text_document'] file_compare_document._privpropdict = { ! 'inherits' : inherits, } file_compare_document._privelemdict = { --- 470,474 ---- file_compare_document._superclassnames = ['text_document'] file_compare_document._privpropdict = { ! 'inherits' : _Prop_inherits, } file_compare_document._privelemdict = { *************** *** 476,480 **** catalog_document._superclassnames = ['text_document'] catalog_document._privpropdict = { ! 'inherits' : inherits, } catalog_document._privelemdict = { --- 476,480 ---- catalog_document._superclassnames = ['text_document'] catalog_document._privpropdict = { ! 'inherits' : _Prop_inherits, } catalog_document._privelemdict = { *************** *** 482,486 **** editor_document._superclassnames = ['text_document'] editor_document._privpropdict = { ! 'inherits' : inherits, } editor_document._privelemdict = { --- 482,486 ---- editor_document._superclassnames = ['text_document'] editor_document._privpropdict = { ! 'inherits' : _Prop_inherits, } editor_document._privelemdict = { *************** *** 488,492 **** class_hierarchy._superclassnames = ['document'] class_hierarchy._privpropdict = { ! 'inherits' : inherits, } class_hierarchy._privelemdict = { --- 488,492 ---- class_hierarchy._superclassnames = ['document'] class_hierarchy._privpropdict = { ! 'inherits' : _Prop_inherits, } class_hierarchy._privelemdict = { *************** *** 494,498 **** project_inspector._superclassnames = ['document'] project_inspector._privpropdict = { ! 'inherits' : inherits, } project_inspector._privelemdict = { --- 494,498 ---- project_inspector._superclassnames = ['document'] project_inspector._privpropdict = { ! 'inherits' : _Prop_inherits, } project_inspector._privelemdict = { *************** *** 500,504 **** message_document._superclassnames = ['text_document'] message_document._privpropdict = { ! 'inherits' : inherits, } message_document._privelemdict = { --- 500,504 ---- message_document._superclassnames = ['text_document'] message_document._privpropdict = { ! 'inherits' : _Prop_inherits, } message_document._privelemdict = { *************** *** 506,510 **** build_progress_document._superclassnames = ['document'] build_progress_document._privpropdict = { ! 'inherits' : inherits, } build_progress_document._privelemdict = { --- 506,510 ---- build_progress_document._superclassnames = ['document'] build_progress_document._privpropdict = { ! 'inherits' : _Prop_inherits, } build_progress_document._privelemdict = { *************** *** 512,517 **** project_document._superclassnames = ['document'] project_document._privpropdict = { ! 'current_target' : current_target, ! 'inherits' : inherits, } project_document._privelemdict = { --- 512,517 ---- project_document._superclassnames = ['document'] project_document._privpropdict = { ! 'current_target' : _Prop_current_target, ! 'inherits' : _Prop_inherits, } project_document._privelemdict = { *************** *** 520,526 **** subtarget._superclassnames = ['target'] subtarget._privpropdict = { ! 'inherits' : inherits, ! 'link_against_output' : link_against_output, ! 'target' : target, } subtarget._privelemdict = { --- 520,526 ---- subtarget._superclassnames = ['target'] subtarget._privpropdict = { ! 'inherits' : _Prop_inherits, ! 'link_against_output' : _Prop_link_against_output, ! 'target' : _Prop_target, } subtarget._privelemdict = { *************** *** 528,547 **** target_file._superclassnames = [] target_file._privpropdict = { ! 'code_size' : code_size, ! 'compiled_date' : compiled_date, ! 'data_size' : data_size, ! 'debug' : debug, ! 'dependents' : dependents, ! 'id' : id, ! 'init_before' : init_before, ! 'link_index' : link_index, ! 'linked' : linked, ! 'location' : location, ! 'merge_output' : merge_output, ! 'modified_date' : modified_date, ! 'path' : path, ! 'prerequisites' : prerequisites, ! 'type' : type, ! 'weak_link' : weak_link, } target_file._privelemdict = { --- 528,547 ---- target_file._superclassnames = [] target_file._privpropdict = { ! 'code_size' : _Prop_code_size, ! 'compiled_date' : _Prop_compiled_date, ! 'data_size' : _Prop_data_size, ! 'debug' : _Prop_debug, ! 'dependents' : _Prop_dependents, ! 'id' : _Prop_id, ! 'init_before' : _Prop_init_before, ! 'link_index' : _Prop_link_index, ! 'linked' : _Prop_linked, ! 'location' : _Prop_location, ! 'merge_output' : _Prop_merge_output, ! 'modified_date' : _Prop_modified_date, ! 'path' : _Prop_path, ! 'prerequisites' : _Prop_prerequisites, ! 'type' : _Prop_type, ! 'weak_link' : _Prop_weak_link, } target_file._privelemdict = { *************** *** 549,553 **** symbol_browser._superclassnames = ['text_document'] symbol_browser._privpropdict = { ! 'inherits' : inherits, } symbol_browser._privelemdict = { --- 549,553 ---- symbol_browser._superclassnames = ['text_document'] symbol_browser._privpropdict = { ! 'inherits' : _Prop_inherits, } symbol_browser._privelemdict = { *************** *** 555,559 **** ToolServer_worksheet._superclassnames = ['text_document'] ToolServer_worksheet._privpropdict = { ! 'inherits' : inherits, } ToolServer_worksheet._privelemdict = { --- 555,559 ---- ToolServer_worksheet._superclassnames = ['text_document'] ToolServer_worksheet._privpropdict = { ! 'inherits' : _Prop_inherits, } ToolServer_worksheet._privelemdict = { *************** *** 561,566 **** target._superclassnames = [] target._privpropdict = { ! 'name' : name, ! 'project_document' : project_document, } target._privelemdict = { --- 561,566 ---- target._superclassnames = [] target._privpropdict = { ! 'name' : _Prop_name, ! 'project_document' : _Prop_project_document, } target._privelemdict = { *************** *** 570,576 **** text_document._superclassnames = ['document'] text_document._privpropdict = { ! 'inherits' : inherits, ! 'modified' : modified, ! 'selection' : selection, } text_document._privelemdict = { --- 570,576 ---- text_document._superclassnames = ['document'] text_document._privpropdict = { ! 'inherits' : _Prop_inherits, ! 'modified' : _Prop_modified, ! 'selection' : _Prop_selection, } text_document._privelemdict = { *************** *** 643,682 **** 'TRGT' : target, 'TXTD' : text_document, - } - - _propdeclarations = { - 'CMPD' : compiled_date, - 'CSZE' : code_size, - 'CURT' : current_target, - 'DBUG' : debug, - 'DPND' : dependents, - 'DSZE' : data_size, - 'FILE' : location, - 'FTYP' : type, - 'ID ' : id, - 'INIT' : init_before, - 'LIDX' : link_index, - 'LINK' : linked, - 'LNKO' : link_against_output, - 'MODD' : modified_date, - 'MRGE' : merge_output, - 'PRER' : prerequisites, - 'Path' : path, - 'PrjD' : project_document, - 'TrgT' : target, - 'WEAK' : weak_link, - 'c@#^' : inherits, - 'imod' : modified, - 'pnam' : name, - 'sele' : selection, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'DKND' : _Enum_DKND, - 'FTYP' : _Enum_FTYP, - 'Inte' : _Enum_Inte, - 'PERM' : _Enum_PERM, } --- 643,645 ---- Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Metrowerks_Shell_Suite.py 30 Mar 2003 22:41:47 -0000 1.5 --- Metrowerks_Shell_Suite.py 1 Apr 2003 22:04:26 -0000 1.6 *************** *** 794,834 **** """Browser Coloring - Colors for Browser symbols. """ want = 'BRKW' ! class Browser_Keywords(aetools.NProperty): """Browser Keywords - Mark Browser symbols with color. """ which = 'BW00' want = 'bool' ! class Classes_Color(aetools.NProperty): """Classes Color - The color for classes. """ which = 'BW01' want = 'cRGB' [...2507 lines suppressed...] - - _enumdeclarations = { - 'Acce' : _Enum_Acce, - 'BXbr' : _Enum_BXbr, - 'DbSA' : _Enum_DbSA, - 'DgBL' : _Enum_DgBL, - 'ErrT' : _Enum_ErrT, - 'Inte' : _Enum_Inte, - 'Lang' : _Enum_Lang, - 'PPrm' : _Enum_PPrm, - 'PXdg' : _Enum_PXdg, - 'PthF' : _Enum_PthF, - 'RefP' : _Enum_RefP, - 'STKd' : _Enum_STKd, - 'SrcT' : _Enum_SrcT, - 'TmpB' : _Enum_TmpB, - 'TxtF' : _Enum_TxtF, - 'savo' : _Enum_savo, } --- 2173,2175 ---- Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required.py 23 Mar 2003 22:07:27 -0000 1.2 --- Required.py 1 Apr 2003 22:04:27 -0000 1.3 *************** *** 51,62 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'Conv' : _Enum_Conv, - } --- 51,52 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 30 Mar 2003 22:41:47 -0000 1.4 --- Standard_Suite.py 1 Apr 2003 22:04:28 -0000 1.5 *************** *** 176,180 **** """application - an application program """ want = 'capp' ! class user_interaction(aetools.NProperty): """user interaction - user interaction level """ which = 'inte' --- 176,180 ---- """application - an application program """ want = 'capp' ! class _Prop_user_interaction(aetools.NProperty): """user interaction - user interaction level """ which = 'inte' *************** *** 186,194 **** """character - a character """ want = 'cha ' ! class length(aetools.NProperty): """length - length in characters of this object """ which = 'pLen' want = 'long' ! class offset(aetools.NProperty): """offset - offset of a text object from the beginning of the document (first char has offset 1) """ which = 'pOff' --- 186,194 ---- """character - a character """ want = 'cha ' ! class _Prop_length(aetools.NProperty): """length - length in characters of this object """ which = 'pLen' want = 'long' ! class _Prop_offset(aetools.NProperty): """offset - offset of a text object from the beginning of the document (first char has offset 1) """ which = 'pOff' *************** *** 202,206 **** """line - lines of text """ want = 'clin' ! class index(aetools.NProperty): """index - index of a line object from the beginning of the document (first line has index 1) """ which = 'pidx' --- 202,206 ---- """line - lines of text """ want = 'clin' ! class _Prop_index(aetools.NProperty): """index - index of a line object from the beginning of the document (first line has index 1) """ which = 'pidx' *************** *** 213,217 **** """selection-object - the selection visible to the user """ want = 'csel' ! class contents(aetools.NProperty): """contents - the contents of the selection """ which = 'pcnt' --- 213,217 ---- """selection-object - the selection visible to the user """ want = 'csel' ! class _Prop_contents(aetools.NProperty): """contents - the contents of the selection """ which = 'pcnt' *************** *** 232,256 **** """window - A window """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class document(aetools.NProperty): """document - the document that owns this window """ which = 'docu' want = 'docu' ! class name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' --- 232,256 ---- """window - A window """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_document(aetools.NProperty): """document - the document that owns this window """ which = 'docu' want = 'docu' ! class _Prop_name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' ! class _Prop_position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class _Prop_visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' *************** *** 262,278 **** """document - a document """ want = 'docu' ! class file_permissions(aetools.NProperty): """file permissions - the file permissions for the document """ which = 'PERM' want = 'PERM' ! class kind(aetools.NProperty): """kind - the kind of document """ which = 'DKND' want = 'DKND' ! class location(aetools.NProperty): """location - the file of the document """ which = 'FILE' want = 'fss ' ! class window(aetools.NProperty): """window - the window of the document. """ which = 'cwin' --- 262,278 ---- """document - a document """ want = 'docu' ! class _Prop_file_permissions(aetools.NProperty): """file permissions - the file permissions for the document """ which = 'PERM' want = 'PERM' ! class _Prop_kind(aetools.NProperty): """kind - the kind of document """ which = 'DKND' want = 'DKND' ! class _Prop_location(aetools.NProperty): """location - the file of the document """ which = 'FILE' want = 'fss ' ! class _Prop_window(aetools.NProperty): """window - the window of the document. """ which = 'cwin' *************** *** 288,292 **** application._superclassnames = [] application._privpropdict = { ! 'user_interaction' : user_interaction, } application._privelemdict = { --- 288,292 ---- application._superclassnames = [] application._privpropdict = { ! 'user_interaction' : _Prop_user_interaction, } application._privelemdict = { *************** *** 296,301 **** character._superclassnames = [] character._privpropdict = { ! 'length' : length, ! 'offset' : offset, } character._privelemdict = { --- 296,301 ---- character._superclassnames = [] character._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } character._privelemdict = { *************** *** 303,308 **** insertion_point._superclassnames = [] insertion_point._privpropdict = { ! 'length' : length, ! 'offset' : offset, } insertion_point._privelemdict = { --- 303,308 ---- insertion_point._superclassnames = [] insertion_point._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } insertion_point._privelemdict = { *************** *** 310,316 **** line._superclassnames = [] line._privpropdict = { ! 'index' : index, ! 'length' : length, ! 'offset' : offset, } line._privelemdict = { --- 310,316 ---- line._superclassnames = [] line._privpropdict = { ! 'index' : _Prop_index, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } line._privelemdict = { *************** *** 319,325 **** selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : contents, ! 'length' : length, ! 'offset' : offset, } selection_2d_object._privelemdict = { --- 319,325 ---- selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : _Prop_contents, ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } selection_2d_object._privelemdict = { *************** *** 330,335 **** text._superclassnames = [] text._privpropdict = { ! 'length' : length, ! 'offset' : offset, } text._privelemdict = { --- 330,335 ---- text._superclassnames = [] text._privpropdict = { ! 'length' : _Prop_length, ! 'offset' : _Prop_offset, } text._privelemdict = { *************** *** 341,351 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : bounds, ! 'document' : document, ! 'index' : index, ! 'name' : name, ! 'position' : position, ! 'visible' : visible, ! 'zoomed' : zoomed, } window._privelemdict = { --- 341,351 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'document' : _Prop_document, ! 'index' : _Prop_index, ! 'name' : _Prop_name, ! 'position' : _Prop_position, ! 'visible' : _Prop_visible, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 353,362 **** document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : file_permissions, ! 'index' : index, ! 'kind' : kind, ! 'location' : location, ! 'name' : name, ! 'window' : window, } document._privelemdict = { --- 353,362 ---- document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : _Prop_file_permissions, ! 'index' : _Prop_index, ! 'kind' : _Prop_kind, ! 'location' : _Prop_location, ! 'name' : _Prop_name, ! 'window' : _Prop_window, } document._privelemdict = { *************** *** 381,407 **** 'docu' : document, 'file' : files, - } - - _propdeclarations = { - 'DKND' : kind, - 'FILE' : location, - 'PERM' : file_permissions, - 'cwin' : window, - 'docu' : document, - 'inte' : user_interaction, - 'pLen' : length, - 'pOff' : offset, - 'pbnd' : bounds, - 'pcnt' : contents, - 'pidx' : index, - 'pnam' : name, - 'ppos' : position, - 'pvis' : visible, - 'pzum' : zoomed, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 381,383 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 30 Mar 2003 22:41:47 -0000 1.6 --- __init__.py 1 Apr 2003 22:04:29 -0000 1.7 *************** *** 48,51 **** --- 48,60 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) getbaseclasses(single_class_browser) getbaseclasses(project_document) *************** *** 101,113 **** getbaseclasses(Debugger_Display) getbaseclasses(class_) - getbaseclasses(character) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) # --- 110,113 ---- *************** *** 115,118 **** --- 115,127 ---- # _classdeclarations = { + 'cha ' : character, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'clin' : line, + 'csel' : selection_2d_object, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, '1BRW' : single_class_browser, 'PRJD' : project_document, *************** *** 168,180 **** 'DbDS' : Debugger_Display, 'Clas' : class_, - 'cha ' : character, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'clin' : line, - 'csel' : selection_2d_object, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, } --- 177,180 ---- From jackjansen@users.sourceforge.net Tue Apr 1 22:05:40 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:40 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.5,1.6 Macintosh_Connectivity_Clas.py,1.5,1.6 QuickDraw_Graphics_Suite.py,1.5,1.6 QuickDraw_Graphics_Suppleme.py,1.4,1.5 Required_Suite.py,1.2,1.3 Standard_Suite.py,1.5,1.6 Table_Suite.py,1.4,1.5 Text_Suite.py,1.4,1.5 Type_Names_Suite.py,1.5,1.6 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv20940/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Required_Suite.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AppleScript_Suite.py 30 Mar 2003 22:41:49 -0000 1.5 --- AppleScript_Suite.py 1 Apr 2003 22:04:49 -0000 1.6 *************** *** 792,844 **** """application - specifies global properties of AppleScript """ want = 'capp' ! class AppleScript(aetools.NProperty): """AppleScript - the top-level script object """ which = 'ascr' want = 'scpt' ! class days(aetools.NProperty): """days - the number of seconds in a day """ which = 'days' want = 'long' ! class hours(aetools.NProperty): """hours - the number of seconds in an hour """ which = 'hour' want = 'long' ! class minutes(aetools.NProperty): """minutes - the number of seconds in a minute """ which = 'min ' want = 'long' ! class pi(aetools.NProperty): """pi - the constant pi """ which = 'pi ' want = 'doub' ! class print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' ! class print_length(aetools.NProperty): """print length - the maximum length to print """ which = 'prln' want = 'long' ! class result(aetools.NProperty): """result - the last result of evaluation """ which = 'rslt' want = '****' ! class return_(aetools.NProperty): """return - a return character """ which = 'ret ' want = 'cha ' ! class space(aetools.NProperty): """space - a space character """ which = 'spac' want = 'cha ' ! class tab(aetools.NProperty): """tab - a tab character """ which = 'tab ' want = 'cha ' ! class text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' ! class weeks(aetools.NProperty): """weeks - the number of seconds in a week """ which = 'week' --- 792,844 ---- """application - specifies global properties of AppleScript """ want = 'capp' ! class _Prop_AppleScript(aetools.NProperty): """AppleScript - the top-level script object """ which = 'ascr' want = 'scpt' ! class _Prop_days(aetools.NProperty): """days - the number of seconds in a day """ which = 'days' want = 'long' ! class _Prop_hours(aetools.NProperty): """hours - the number of seconds in an hour """ which = 'hour' want = 'long' ! class _Prop_minutes(aetools.NProperty): """minutes - the number of seconds in a minute """ which = 'min ' want = 'long' ! class _Prop_pi(aetools.NProperty): """pi - the constant pi """ which = 'pi ' want = 'doub' ! class _Prop_print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' ! class _Prop_print_length(aetools.NProperty): """print length - the maximum length to print """ which = 'prln' want = 'long' ! class _Prop_result(aetools.NProperty): """result - the last result of evaluation """ which = 'rslt' want = '****' ! class _Prop_return_(aetools.NProperty): """return - a return character """ which = 'ret ' want = 'cha ' ! class _Prop_space(aetools.NProperty): """space - a space character """ which = 'spac' want = 'cha ' ! class _Prop_tab(aetools.NProperty): """tab - a tab character """ which = 'tab ' want = 'cha ' ! class _Prop_text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' ! class _Prop_weeks(aetools.NProperty): """weeks - the number of seconds in a week """ which = 'week' *************** *** 872,880 **** """writing code info - script code and language code of text run """ want = 'citl' ! class language_code(aetools.NProperty): """language code - the language code for the text """ which = 'plcd' want = 'shor' ! class script_code(aetools.NProperty): """script code - the script code for the text """ which = 'pscd' --- 872,880 ---- """writing code info - script code and language code of text run """ want = 'citl' ! class _Prop_language_code(aetools.NProperty): """language code - the language code for the text """ which = 'plcd' want = 'shor' ! class _Prop_script_code(aetools.NProperty): """script code - the script code for the text """ which = 'pscd' *************** *** 904,908 **** """item - An item of any type """ want = 'cobj' ! class id(aetools.NProperty): """id - the unique ID number of this object """ which = 'ID ' --- 904,908 ---- """item - An item of any type """ want = 'cobj' ! class _Prop_id(aetools.NProperty): """id - the unique ID number of this object """ which = 'ID ' *************** *** 1042,1054 **** """keystroke - a press of a key combination on a Macintosh keyboard """ want = 'kprs' ! class key(aetools.NProperty): """key - the character for the key was pressed (ignoring modifiers) """ which = 'kMsg' want = 'cha ' ! class key_kind(aetools.NProperty): """key kind - the kind of key that was pressed """ which = 'kknd' want = 'ekst' ! class modifiers(aetools.NProperty): """modifiers - the modifier keys pressed in combination """ which = 'kMod' --- 1042,1054 ---- """keystroke - a press of a key combination on a Macintosh keyboard """ want = 'kprs' ! class _Prop_key(aetools.NProperty): """key - the character for the key was pressed (ignoring modifiers) """ which = 'kMsg' want = 'cha ' ! class _Prop_key_kind(aetools.NProperty): """key kind - the kind of key that was pressed """ which = 'kknd' want = 'ekst' ! class _Prop_modifiers(aetools.NProperty): """modifiers - the modifier keys pressed in combination """ which = 'kMod' *************** *** 1064,1092 **** """date - Absolute date and time values """ want = 'ldt ' ! class date_string(aetools.NProperty): """date string - the date portion of a date-time value as text """ which = 'dstr' want = 'TEXT' ! class day(aetools.NProperty): """day - the day of the month of a date """ which = 'day ' want = 'long' ! class month(aetools.NProperty): """month - the month of a date """ which = 'mnth' want = 'mnth' ! class time(aetools.NProperty): """time - the time since midnight of a date """ which = 'time' want = 'long' ! class time_string(aetools.NProperty): """time string - the time portion of a date-time value as text """ which = 'tstr' want = 'TEXT' ! class weekday(aetools.NProperty): """weekday - the day of a week of a date """ which = 'wkdy' want = 'wkdy' ! class year(aetools.NProperty): """year - the year of a date """ which = 'year' --- 1064,1092 ---- """date - Absolute date and time values """ want = 'ldt ' ! class _Prop_date_string(aetools.NProperty): """date string - the date portion of a date-time value as text """ which = 'dstr' want = 'TEXT' ! class _Prop_day(aetools.NProperty): """day - the day of the month of a date """ which = 'day ' want = 'long' ! class _Prop_month(aetools.NProperty): """month - the month of a date """ which = 'mnth' want = 'mnth' ! class _Prop_time(aetools.NProperty): """time - the time since midnight of a date """ which = 'time' want = 'long' ! class _Prop_time_string(aetools.NProperty): """time string - the time portion of a date-time value as text """ which = 'tstr' want = 'TEXT' ! class _Prop_weekday(aetools.NProperty): """weekday - the day of a week of a date """ which = 'wkdy' want = 'wkdy' ! class _Prop_year(aetools.NProperty): """year - the year of a date """ which = 'year' *************** *** 1098,1110 **** """list - An ordered collection of items """ want = 'list' ! class length(aetools.NProperty): """length - the length of a list """ which = 'leng' want = 'long' ! class rest(aetools.NProperty): """rest - all items of the list excluding first """ which = 'rest' want = 'list' ! class reverse(aetools.NProperty): """reverse - the items of the list in reverse order """ which = 'rvse' --- 1098,1110 ---- """list - An ordered collection of items """ want = 'list' ! class _Prop_length(aetools.NProperty): """length - the length of a list """ which = 'leng' want = 'long' ! class _Prop_rest(aetools.NProperty): """rest - all items of the list excluding first """ which = 'rest' want = 'list' ! class _Prop_reverse(aetools.NProperty): """reverse - the items of the list in reverse order """ which = 'rvse' *************** *** 1222,1226 **** """class - the type of a value """ want = 'pcls' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' --- 1222,1226 ---- """class - the type of a value """ want = 'pcls' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' *************** *** 1276,1284 **** """script - An AppleScript script """ want = 'scpt' ! class name(aetools.NProperty): """name - the name of the script """ which = 'pnam' want = 'TEXT' ! class parent(aetools.NProperty): """parent - its parent, i.e. the script that will handle events that this script doesn\xd5t """ which = 'pare' --- 1276,1284 ---- """script - An AppleScript script """ want = 'scpt' ! class _Prop_name(aetools.NProperty): """name - the name of the script """ which = 'pnam' want = 'TEXT' ! class _Prop_parent(aetools.NProperty): """parent - its parent, i.e. the script that will handle events that this script doesn\xd5t """ which = 'pare' *************** *** 1444,1460 **** application._superclassnames = [] application._privpropdict = { ! 'AppleScript' : AppleScript, ! 'days' : days, ! 'hours' : hours, ! 'minutes' : minutes, ! 'pi' : pi, ! 'print_depth' : print_depth, ! 'print_length' : print_length, ! 'result' : result, ! 'return_' : return_, ! 'space' : space, ! 'tab' : tab, ! 'text_item_delimiters' : text_item_delimiters, ! 'weeks' : weeks, } application._privelemdict = { --- 1444,1460 ---- application._superclassnames = [] application._privpropdict = { ! 'AppleScript' : _Prop_AppleScript, ! 'days' : _Prop_days, ! 'hours' : _Prop_hours, ! 'minutes' : _Prop_minutes, ! 'pi' : _Prop_pi, ! 'print_depth' : _Prop_print_depth, ! 'print_length' : _Prop_print_length, ! 'result' : _Prop_result, ! 'return_' : _Prop_return_, ! 'space' : _Prop_space, ! 'tab' : _Prop_tab, ! 'text_item_delimiters' : _Prop_text_item_delimiters, ! 'weeks' : _Prop_weeks, } application._privelemdict = { *************** *** 1482,1487 **** writing_code_info._superclassnames = [] writing_code_info._privpropdict = { ! 'language_code' : language_code, ! 'script_code' : script_code, } writing_code_info._privelemdict = { --- 1482,1487 ---- writing_code_info._superclassnames = [] writing_code_info._privpropdict = { ! 'language_code' : _Prop_language_code, ! 'script_code' : _Prop_script_code, } writing_code_info._privelemdict = { *************** *** 1504,1508 **** item._superclassnames = [] item._privpropdict = { ! 'id' : id, } item._privelemdict = { --- 1504,1508 ---- item._superclassnames = [] item._privpropdict = { ! 'id' : _Prop_id, } item._privelemdict = { *************** *** 1650,1656 **** keystroke._superclassnames = [] keystroke._privpropdict = { ! 'key' : key, ! 'key_kind' : key_kind, ! 'modifiers' : modifiers, } keystroke._privelemdict = { --- 1650,1656 ---- keystroke._superclassnames = [] keystroke._privpropdict = { ! 'key' : _Prop_key, ! 'key_kind' : _Prop_key_kind, ! 'modifiers' : _Prop_modifiers, } keystroke._privelemdict = { *************** *** 1663,1673 **** date._superclassnames = [] date._privpropdict = { ! 'date_string' : date_string, ! 'day' : day, ! 'month' : month, ! 'time' : time, ! 'time_string' : time_string, ! 'weekday' : weekday, ! 'year' : year, } date._privelemdict = { --- 1663,1673 ---- date._superclassnames = [] date._privpropdict = { ! 'date_string' : _Prop_date_string, ! 'day' : _Prop_day, ! 'month' : _Prop_month, ! 'time' : _Prop_time, ! 'time_string' : _Prop_time_string, ! 'weekday' : _Prop_weekday, ! 'year' : _Prop_year, } date._privelemdict = { *************** *** 1675,1681 **** list._superclassnames = [] list._privpropdict = { ! 'length' : length, ! 'rest' : rest, ! 'reverse' : reverse, } list._privelemdict = { --- 1675,1681 ---- list._superclassnames = [] list._privpropdict = { ! 'length' : _Prop_length, ! 'rest' : _Prop_rest, ! 'reverse' : _Prop_reverse, } list._privelemdict = { *************** *** 1688,1692 **** linked_list._superclassnames = [] linked_list._privpropdict = { ! 'length' : length, } linked_list._privelemdict = { --- 1688,1692 ---- linked_list._superclassnames = [] linked_list._privpropdict = { ! 'length' : _Prop_length, } linked_list._privelemdict = { *************** *** 1794,1798 **** class_._superclassnames = ['type_class'] class_._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } class_._privelemdict = { --- 1794,1798 ---- class_._superclassnames = ['type_class'] class_._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } class_._privelemdict = { *************** *** 1845,1850 **** script._superclassnames = [] script._privpropdict = { ! 'name' : name, ! 'parent' : parent, } script._privelemdict = { --- 1845,1850 ---- script._superclassnames = [] script._privpropdict = { ! 'name' : _Prop_name, ! 'parent' : _Prop_parent, } script._privelemdict = { *************** *** 1947,1951 **** vector._superclassnames = [] vector._privpropdict = { ! 'length' : length, } vector._privelemdict = { --- 1947,1951 ---- vector._superclassnames = [] vector._privpropdict = { ! 'length' : _Prop_length, } vector._privelemdict = { *************** *** 2147,2195 **** 'yard' : yards, 'zone' : zones, - } - - _propdeclarations = { - 'ID ' : id, - 'ascr' : AppleScript, - 'c@#^' : _3c_Inheritance_3e_, - 'day ' : day, - 'days' : days, - 'dstr' : date_string, - 'hour' : hours, - 'kMod' : modifiers, - 'kMsg' : key, - 'kknd' : key_kind, - 'leng' : length, - 'min ' : minutes, - 'mnth' : month, - 'pare' : parent, - 'pi ' : pi, - 'plcd' : language_code, - 'pnam' : name, - 'prdp' : print_depth, - 'prln' : print_length, - 'pscd' : script_code, - 'rest' : rest, - 'ret ' : return_, - 'rslt' : result, - 'rvse' : reverse, - 'spac' : space, - 'tab ' : tab, - 'time' : time, - 'tstr' : time_string, - 'txdl' : text_item_delimiters, - 'week' : weeks, - 'wkdy' : weekday, - 'year' : year, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'boov' : _Enum_boov, - 'cons' : _Enum_cons, - 'eMds' : _Enum_eMds, - 'ekst' : _Enum_ekst, - 'misc' : _Enum_misc, } --- 2147,2149 ---- Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Macintosh_Connectivity_Clas.py 30 Mar 2003 22:41:50 -0000 1.5 --- Macintosh_Connectivity_Clas.py 1 Apr 2003 22:04:52 -0000 1.6 *************** *** 19,27 **** """ADB address - Addresses a device connected via Apple Desktop Bus """ want = 'cadb' ! class _3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'cadr' ! class ID(aetools.NProperty): """ID - the Apple Desktop Bus device ID """ which = 'ID ' --- 19,27 ---- """ADB address - Addresses a device connected via Apple Desktop Bus """ want = 'cadb' ! class _Prop__3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'cadr' ! class _Prop_ID(aetools.NProperty): """ID - the Apple Desktop Bus device ID """ which = 'ID ' *************** *** 33,45 **** """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' ! class conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ which = 'pcon' want = 'econ' ! class properties(aetools.NProperty): """properties - property that allows getting and setting of multiple properties """ which = 'pALL' want = 'reco' ! class protocol(aetools.NProperty): """protocol - How to talk to this addressee """ which = 'pprt' --- 33,45 ---- """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' ! class _Prop_conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ which = 'pcon' want = 'econ' ! class _Prop_properties(aetools.NProperty): """properties - property that allows getting and setting of multiple properties """ which = 'pALL' want = 'reco' ! class _Prop_protocol(aetools.NProperty): """protocol - How to talk to this addressee """ which = 'pprt' *************** *** 51,63 **** """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ want = 'cat ' ! class AppleTalk_machine(aetools.NProperty): """AppleTalk machine - the machine name part of the address """ which = 'patm' want = 'TEXT' ! class AppleTalk_type(aetools.NProperty): """AppleTalk type - the type part of the AppleTalk address """ which = 'patt' want = 'TEXT' ! class AppleTalk_zone(aetools.NProperty): """AppleTalk zone - the zone part of the address """ which = 'patz' --- 51,63 ---- """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ want = 'cat ' ! class _Prop_AppleTalk_machine(aetools.NProperty): """AppleTalk machine - the machine name part of the address """ which = 'patm' want = 'TEXT' ! class _Prop_AppleTalk_type(aetools.NProperty): """AppleTalk type - the type part of the AppleTalk address """ which = 'patt' want = 'TEXT' ! class _Prop_AppleTalk_zone(aetools.NProperty): """AppleTalk zone - the zone part of the address """ which = 'patz' *************** *** 75,83 **** """device specification - A device connected to a computer """ want = 'cdev' ! class device_address(aetools.NProperty): """device address - the address of the device """ which = 'pdva' want = 'cadr' ! class device_type(aetools.NProperty): """device type - the kind of device """ which = 'pdvt' --- 75,83 ---- """device specification - A device connected to a computer """ want = 'cdev' ! class _Prop_device_address(aetools.NProperty): """device address - the address of the device """ which = 'pdva' want = 'cadr' ! class _Prop_device_type(aetools.NProperty): """device type - the kind of device """ which = 'pdvt' *************** *** 101,109 **** """IP address - Addresses a device or service via the Internet Protocol (IP) """ want = 'cip ' ! class DNS_form(aetools.NProperty): """DNS form - the address in the form "apple.com" """ which = 'pdns' want = 'TEXT' ! class port(aetools.NProperty): """port - the port number of the service or client being addressed """ which = 'ppor' --- 101,109 ---- """IP address - Addresses a device or service via the Internet Protocol (IP) """ want = 'cip ' ! class _Prop_DNS_form(aetools.NProperty): """DNS form - the address in the form "apple.com" """ which = 'pdns' want = 'TEXT' ! class _Prop_port(aetools.NProperty): """port - the port number of the service or client being addressed """ which = 'ppor' *************** *** 115,127 **** """LocalTalk address - Addresses a device by its LocalTalk address """ want = 'clt ' ! class network(aetools.NProperty): """network - the LocalTalk network number """ which = 'pnet' want = 'shor' ! class node(aetools.NProperty): """node - the LocalTalk node number """ which = 'pnod' want = 'shor' ! class socket(aetools.NProperty): """socket - the LocalTalk socket number """ which = 'psoc' --- 115,127 ---- """LocalTalk address - Addresses a device by its LocalTalk address """ want = 'clt ' ! class _Prop_network(aetools.NProperty): """network - the LocalTalk network number """ which = 'pnet' want = 'shor' ! class _Prop_node(aetools.NProperty): """node - the LocalTalk node number """ which = 'pnod' want = 'shor' ! class _Prop_socket(aetools.NProperty): """socket - the LocalTalk socket number """ which = 'psoc' *************** *** 133,141 **** """SCSI address - Addresses a SCSI device """ want = 'cscs' ! class LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ which = 'pslu' want = 'shor' ! class SCSI_bus(aetools.NProperty): """SCSI bus - the SCSI bus number """ which = 'pscb' --- 133,141 ---- """SCSI address - Addresses a SCSI device """ want = 'cscs' ! class _Prop_LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ which = 'pslu' want = 'shor' ! class _Prop_SCSI_bus(aetools.NProperty): """SCSI bus - the SCSI bus number """ which = 'pscb' *************** *** 153,157 **** """USB address - Addresses a device on the Universal Serial Bus """ want = 'cusb' ! class name(aetools.NProperty): """name - the USB device name """ which = 'pnam' --- 153,157 ---- """USB address - Addresses a device on the Universal Serial Bus """ want = 'cusb' ! class _Prop_name(aetools.NProperty): """name - the USB device name """ which = 'pnam' *************** *** 161,166 **** ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ADB_address._privelemdict = { --- 161,166 ---- ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } ADB_address._privelemdict = { *************** *** 168,174 **** address_specification._superclassnames = [] address_specification._privpropdict = { ! 'conduit' : conduit, ! 'properties' : properties, ! 'protocol' : protocol, } address_specification._privelemdict = { --- 168,174 ---- address_specification._superclassnames = [] address_specification._privpropdict = { ! 'conduit' : _Prop_conduit, ! 'properties' : _Prop_properties, ! 'protocol' : _Prop_protocol, } address_specification._privelemdict = { *************** *** 176,183 **** AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { ! 'AppleTalk_machine' : AppleTalk_machine, ! 'AppleTalk_type' : AppleTalk_type, ! 'AppleTalk_zone' : AppleTalk_zone, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } AppleTalk_address._privelemdict = { --- 176,183 ---- AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { ! 'AppleTalk_machine' : _Prop_AppleTalk_machine, ! 'AppleTalk_type' : _Prop_AppleTalk_type, ! 'AppleTalk_zone' : _Prop_AppleTalk_zone, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } AppleTalk_address._privelemdict = { *************** *** 185,190 **** bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } bus_slot._privelemdict = { --- 185,190 ---- bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } bus_slot._privelemdict = { *************** *** 192,198 **** device_specification._superclassnames = [] device_specification._privpropdict = { ! 'device_address' : device_address, ! 'device_type' : device_type, ! 'properties' : properties, } device_specification._privelemdict = { --- 192,198 ---- device_specification._superclassnames = [] device_specification._privpropdict = { ! 'device_address' : _Prop_device_address, ! 'device_type' : _Prop_device_type, ! 'properties' : _Prop_properties, } device_specification._privelemdict = { *************** *** 200,205 **** Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } Ethernet_address._privelemdict = { --- 200,205 ---- Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Ethernet_address._privelemdict = { *************** *** 207,212 **** FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } FireWire_address._privelemdict = { --- 207,212 ---- FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } FireWire_address._privelemdict = { *************** *** 214,221 **** IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { ! 'DNS_form' : DNS_form, ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'port' : port, } IP_address._privelemdict = { --- 214,221 ---- IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { ! 'DNS_form' : _Prop_DNS_form, ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'port' : _Prop_port, } IP_address._privelemdict = { *************** *** 223,230 **** LocalTalk_address._superclassnames = ['address_specification'] LocalTalk_address._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'network' : network, ! 'node' : node, ! 'socket' : socket, } LocalTalk_address._privelemdict = { --- 223,230 ---- LocalTalk_address._superclassnames = ['address_specification'] LocalTalk_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'network' : _Prop_network, ! 'node' : _Prop_node, ! 'socket' : _Prop_socket, } LocalTalk_address._privelemdict = { *************** *** 232,239 **** SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { ! 'ID' : ID, ! 'LUN' : LUN, ! 'SCSI_bus' : SCSI_bus, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } SCSI_address._privelemdict = { --- 232,239 ---- SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { ! 'ID' : _Prop_ID, ! 'LUN' : _Prop_LUN, ! 'SCSI_bus' : _Prop_SCSI_bus, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } SCSI_address._privelemdict = { *************** *** 241,246 **** Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { ! 'ID' : ID, ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } Token_Ring_address._privelemdict = { --- 241,246 ---- Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { ! 'ID' : _Prop_ID, ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } Token_Ring_address._privelemdict = { *************** *** 248,253 **** USB_address._superclassnames = ['address_specification'] USB_address._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'name' : name, } USB_address._privelemdict = { --- 248,253 ---- USB_address._superclassnames = ['address_specification'] USB_address._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } USB_address._privelemdict = { *************** *** 341,373 **** 'ctok' : Token_Ring_address, 'cusb' : USB_address, - } - - _propdeclarations = { - 'ID ' : ID, - 'c@#^' : _3c_inheritance_3e_, - 'pALL' : properties, - 'patm' : AppleTalk_machine, - 'patt' : AppleTalk_type, - 'patz' : AppleTalk_zone, - 'pcon' : conduit, - 'pdns' : DNS_form, - 'pdva' : device_address, - 'pdvt' : device_type, - 'pnam' : name, - 'pnet' : network, - 'pnod' : node, - 'ppor' : port, - 'pprt' : protocol, - 'pscb' : SCSI_bus, - 'pslu' : LUN, - 'psoc' : socket, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'econ' : _Enum_econ, - 'edvt' : _Enum_edvt, - 'epro' : _Enum_epro, } --- 341,343 ---- Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QuickDraw_Graphics_Suite.py 30 Mar 2003 22:41:50 -0000 1.5 --- QuickDraw_Graphics_Suite.py 1 Apr 2003 22:04:52 -0000 1.6 *************** *** 19,59 **** """arc - An arc """ want = 'carc' ! class arc_angle(aetools.NProperty): """arc angle - the angle of the arc in degrees """ which = 'parc' want = 'fixd' ! class bounds(aetools.NProperty): """bounds - the smallest rectangle that contains the entire arc """ which = 'pbnd' want = 'qdrt' ! class definition_rect(aetools.NProperty): """definition rect - the rectangle that contains the circle or oval used to define the arc """ which = 'pdrt' want = 'qdrt' ! class fill_color(aetools.NProperty): """fill color - the fill color """ which = 'flcl' want = 'cRGB' ! class fill_pattern(aetools.NProperty): """fill pattern - the fill pattern """ which = 'flpt' want = 'cpix' ! class pen_color(aetools.NProperty): """pen color - the pen color """ which = 'ppcl' want = 'cRGB' ! class pen_pattern(aetools.NProperty): """pen pattern - the pen pattern """ which = 'pppa' want = 'cpix' ! class pen_width(aetools.NProperty): """pen width - the pen width """ which = 'ppwd' want = 'shor' ! class start_angle(aetools.NProperty): """start angle - the angle that defines the start of the arc, in degrees """ which = 'pang' want = 'fixd' ! class transfer_mode(aetools.NProperty): """transfer mode - the transfer mode """ which = 'pptm' --- 19,59 ---- """arc - An arc """ want = 'carc' ! class _Prop_arc_angle(aetools.NProperty): """arc angle - the angle of the arc in degrees """ which = 'parc' want = 'fixd' ! class _Prop_bounds(aetools.NProperty): """bounds - the smallest rectangle that contains the entire arc """ which = 'pbnd' want = 'qdrt' ! class _Prop_definition_rect(aetools.NProperty): """definition rect - the rectangle that contains the circle or oval used to define the arc """ which = 'pdrt' want = 'qdrt' ! class _Prop_fill_color(aetools.NProperty): """fill color - the fill color """ which = 'flcl' want = 'cRGB' ! class _Prop_fill_pattern(aetools.NProperty): """fill pattern - the fill pattern """ which = 'flpt' want = 'cpix' ! class _Prop_pen_color(aetools.NProperty): """pen color - the pen color """ which = 'ppcl' want = 'cRGB' ! class _Prop_pen_pattern(aetools.NProperty): """pen pattern - the pen pattern """ which = 'pppa' want = 'cpix' ! class _Prop_pen_width(aetools.NProperty): """pen width - the pen width """ which = 'ppwd' want = 'shor' ! class _Prop_start_angle(aetools.NProperty): """start angle - the angle that defines the start of the arc, in degrees """ which = 'pang' want = 'fixd' ! class _Prop_transfer_mode(aetools.NProperty): """transfer mode - the transfer mode """ which = 'pptm' *************** *** 65,117 **** """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class background_color(aetools.NProperty): """background color - the color used to fill in unoccupied areas """ which = 'pbcl' want = 'cRGB' ! class background_pattern(aetools.NProperty): """background pattern - the pattern used to fill in unoccupied areas """ which = 'pbpt' want = 'cpix' ! class color_table(aetools.NProperty): """color table - the color table """ which = 'cltb' want = 'clrt' ! class default_font(aetools.NProperty): """default font - the name of the default font for text objects """ which = 'ptxf' want = 'itxt' ! class default_location(aetools.NProperty): """default location - the default location of each new graphic object """ which = 'pnel' want = 'QDpt' ! class default_size(aetools.NProperty): """default size - the default size for text objects """ which = 'ptps' want = 'fixd' ! class name(aetools.NProperty): """name - the name """ which = 'pnam' want = 'itxt' ! class ordering(aetools.NProperty): """ordering - the ordered list of graphic objects in the drawing area """ which = 'gobs' want = 'obj ' ! class pixel_depth(aetools.NProperty): """pixel depth - the number of bits per pixel """ which = 'pdpt' want = 'shor' ! class style(aetools.NProperty): """style - the default text style for text objects """ which = 'txst' want = 'tsty' ! class text_color(aetools.NProperty): """text color - the default color for text objects """ which = 'ptxc' want = 'cRGB' ! class update_on_change(aetools.NProperty): """update on change - Redraw after each change? """ which = 'pupd' want = 'bool' ! class writing_code(aetools.NProperty): """writing code - the script system and language of text objects in the drawing area """ which = 'psct' --- 65,117 ---- """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class _Prop_background_color(aetools.NProperty): """background color - the color used to fill in unoccupied areas """ which = 'pbcl' want = 'cRGB' ! class _Prop_background_pattern(aetools.NProperty): """background pattern - the pattern used to fill in unoccupied areas """ which = 'pbpt' want = 'cpix' ! class _Prop_color_table(aetools.NProperty): """color table - the color table """ which = 'cltb' want = 'clrt' ! class _Prop_default_font(aetools.NProperty): """default font - the name of the default font for text objects """ which = 'ptxf' want = 'itxt' ! class _Prop_default_location(aetools.NProperty): """default location - the default location of each new graphic object """ which = 'pnel' want = 'QDpt' ! class _Prop_default_size(aetools.NProperty): """default size - the default size for text objects """ which = 'ptps' want = 'fixd' ! class _Prop_name(aetools.NProperty): """name - the name """ which = 'pnam' want = 'itxt' ! class _Prop_ordering(aetools.NProperty): """ordering - the ordered list of graphic objects in the drawing area """ which = 'gobs' want = 'obj ' ! class _Prop_pixel_depth(aetools.NProperty): """pixel depth - the number of bits per pixel """ which = 'pdpt' want = 'shor' ! class _Prop_style(aetools.NProperty): """style - the default text style for text objects """ which = 'txst' want = 'tsty' ! class _Prop_text_color(aetools.NProperty): """text color - the default color for text objects """ which = 'ptxc' want = 'cRGB' ! class _Prop_update_on_change(aetools.NProperty): """update on change - Redraw after each change? """ which = 'pupd' want = 'bool' ! class _Prop_writing_code(aetools.NProperty): """writing code - the script system and language of text objects in the drawing area """ which = 'psct' *************** *** 135,151 **** """graphic text - A series of characters within a drawing area """ want = 'cgtx' ! class color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' --- 135,151 ---- """graphic text - A series of characters within a drawing area """ want = 'cgtx' ! class _Prop_color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class _Prop_font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class _Prop_size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class _Prop_uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' *************** *** 161,165 **** """polygon - A polygon """ want = 'cpgn' ! class point_list(aetools.NProperty): """point list - the list of points that define the polygon """ which = 'ptlt' --- 161,165 ---- """polygon - A polygon """ want = 'cpgn' ! class _Prop_point_list(aetools.NProperty): """point list - the list of points that define the polygon """ which = 'ptlt' *************** *** 195,203 **** """rounded rectangle - A rounded rectangle """ want = 'crrc' ! class corner_curve_height(aetools.NProperty): """corner curve height - the height of the oval used to define the shape of the rounded corners """ which = 'pchd' want = 'shor' ! class corner_curve_width(aetools.NProperty): """corner curve width - the width of the oval used to define the shape of the rounded corners """ which = 'pcwd' --- 195,203 ---- """rounded rectangle - A rounded rectangle """ want = 'crrc' ! class _Prop_corner_curve_height(aetools.NProperty): """corner curve height - the height of the oval used to define the shape of the rounded corners """ which = 'pchd' want = 'shor' ! class _Prop_corner_curve_width(aetools.NProperty): """corner curve width - the width of the oval used to define the shape of the rounded corners """ which = 'pcwd' *************** *** 209,225 **** """graphic line - A graphic line """ want = 'glin' ! class arrow_style(aetools.NProperty): """arrow style - the arrow style """ which = 'arro' want = 'arro' ! class dash_style(aetools.NProperty): """dash style - the dash style """ which = 'pdst' want = 'tdas' ! class end_point(aetools.NProperty): """end point - the ending point of the line """ which = 'pend' want = 'QDpt' ! class start_point(aetools.NProperty): """start point - the starting point of the line """ which = 'pstp' --- 209,225 ---- """graphic line - A graphic line """ want = 'glin' ! class _Prop_arrow_style(aetools.NProperty): """arrow style - the arrow style """ which = 'arro' want = 'arro' ! class _Prop_dash_style(aetools.NProperty): """dash style - the dash style """ which = 'pdst' want = 'tdas' ! class _Prop_end_point(aetools.NProperty): """end point - the ending point of the line """ which = 'pend' want = 'QDpt' ! class _Prop_start_point(aetools.NProperty): """start point - the starting point of the line """ which = 'pstp' *************** *** 229,242 **** arc._superclassnames = [] arc._privpropdict = { ! 'arc_angle' : arc_angle, ! 'bounds' : bounds, ! 'definition_rect' : definition_rect, ! 'fill_color' : fill_color, ! 'fill_pattern' : fill_pattern, ! 'pen_color' : pen_color, ! 'pen_pattern' : pen_pattern, ! 'pen_width' : pen_width, ! 'start_angle' : start_angle, ! 'transfer_mode' : transfer_mode, } arc._privelemdict = { --- 229,242 ---- arc._superclassnames = [] arc._privpropdict = { ! 'arc_angle' : _Prop_arc_angle, ! 'bounds' : _Prop_bounds, ! 'definition_rect' : _Prop_definition_rect, ! 'fill_color' : _Prop_fill_color, ! 'fill_pattern' : _Prop_fill_pattern, ! 'pen_color' : _Prop_pen_color, ! 'pen_pattern' : _Prop_pen_pattern, ! 'pen_width' : _Prop_pen_width, ! 'start_angle' : _Prop_start_angle, ! 'transfer_mode' : _Prop_transfer_mode, } arc._privelemdict = { *************** *** 244,260 **** drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'background_color' : background_color, ! 'background_pattern' : background_pattern, ! 'color_table' : color_table, ! 'default_font' : default_font, ! 'default_location' : default_location, ! 'default_size' : default_size, ! 'name' : name, ! 'ordering' : ordering, ! 'pixel_depth' : pixel_depth, ! 'style' : style, ! 'text_color' : text_color, ! 'update_on_change' : update_on_change, ! 'writing_code' : writing_code, } drawing_area._privelemdict = { --- 244,260 ---- drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'background_color' : _Prop_background_color, ! 'background_pattern' : _Prop_background_pattern, ! 'color_table' : _Prop_color_table, ! 'default_font' : _Prop_default_font, ! 'default_location' : _Prop_default_location, ! 'default_size' : _Prop_default_size, ! 'name' : _Prop_name, ! 'ordering' : _Prop_ordering, ! 'pixel_depth' : _Prop_pixel_depth, ! 'style' : _Prop_style, ! 'text_color' : _Prop_text_color, ! 'update_on_change' : _Prop_update_on_change, ! 'writing_code' : _Prop_writing_code, } drawing_area._privelemdict = { *************** *** 272,279 **** graphic_text._superclassnames = [] graphic_text._privpropdict = { ! 'color' : color, ! 'font' : font, ! 'size' : size, ! 'uniform_styles' : uniform_styles, } graphic_text._privelemdict = { --- 272,279 ---- graphic_text._superclassnames = [] graphic_text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'uniform_styles' : _Prop_uniform_styles, } graphic_text._privelemdict = { *************** *** 286,290 **** polygon._superclassnames = [] polygon._privpropdict = { ! 'point_list' : point_list, } polygon._privelemdict = { --- 286,290 ---- polygon._superclassnames = [] polygon._privpropdict = { ! 'point_list' : _Prop_point_list, } polygon._privelemdict = { *************** *** 302,306 **** pixel._superclassnames = [] pixel._privpropdict = { ! 'color' : color, } pixel._privelemdict = { --- 302,306 ---- pixel._superclassnames = [] pixel._privpropdict = { ! 'color' : _Prop_color, } pixel._privelemdict = { *************** *** 313,318 **** rounded_rectangle._superclassnames = [] rounded_rectangle._privpropdict = { ! 'corner_curve_height' : corner_curve_height, ! 'corner_curve_width' : corner_curve_width, } rounded_rectangle._privelemdict = { --- 313,318 ---- rounded_rectangle._superclassnames = [] rounded_rectangle._privpropdict = { ! 'corner_curve_height' : _Prop_corner_curve_height, ! 'corner_curve_width' : _Prop_corner_curve_width, } rounded_rectangle._privelemdict = { *************** *** 320,327 **** graphic_line._superclassnames = [] graphic_line._privpropdict = { ! 'arrow_style' : arrow_style, ! 'dash_style' : dash_style, ! 'end_point' : end_point, ! 'start_point' : start_point, } graphic_line._privelemdict = { --- 320,327 ---- graphic_line._superclassnames = [] graphic_line._privpropdict = { ! 'arrow_style' : _Prop_arrow_style, ! 'dash_style' : _Prop_dash_style, ! 'end_point' : _Prop_end_point, ! 'start_point' : _Prop_start_point, } graphic_line._privelemdict = { *************** *** 370,417 **** 'crrc' : rounded_rectangle, 'glin' : graphic_line, - } - - _propdeclarations = { - 'arro' : arrow_style, - 'cltb' : color_table, - 'colr' : color, - 'flcl' : fill_color, - 'flpt' : fill_pattern, - 'font' : font, - 'gobs' : ordering, - 'pang' : start_angle, - 'parc' : arc_angle, - 'pbcl' : background_color, - 'pbnd' : bounds, - 'pbpt' : background_pattern, - 'pchd' : corner_curve_height, - 'pcwd' : corner_curve_width, - 'pdpt' : pixel_depth, - 'pdrt' : definition_rect, - 'pdst' : dash_style, - 'pend' : end_point, - 'pnam' : name, - 'pnel' : default_location, - 'ppcl' : pen_color, - 'pppa' : pen_pattern, - 'pptm' : transfer_mode, - 'ppwd' : pen_width, - 'psct' : writing_code, - 'pstp' : start_point, - 'ptlt' : point_list, - 'ptps' : default_size, - 'ptsz' : size, - 'ptxc' : text_color, - 'ptxf' : default_font, - 'pupd' : update_on_change, - 'txst' : style, - 'ustl' : uniform_styles, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'arro' : _Enum_arro, - 'tran' : _Enum_tran, } --- 370,372 ---- Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QuickDraw_Graphics_Suppleme.py 30 Mar 2003 22:41:50 -0000 1.4 --- QuickDraw_Graphics_Suppleme.py 1 Apr 2003 22:04:54 -0000 1.5 *************** *** 19,31 **** """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class rotation(aetools.NProperty): """rotation - the default rotation for objects in the drawing area """ which = 'prot' want = 'trot' ! class scale(aetools.NProperty): """scale - the default scaling for objects in the drawing area """ which = 'pscl' want = 'fixd' ! class translation(aetools.NProperty): """translation - the default repositioning for objects in the drawing area """ which = 'ptrs' --- 19,31 ---- """drawing area - Container for graphics and supporting information """ want = 'cdrw' ! class _Prop_rotation(aetools.NProperty): """rotation - the default rotation for objects in the drawing area """ which = 'prot' want = 'trot' ! class _Prop_scale(aetools.NProperty): """scale - the default scaling for objects in the drawing area """ which = 'pscl' want = 'fixd' ! class _Prop_translation(aetools.NProperty): """translation - the default repositioning for objects in the drawing area """ which = 'ptrs' *************** *** 41,47 **** drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'rotation' : rotation, ! 'scale' : scale, ! 'translation' : translation, } drawing_area._privelemdict = { --- 41,47 ---- drawing_area._superclassnames = [] drawing_area._privpropdict = { ! 'rotation' : _Prop_rotation, ! 'scale' : _Prop_scale, ! 'translation' : _Prop_translation, } drawing_area._privelemdict = { *************** *** 59,73 **** 'cdrw' : drawing_area, 'cpic' : graphic_groups, - } - - _propdeclarations = { - 'prot' : rotation, - 'pscl' : scale, - 'ptrs' : translation, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 59,61 ---- Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Required_Suite.py 1 Apr 2003 22:04:54 -0000 1.3 *************** *** 22,32 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 22,23 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 30 Mar 2003 22:41:50 -0000 1.5 --- Standard_Suite.py 1 Apr 2003 22:04:55 -0000 1.6 *************** *** 458,478 **** """application - An application program """ want = 'capp' ! class clipboard(aetools.NProperty): """clipboard - the contents of the clipboard for this application """ which = 'pcli' want = '****' ! class frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' ! class name(aetools.NProperty): """name - the name of the application """ which = 'pnam' want = 'itxt' ! class selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' ! class version(aetools.NProperty): """version - the version of the application """ which = 'vers' --- 458,478 ---- """application - An application program """ want = 'capp' ! class _Prop_clipboard(aetools.NProperty): """clipboard - the contents of the clipboard for this application """ which = 'pcli' want = '****' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the application """ which = 'pnam' want = 'itxt' ! class _Prop_selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' ! class _Prop_version(aetools.NProperty): """version - the version of the application """ which = 'vers' *************** *** 490,494 **** """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """ want = 'csel' ! class contents(aetools.NProperty): """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """ which = 'pcnt' --- 490,494 ---- """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """ want = 'csel' ! class _Prop_contents(aetools.NProperty): """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """ which = 'pcnt' *************** *** 498,538 **** """window - A window """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Is the window visible? """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' --- 498,538 ---- """window - A window """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class _Prop_floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' ! class _Prop_index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' ! class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' ! class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Is the window visible? """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' *************** *** 544,548 **** """document - A document of a scriptable application """ want = 'docu' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' --- 544,548 ---- """document - A document of a scriptable application """ want = 'docu' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' *************** *** 554,558 **** """file - a file on a disk or server """ want = 'file' ! class stationery(aetools.NProperty): """stationery - Is the file a stationery file? """ which = 'pspd' --- 554,558 ---- """file - a file on a disk or server """ want = 'file' ! class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery file? """ which = 'pspd' *************** *** 567,575 **** application._superclassnames = [] application._privpropdict = { ! 'clipboard' : clipboard, ! 'frontmost' : frontmost, ! 'name' : name, ! 'selection' : selection, ! 'version' : version, } application._privelemdict = { --- 567,575 ---- application._superclassnames = [] application._privpropdict = { ! 'clipboard' : _Prop_clipboard, ! 'frontmost' : _Prop_frontmost, ! 'name' : _Prop_name, ! 'selection' : _Prop_selection, ! 'version' : _Prop_version, } application._privelemdict = { *************** *** 582,586 **** selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : contents, } selection_2d_object._privelemdict = { --- 582,586 ---- selection_2d_object._superclassnames = [] selection_2d_object._privpropdict = { ! 'contents' : _Prop_contents, } selection_2d_object._privelemdict = { *************** *** 588,601 **** window._superclassnames = [] window._privpropdict = { ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'floating' : floating, ! 'index' : index, ! 'modal' : modal, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 588,601 ---- window._superclassnames = [] window._privpropdict = { ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'floating' : _Prop_floating, ! 'index' : _Prop_index, ! 'modal' : _Prop_modal, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 603,607 **** document._superclassnames = [] document._privpropdict = { ! 'modified' : modified, } document._privelemdict = { --- 603,607 ---- document._superclassnames = [] document._privpropdict = { ! 'modified' : _Prop_modified, } document._privelemdict = { *************** *** 609,613 **** file._superclassnames = [] file._privpropdict = { ! 'stationery' : stationery, } file._privelemdict = { --- 609,613 ---- file._superclassnames = [] file._privpropdict = { ! 'stationery' : _Prop_stationery, } file._privelemdict = { *************** *** 671,711 **** 'docu' : document, 'file' : file, - } - - _propdeclarations = { - 'hclb' : closeable, - 'imod' : modified, - 'isfl' : floating, - 'iszm' : zoomable, - 'pbnd' : bounds, - 'pcli' : clipboard, - 'pcnt' : contents, - 'pidx' : index, - 'pisf' : frontmost, - 'pmod' : modal, - 'pnam' : name, - 'prsz' : resizable, - 'pspd' : stationery, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'sele' : selection, - 'vers' : version, - } - - _compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, - } - - _enumdeclarations = { - 'kfrm' : _Enum_kfrm, - 'savo' : _Enum_savo, - 'styl' : _Enum_styl, } --- 671,673 ---- Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Table_Suite.py 30 Mar 2003 22:41:50 -0000 1.4 --- Table_Suite.py 1 Apr 2003 22:04:56 -0000 1.5 *************** *** 19,27 **** """cell - A cell """ want = 'ccel' ! class formula(aetools.NProperty): """formula - the formula of the cell """ which = 'pfor' want = 'ctxt' ! class protection(aetools.NProperty): """protection - Indicates whether value or formula in the cell can be changed """ which = 'ppro' --- 19,27 ---- """cell - A cell """ want = 'ccel' ! class _Prop_formula(aetools.NProperty): """formula - the formula of the cell """ which = 'pfor' want = 'ctxt' ! class _Prop_protection(aetools.NProperty): """protection - Indicates whether value or formula in the cell can be changed """ which = 'ppro' *************** *** 33,37 **** """column - A column """ want = 'ccol' ! class name(aetools.NProperty): """name - the name of the column """ which = 'pnam' --- 33,37 ---- """column - A column """ want = 'ccol' ! class _Prop_name(aetools.NProperty): """name - the name of the column """ which = 'pnam' *************** *** 53,58 **** cell._superclassnames = [] cell._privpropdict = { ! 'formula' : formula, ! 'protection' : protection, } cell._privelemdict = { --- 53,58 ---- cell._superclassnames = [] cell._privpropdict = { ! 'formula' : _Prop_formula, ! 'protection' : _Prop_protection, } cell._privelemdict = { *************** *** 60,64 **** column._superclassnames = [] column._privpropdict = { ! 'name' : name, } column._privelemdict = { --- 60,64 ---- column._superclassnames = [] column._privpropdict = { ! 'name' : _Prop_name, } column._privelemdict = { *************** *** 89,104 **** 'crow' : rows, 'ctbl' : tables, - } - - _propdeclarations = { - 'pfor' : formula, - 'pnam' : name, - 'ppro' : protection, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'prtn' : _Enum_prtn, } --- 89,91 ---- Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Text_Suite.py 30 Mar 2003 22:41:50 -0000 1.4 --- Text_Suite.py 1 Apr 2003 22:04:57 -0000 1.5 *************** *** 19,27 **** """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ want = 'cflo' ! class _3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'ctxt' ! class name(aetools.NProperty): """name - the name """ which = 'pnam' --- 19,27 ---- """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ want = 'cflo' ! class _Prop__3c_inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from this class """ which = 'c@#^' want = 'ctxt' ! class _Prop_name(aetools.NProperty): """name - the name """ which = 'pnam' *************** *** 37,41 **** """line - A line of text """ want = 'clin' ! class justification(aetools.NProperty): """justification - the justification of the text """ which = 'pjst' --- 37,41 ---- """line - A line of text """ want = 'clin' ! class _Prop_justification(aetools.NProperty): """justification - the justification of the text """ which = 'pjst' *************** *** 53,77 **** """text - Text """ want = 'ctxt' ! class color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class style(aetools.NProperty): """style - the text style of the first character of the first character """ which = 'txst' want = 'tsty' ! class uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' want = 'tsty' ! class writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' --- 53,77 ---- """text - Text """ want = 'ctxt' ! class _Prop_color(aetools.NProperty): """color - the color of the first character """ which = 'colr' want = 'cRGB' ! class _Prop_font(aetools.NProperty): """font - the name of the font of the first character """ which = 'font' want = 'ctxt' ! class _Prop_size(aetools.NProperty): """size - the size in points of the first character """ which = 'ptsz' want = 'fixd' ! class _Prop_style(aetools.NProperty): """style - the text style of the first character of the first character """ which = 'txst' want = 'tsty' ! class _Prop_uniform_styles(aetools.NProperty): """uniform styles - the text styles that are uniform throughout the text """ which = 'ustl' want = 'tsty' ! class _Prop_writing_code(aetools.NProperty): """writing code - the script system and language """ which = 'psct' *************** *** 92,100 **** """text style info - On and Off styles of text run """ want = 'tsty' ! class off_styles(aetools.NProperty): """off styles - the styles that are off for the text """ which = 'ofst' want = 'styl' ! class on_styles(aetools.NProperty): """on styles - the styles that are on for the text """ which = 'onst' --- 92,100 ---- """text style info - On and Off styles of text run """ want = 'tsty' ! class _Prop_off_styles(aetools.NProperty): """off styles - the styles that are off for the text """ which = 'ofst' want = 'styl' ! class _Prop_on_styles(aetools.NProperty): """on styles - the styles that are on for the text """ which = 'onst' *************** *** 104,109 **** text_flow._superclassnames = ['text'] text_flow._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'name' : name, } text_flow._privelemdict = { --- 104,109 ---- text_flow._superclassnames = ['text'] text_flow._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'name' : _Prop_name, } text_flow._privelemdict = { *************** *** 111,115 **** character._superclassnames = ['text'] character._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } character._privelemdict = { --- 111,115 ---- character._superclassnames = ['text'] character._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } character._privelemdict = { *************** *** 117,122 **** line._superclassnames = ['text'] line._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'justification' : justification, } line._privelemdict = { --- 117,122 ---- line._superclassnames = ['text'] line._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, ! 'justification' : _Prop_justification, } line._privelemdict = { *************** *** 124,128 **** paragraph._superclassnames = ['text'] paragraph._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } paragraph._privelemdict = { --- 124,128 ---- paragraph._superclassnames = ['text'] paragraph._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } paragraph._privelemdict = { *************** *** 130,139 **** text._superclassnames = [] text._privpropdict = { ! 'color' : color, ! 'font' : font, ! 'size' : size, ! 'style' : style, ! 'uniform_styles' : uniform_styles, ! 'writing_code' : writing_code, } text._privelemdict = { --- 130,139 ---- text._superclassnames = [] text._privpropdict = { ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, ! 'style' : _Prop_style, ! 'uniform_styles' : _Prop_uniform_styles, ! 'writing_code' : _Prop_writing_code, } text._privelemdict = { *************** *** 146,150 **** word._superclassnames = ['text'] word._privpropdict = { ! '_3c_inheritance_3e_' : _3c_inheritance_3e_, } word._privelemdict = { --- 146,150 ---- word._superclassnames = ['text'] word._privpropdict = { ! '_3c_inheritance_3e_' : _Prop__3c_inheritance_3e_, } word._privelemdict = { *************** *** 152,157 **** text_style_info._superclassnames = [] text_style_info._privpropdict = { ! 'off_styles' : off_styles, ! 'on_styles' : on_styles, } text_style_info._privelemdict = { --- 152,157 ---- text_style_info._superclassnames = [] text_style_info._privpropdict = { ! 'off_styles' : _Prop_off_styles, ! 'on_styles' : _Prop_on_styles, } text_style_info._privelemdict = { *************** *** 194,218 **** 'cwor' : word, 'tsty' : text_style_info, - } - - _propdeclarations = { - 'c@#^' : _3c_inheritance_3e_, - 'colr' : color, - 'font' : font, - 'ofst' : off_styles, - 'onst' : on_styles, - 'pjst' : justification, - 'pnam' : name, - 'psct' : writing_code, - 'ptsz' : size, - 'txst' : style, - 'ustl' : uniform_styles, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'just' : _Enum_just, - 'styl' : _Enum_styl, } --- 194,196 ---- Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Type_Names_Suite.py 30 Mar 2003 22:41:50 -0000 1.5 --- Type_Names_Suite.py 1 Apr 2003 22:04:57 -0000 1.6 *************** *** 425,435 **** 'vers' : version, } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 425,426 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 29 Mar 2003 00:13:15 -0000 1.5 --- __init__.py 1 Apr 2003 22:04:59 -0000 1.6 *************** *** 174,195 **** getbaseclasses(file_specification) getbaseclasses(text) ! getbaseclasses(graphic_group) ! getbaseclasses(drawing_area) ! getbaseclasses(cell) ! getbaseclasses(column) ! getbaseclasses(table) ! getbaseclasses(row) ! getbaseclasses(AppleTalk_address) ! getbaseclasses(address_specification) ! getbaseclasses(Token_Ring_address) ! getbaseclasses(FireWire_address) ! getbaseclasses(bus_slot) ! getbaseclasses(SCSI_address) ! getbaseclasses(ADB_address) ! getbaseclasses(USB_address) ! getbaseclasses(device_specification) ! getbaseclasses(LocalTalk_address) ! getbaseclasses(IP_address) ! getbaseclasses(Ethernet_address) getbaseclasses(small_integer) getbaseclasses(RGB16_color) --- 174,184 ---- getbaseclasses(file_specification) getbaseclasses(text) ! getbaseclasses(window) ! getbaseclasses(file) ! getbaseclasses(selection_2d_object) ! getbaseclasses(alias) ! getbaseclasses(application) ! getbaseclasses(insertion_point) ! getbaseclasses(document) getbaseclasses(small_integer) getbaseclasses(RGB16_color) *************** *** 239,249 **** getbaseclasses(word) getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(selection_2d_object) - getbaseclasses(alias) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) getbaseclasses(graphic_group) getbaseclasses(oval) --- 228,231 ---- *************** *** 259,262 **** --- 241,262 ---- getbaseclasses(pixel_map) getbaseclasses(rectangle) + getbaseclasses(graphic_group) + getbaseclasses(drawing_area) + getbaseclasses(AppleTalk_address) + getbaseclasses(address_specification) + getbaseclasses(Token_Ring_address) + getbaseclasses(FireWire_address) + getbaseclasses(bus_slot) + getbaseclasses(SCSI_address) + getbaseclasses(ADB_address) + getbaseclasses(USB_address) + getbaseclasses(device_specification) + getbaseclasses(LocalTalk_address) + getbaseclasses(IP_address) + getbaseclasses(Ethernet_address) + getbaseclasses(cell) + getbaseclasses(column) + getbaseclasses(table) + getbaseclasses(row) # *************** *** 369,390 **** 'fss ' : file_specification, 'ctxt' : text, ! 'cpic' : graphic_group, ! 'cdrw' : drawing_area, ! 'ccel' : cell, ! 'ccol' : column, ! 'ctbl' : table, ! 'crow' : row, ! 'cat ' : AppleTalk_address, ! 'cadr' : address_specification, ! 'ctok' : Token_Ring_address, ! 'cfw ' : FireWire_address, ! 'cbus' : bus_slot, ! 'cscs' : SCSI_address, ! 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cen ' : Ethernet_address, 'shor' : small_integer, 'tr16' : RGB16_color, --- 369,379 ---- 'fss ' : file_specification, 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'csel' : selection_2d_object, ! 'alis' : alias, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, 'shor' : small_integer, 'tr16' : RGB16_color, *************** *** 434,444 **** 'cwor' : word, 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'csel' : selection_2d_object, - 'alis' : alias, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, 'cpic' : graphic_group, 'covl' : oval, --- 423,426 ---- *************** *** 454,457 **** --- 436,457 ---- 'cpix' : pixel_map, 'crec' : rectangle, + 'cpic' : graphic_group, + 'cdrw' : drawing_area, + 'cat ' : AppleTalk_address, + 'cadr' : address_specification, + 'ctok' : Token_Ring_address, + 'cfw ' : FireWire_address, + 'cbus' : bus_slot, + 'cscs' : SCSI_address, + 'cadb' : ADB_address, + 'cusb' : USB_address, + 'cdev' : device_specification, + 'clt ' : LocalTalk_address, + 'cip ' : IP_address, + 'cen ' : Ethernet_address, + 'ccel' : cell, + 'ccol' : column, + 'ctbl' : table, + 'crow' : row, } From jackjansen@users.sourceforge.net Tue Apr 1 22:05:49 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:49 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.4,1.5 Netscape_Suite.py,1.3,1.4 Required_Suite.py,1.4,1.5 Standard_Suite.py,1.3,1.4 URL_Suite.py,1.3,1.4 Web_Browser_Suite.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Explorer Modified Files: Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py Standard_Suite.py URL_Suite.py Web_Browser_Suite.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Microsoft_Internet_Explorer.py 29 Mar 2003 00:13:11 -0000 1.4 --- Microsoft_Internet_Explorer.py 1 Apr 2003 22:04:31 -0000 1.5 *************** *** 86,96 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 86,87 ---- Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Netscape_Suite.py 29 Mar 2003 00:13:11 -0000 1.3 --- Netscape_Suite.py 1 Apr 2003 22:04:32 -0000 1.4 *************** *** 39,49 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 39,40 ---- Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required_Suite.py 29 Mar 2003 00:13:11 -0000 1.4 --- Required_Suite.py 1 Apr 2003 22:04:33 -0000 1.5 *************** *** 98,108 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 98,99 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 29 Mar 2003 00:13:11 -0000 1.3 --- Standard_Suite.py 1 Apr 2003 22:04:34 -0000 1.4 *************** *** 43,47 **** """application - An application program """ want = 'capp' ! class selected_text(aetools.NProperty): """selected text - the selected text """ which = 'stxt' --- 43,47 ---- """application - An application program """ want = 'capp' ! class _Prop_selected_text(aetools.NProperty): """selected text - the selected text """ which = 'stxt' *************** *** 49,53 **** application._superclassnames = [] application._privpropdict = { ! 'selected_text' : selected_text, } application._privelemdict = { --- 49,53 ---- application._superclassnames = [] application._privpropdict = { ! 'selected_text' : _Prop_selected_text, } application._privelemdict = { *************** *** 59,71 **** _classdeclarations = { 'capp' : application, - } - - _propdeclarations = { - 'stxt' : selected_text, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 59,61 ---- Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** URL_Suite.py 29 Mar 2003 00:13:12 -0000 1.3 --- URL_Suite.py 1 Apr 2003 22:04:34 -0000 1.4 *************** *** 44,54 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 44,45 ---- Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Web_Browser_Suite.py 29 Mar 2003 00:13:12 -0000 1.4 --- Web_Browser_Suite.py 1 Apr 2003 22:04:34 -0000 1.5 *************** *** 216,226 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 216,217 ---- From jackjansen@users.sourceforge.net Tue Apr 1 22:05:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Standard_Suite.py,1.2,1.3 Terminal_Suite.py,1.5,1.6 Text_Suite.py,1.1,1.2 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv20940/Terminal Modified Files: Standard_Suite.py Terminal_Suite.py Text_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 30 Mar 2003 22:41:53 -0000 1.2 --- Standard_Suite.py 1 Apr 2003 22:05:10 -0000 1.3 *************** *** 334,350 **** """application - An application's top level scripting object. """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class version(aetools.NProperty): """version - The version of the application. """ which = 'vers' --- 334,350 ---- """application - An application's top level scripting object. """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' *************** *** 358,366 **** """item - A scriptable object. """ want = 'cobj' ! class class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' --- 358,366 ---- """item - A scriptable object. """ want = 'cobj' ! class _Prop_class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class _Prop_properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' *************** *** 378,434 **** """window - A window. """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' --- 378,434 ---- """window - A window. """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class _Prop_document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class _Prop_floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class _Prop_id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class _Prop_index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class _Prop_miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class _Prop_miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class _Prop_modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class _Prop_resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' *************** *** 440,448 **** """document - A document. """ want = 'docu' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class path(aetools.NProperty): """path - The document's path. """ which = 'ppth' --- 440,448 ---- """document - A document. """ want = 'docu' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class _Prop_path(aetools.NProperty): """path - The document's path. """ which = 'ppth' *************** *** 452,459 **** application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'frontmost' : frontmost, ! 'name' : name, ! 'version' : version, } application._privelemdict = { --- 452,459 ---- application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'frontmost' : _Prop_frontmost, ! 'name' : _Prop_name, ! 'version' : _Prop_version, } application._privelemdict = { *************** *** 463,468 **** item._superclassnames = [] item._privpropdict = { ! 'class_' : class_, ! 'properties' : properties, } item._privelemdict = { --- 463,468 ---- item._superclassnames = [] item._privpropdict = { ! 'class_' : _Prop_class_, ! 'properties' : _Prop_properties, } item._privelemdict = { *************** *** 470,474 **** color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color._privelemdict = { --- 470,474 ---- color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } color._privelemdict = { *************** *** 476,495 **** window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'document' : document, ! 'floating' : floating, ! 'id' : id, ! 'index' : index, ! 'miniaturizable' : miniaturizable, ! 'miniaturized' : miniaturized, ! 'modal' : modal, ! 'name' : name, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 476,495 ---- window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'document' : _Prop_document, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'miniaturizable' : _Prop_miniaturizable, ! 'miniaturized' : _Prop_miniaturized, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 497,504 **** document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'modified' : modified, ! 'name' : name, ! 'path' : path, } document._privelemdict = { --- 497,504 ---- document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'modified' : _Prop_modified, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } document._privelemdict = { *************** *** 536,578 **** 'cwin' : window, 'docu' : document, - } - - _propdeclarations = { - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'docu' : document, - 'hclb' : closeable, - 'imod' : modified, - 'isfl' : floating, - 'ismn' : miniaturizable, - 'iszm' : zoomable, - 'pALL' : properties, - 'pbnd' : bounds, - 'pcls' : class_, - 'pidx' : index, - 'pisf' : frontmost, - 'pmnd' : miniaturized, - 'pmod' : modal, - 'pnam' : name, - 'ppth' : path, - 'prsz' : resizable, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'vers' : version, - } - - _compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, - } - - _enumdeclarations = { - 'savo' : _Enum_savo, } --- 536,538 ---- Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Terminal_Suite.py 29 Mar 2003 00:13:17 -0000 1.5 --- Terminal_Suite.py 1 Apr 2003 22:05:12 -0000 1.6 *************** *** 65,73 **** """application - The Terminal program """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class properties(aetools.NProperty): """properties - every property of the Terminal program """ which = 'pALL' --- 65,73 ---- """application - The Terminal program """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class _Prop_properties(aetools.NProperty): """properties - every property of the Terminal program """ which = 'pALL' *************** *** 81,169 **** """window - A Terminal window """ want = 'cwin' ! class background_color(aetools.NProperty): """background color - the background color for the window """ which = 'pbcl' want = '****' ! class bold_text_color(aetools.NProperty): """bold text color - the bold text color for the window """ which = 'pbtc' want = '****' ! class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' want = '****' ! class busy(aetools.NProperty): """busy - Is the window busy running a process? """ which = 'busy' want = 'bool' ! class contents(aetools.NProperty): """contents - the currently visible contents of the window """ which = 'pcnt' want = 'utxt' ! class cursor_color(aetools.NProperty): """cursor color - the cursor color for the window """ which = 'pcuc' want = '****' ! class custom_title(aetools.NProperty): """custom title - the custom title for the window """ which = 'titl' want = 'utxt' ! class frame(aetools.NProperty): """frame - the origin and size of the window """ which = 'pfra' want = '****' ! class frontmost(aetools.NProperty): """frontmost - Is the window in front of the other Terminal windows? """ which = 'pisf' want = 'bool' ! class history(aetools.NProperty): """history - the contents of the entire scrolling buffer of the window """ which = 'hist' want = 'utxt' ! class normal_text_color(aetools.NProperty): """normal text color - the normal text color for the window """ which = 'ptxc' want = '****' ! class number_of_columns(aetools.NProperty): """number of columns - the number of columns in the window """ which = 'ccol' want = 'long' ! class number_of_rows(aetools.NProperty): """number of rows - the number of rows in the window """ which = 'crow' want = 'long' ! class origin(aetools.NProperty): """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ which = 'pori' want = '****' ! class position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = '****' ! class processes(aetools.NProperty): """processes - a list of the currently running processes """ which = 'prcs' want = 'utxt' ! class size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' want = '****' ! class title_displays_custom_title(aetools.NProperty): """title displays custom title - Does the title for the window contain a custom title? """ which = 'tdct' want = 'bool' ! class title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ which = 'tddn' want = 'bool' ! class title_displays_file_name(aetools.NProperty): """title displays file name - Does the title for the window contain the file name? """ which = 'tdfn' want = 'bool' ! class title_displays_shell_path(aetools.NProperty): """title displays shell path - Does the title for the window contain the shell path? """ which = 'tdsp' want = 'bool' ! class title_displays_window_size(aetools.NProperty): """title displays window size - Does the title for the window contain the window size? """ which = 'tdws' --- 81,169 ---- """window - A Terminal window """ want = 'cwin' ! class _Prop_background_color(aetools.NProperty): """background color - the background color for the window """ which = 'pbcl' want = '****' ! class _Prop_bold_text_color(aetools.NProperty): """bold text color - the bold text color for the window """ which = 'pbtc' want = '****' ! class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' want = '****' ! class _Prop_busy(aetools.NProperty): """busy - Is the window busy running a process? """ which = 'busy' want = 'bool' ! class _Prop_contents(aetools.NProperty): """contents - the currently visible contents of the window """ which = 'pcnt' want = 'utxt' ! class _Prop_cursor_color(aetools.NProperty): """cursor color - the cursor color for the window """ which = 'pcuc' want = '****' ! class _Prop_custom_title(aetools.NProperty): """custom title - the custom title for the window """ which = 'titl' want = 'utxt' ! class _Prop_frame(aetools.NProperty): """frame - the origin and size of the window """ which = 'pfra' want = '****' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the window in front of the other Terminal windows? """ which = 'pisf' want = 'bool' ! class _Prop_history(aetools.NProperty): """history - the contents of the entire scrolling buffer of the window """ which = 'hist' want = 'utxt' ! class _Prop_normal_text_color(aetools.NProperty): """normal text color - the normal text color for the window """ which = 'ptxc' want = '****' ! class _Prop_number_of_columns(aetools.NProperty): """number of columns - the number of columns in the window """ which = 'ccol' want = 'long' ! class _Prop_number_of_rows(aetools.NProperty): """number of rows - the number of rows in the window """ which = 'crow' want = 'long' ! class _Prop_origin(aetools.NProperty): """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ which = 'pori' want = '****' ! class _Prop_position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = '****' ! class _Prop_processes(aetools.NProperty): """processes - a list of the currently running processes """ which = 'prcs' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' want = '****' ! class _Prop_title_displays_custom_title(aetools.NProperty): """title displays custom title - Does the title for the window contain a custom title? """ which = 'tdct' want = 'bool' ! class _Prop_title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ which = 'tddn' want = 'bool' ! class _Prop_title_displays_file_name(aetools.NProperty): """title displays file name - Does the title for the window contain the file name? """ which = 'tdfn' want = 'bool' ! class _Prop_title_displays_shell_path(aetools.NProperty): """title displays shell path - Does the title for the window contain the shell path? """ which = 'tdsp' want = 'bool' ! class _Prop_title_displays_window_size(aetools.NProperty): """title displays window size - Does the title for the window contain the window size? """ which = 'tdws' *************** *** 174,179 **** import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, } application._privelemdict = { --- 174,179 ---- import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } application._privelemdict = { *************** *** 183,210 **** window._superclassnames = [] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'background_color' : background_color, ! 'bold_text_color' : bold_text_color, ! 'bounds' : bounds, ! 'busy' : busy, ! 'contents' : contents, ! 'cursor_color' : cursor_color, ! 'custom_title' : custom_title, ! 'frame' : frame, ! 'frontmost' : frontmost, ! 'history' : history, ! 'normal_text_color' : normal_text_color, ! 'number_of_columns' : number_of_columns, ! 'number_of_rows' : number_of_rows, ! 'origin' : origin, ! 'position' : position, ! 'processes' : processes, ! 'properties' : properties, ! 'size' : size, ! 'title_displays_custom_title' : title_displays_custom_title, ! 'title_displays_device_name' : title_displays_device_name, ! 'title_displays_file_name' : title_displays_file_name, ! 'title_displays_shell_path' : title_displays_shell_path, ! 'title_displays_window_size' : title_displays_window_size, } window._privelemdict = { --- 183,210 ---- window._superclassnames = [] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'background_color' : _Prop_background_color, ! 'bold_text_color' : _Prop_bold_text_color, ! 'bounds' : _Prop_bounds, ! 'busy' : _Prop_busy, ! 'contents' : _Prop_contents, ! 'cursor_color' : _Prop_cursor_color, ! 'custom_title' : _Prop_custom_title, ! 'frame' : _Prop_frame, ! 'frontmost' : _Prop_frontmost, ! 'history' : _Prop_history, ! 'normal_text_color' : _Prop_normal_text_color, ! 'number_of_columns' : _Prop_number_of_columns, ! 'number_of_rows' : _Prop_number_of_rows, ! 'origin' : _Prop_origin, ! 'position' : _Prop_position, ! 'processes' : _Prop_processes, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'title_displays_custom_title' : _Prop_title_displays_custom_title, ! 'title_displays_device_name' : _Prop_title_displays_device_name, ! 'title_displays_file_name' : _Prop_title_displays_file_name, ! 'title_displays_shell_path' : _Prop_title_displays_shell_path, ! 'title_displays_window_size' : _Prop_title_displays_window_size, } window._privelemdict = { *************** *** 217,252 **** 'capp' : application, 'cwin' : window, - } - - _propdeclarations = { - 'busy' : busy, - 'c@#^' : _3c_Inheritance_3e_, - 'ccol' : number_of_columns, - 'crow' : number_of_rows, - 'hist' : history, - 'pALL' : properties, - 'pbcl' : background_color, - 'pbnd' : bounds, - 'pbtc' : bold_text_color, - 'pcnt' : contents, - 'pcuc' : cursor_color, - 'pfra' : frame, - 'pisf' : frontmost, - 'pori' : origin, - 'ppos' : position, - 'prcs' : processes, - 'psiz' : size, - 'ptxc' : normal_text_color, - 'tdct' : title_displays_custom_title, - 'tddn' : title_displays_device_name, - 'tdfn' : title_displays_file_name, - 'tdsp' : title_displays_shell_path, - 'tdws' : title_displays_window_size, - 'titl' : custom_title, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 217,219 ---- Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Text_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text_Suite.py 29 Mar 2003 00:13:17 -0000 1.1 --- Text_Suite.py 1 Apr 2003 22:05:13 -0000 1.2 *************** *** 19,27 **** """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' --- 19,27 ---- """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class _Prop_file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' *************** *** 35,47 **** """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' --- 35,47 ---- """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class _Prop_color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class _Prop_font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' *************** *** 93,98 **** attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'file_name' : file_name, } attachment._privelemdict = { --- 93,98 ---- attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { *************** *** 105,112 **** attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } attribute_run._privelemdict = { --- 105,112 ---- attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { *************** *** 118,125 **** character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } character._privelemdict = { --- 118,125 ---- character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { *************** *** 131,138 **** paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } paragraph._privelemdict = { --- 131,138 ---- paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { *************** *** 144,151 **** text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } text._privelemdict = { --- 144,151 ---- text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { *************** *** 157,164 **** word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } word._privelemdict = { --- 157,164 ---- word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { *************** *** 179,195 **** 'ctxt' : text, 'cwor' : word, - } - - _propdeclarations = { - 'atfn' : file_name, - 'c@#^' : _3c_Inheritance_3e_, - 'colr' : color, - 'font' : font, - 'ptsz' : size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 179,181 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 29 Mar 2003 00:13:17 -0000 1.5 --- __init__.py 1 Apr 2003 22:05:14 -0000 1.6 *************** *** 44,49 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(window) - getbaseclasses(application) getbaseclasses(character) getbaseclasses(attachment) --- 44,47 ---- *************** *** 52,55 **** --- 50,55 ---- getbaseclasses(attribute_run) getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(application) getbaseclasses(color) getbaseclasses(window) *************** *** 62,67 **** # _classdeclarations = { - 'cwin' : window, - 'capp' : application, 'cha ' : character, 'atts' : attachment, --- 62,65 ---- *************** *** 70,73 **** --- 68,73 ---- 'catr' : attribute_run, 'ctxt' : text, + 'cwin' : window, + 'capp' : application, 'colr' : color, 'cwin' : window, From jackjansen@users.sourceforge.net Tue Apr 1 22:05:53 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:05:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents Disk_2d_Folder_2d_File_Suite.py,1.1,1.2 Folder_Actions_Suite.py,1.1,1.2 Hidden_Suite.py,1.1,1.2 Login_Items_Suite.py,1.1,1.2 Power_Suite.py,1.1,1.2 Processes_Suite.py,1.1,1.2 Standard_Suite.py,1.1,1.2 System_Events_Suite.py,1.1,1.2 Text_Suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents In directory sc8-pr-cvs1:/tmp/cvs-serv20940/SystemEvents Modified Files: Disk_2d_Folder_2d_File_Suite.py Folder_Actions_Suite.py Hidden_Suite.py Login_Items_Suite.py Power_Suite.py Processes_Suite.py Standard_Suite.py System_Events_Suite.py Text_Suite.py __init__.py Log Message: Regenerated with property names with _Prop_ prepended. Index: Disk_2d_Folder_2d_File_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_2d_Folder_2d_File_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Disk_2d_Folder_2d_File_Suite.py 30 Mar 2003 22:41:51 -0000 1.1 --- Disk_2d_Folder_2d_File_Suite.py 1 Apr 2003 22:05:00 -0000 1.2 *************** *** 43,55 **** """alias - An alias in the file system """ want = 'alis' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class properties(aetools.NProperty): """properties - every property of the alias """ which = 'pALL' want = '****' ! class version(aetools.NProperty): """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ which = 'vers' --- 43,55 ---- """alias - An alias in the file system """ want = 'alis' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_properties(aetools.NProperty): """properties - every property of the alias """ which = 'pALL' want = '****' ! class _Prop_version(aetools.NProperty): """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ which = 'vers' *************** *** 65,93 **** """disk - A disk in the file system """ want = 'cdis' ! class capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'magn' ! class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class format(aetools.NProperty): """format - the file system format of this disk """ which = 'dfmt' want = 'edfm' ! class free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'magn' ! class ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' --- 65,93 ---- """disk - A disk in the file system """ want = 'cdis' ! class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'magn' ! class _Prop_ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' ! class _Prop_format(aetools.NProperty): """format - the file system format of this disk """ which = 'dfmt' want = 'edfm' ! class _Prop_free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'magn' ! class _Prop_ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' ! class _Prop_local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' ! class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' *************** *** 113,161 **** """item - An item in the file system """ want = 'cobj' ! class POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the item """ which = 'posx' want = 'utxt' ! class busy_status(aetools.NProperty): """busy status - Is the item busy? """ which = 'busy' want = 'bool' ! class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = '****' ! class displayed_name(aetools.NProperty): """displayed name - the name of the item as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = '****' ! class name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class name_extension(aetools.NProperty): """name extension - the extension portion of the name """ which = 'extn' want = 'utxt' ! class package_folder(aetools.NProperty): """package folder - Is the item a package? """ which = 'pkgf' want = 'bool' ! class path(aetools.NProperty): """path - the file system path of the item """ which = 'ppth' want = 'utxt' ! class url(aetools.NProperty): """url - the url of the item """ which = 'url ' want = 'utxt' ! class visible(aetools.NProperty): """visible - Is the item visible? """ which = 'pvis' want = 'bool' ! class volume(aetools.NProperty): """volume - the volume on which the item resides """ which = 'volu' --- 113,161 ---- """item - An item in the file system """ want = 'cobj' ! class _Prop_POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the item """ which = 'posx' want = 'utxt' ! class _Prop_busy_status(aetools.NProperty): """busy status - Is the item busy? """ which = 'busy' want = 'bool' ! class _Prop_creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = '****' ! class _Prop_displayed_name(aetools.NProperty): """displayed name - the name of the item as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class _Prop_modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = '****' ! class _Prop_name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' ! class _Prop_name_extension(aetools.NProperty): """name extension - the extension portion of the name """ which = 'extn' want = 'utxt' ! class _Prop_package_folder(aetools.NProperty): """package folder - Is the item a package? """ which = 'pkgf' want = 'bool' ! class _Prop_path(aetools.NProperty): """path - the file system path of the item """ which = 'ppth' want = 'utxt' ! class _Prop_url(aetools.NProperty): """url - the url of the item """ which = 'url ' want = 'utxt' ! class _Prop_visible(aetools.NProperty): """visible - Is the item visible? """ which = 'pvis' want = 'bool' ! class _Prop_volume(aetools.NProperty): """volume - the volume on which the item resides """ which = 'volu' *************** *** 167,191 **** """file - A file in the file system """ want = 'file' ! class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the file """ which = 'fcrt' want = 'utxt' ! class file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the file """ which = 'asty' want = 'utxt' ! class physical_size(aetools.NProperty): """physical size - the actual space used by the file on disk """ which = 'phys' want = '****' ! class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the "Get Info" window) """ which = 'ver2' want = 'utxt' ! class size(aetools.NProperty): """size - the logical size of the file """ which = 'ptsz' want = '****' ! class stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' --- 167,191 ---- """file - A file in the file system """ want = 'file' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the file """ which = 'fcrt' want = 'utxt' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the file """ which = 'asty' want = 'utxt' ! class _Prop_physical_size(aetools.NProperty): """physical size - the actual space used by the file on disk """ which = 'phys' want = '****' ! class _Prop_product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the "Get Info" window) """ which = 'ver2' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - the logical size of the file """ which = 'ptsz' want = '****' ! class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' *************** *** 195,201 **** alias._superclassnames = ['item'] alias._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, ! 'version' : version, } alias._privelemdict = { --- 195,201 ---- alias._superclassnames = ['item'] alias._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, ! 'version' : _Prop_version, } alias._privelemdict = { *************** *** 207,219 **** disk._superclassnames = ['item'] disk._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'capacity' : capacity, ! 'ejectable' : ejectable, ! 'format' : format, ! 'free_space' : free_space, ! 'ignore_privileges' : ignore_privileges, ! 'local_volume' : local_volume, ! 'properties' : properties, ! 'startup' : startup, } disk._privelemdict = { --- 207,219 ---- disk._superclassnames = ['item'] disk._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'capacity' : _Prop_capacity, ! 'ejectable' : _Prop_ejectable, ! 'format' : _Prop_format, ! 'free_space' : _Prop_free_space, ! 'ignore_privileges' : _Prop_ignore_privileges, ! 'local_volume' : _Prop_local_volume, ! 'properties' : _Prop_properties, ! 'startup' : _Prop_startup, } disk._privelemdict = { *************** *** 225,230 **** folder._superclassnames = ['item'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, } folder._privelemdict = { --- 225,230 ---- folder._superclassnames = ['item'] folder._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'properties' : _Prop_properties, } folder._privelemdict = { *************** *** 236,253 **** item._superclassnames = [] item._privpropdict = { ! 'POSIX_path' : POSIX_path, ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'busy_status' : busy_status, ! 'creation_date' : creation_date, ! 'displayed_name' : displayed_name, ! 'modification_date' : modification_date, ! 'name' : name, ! 'name_extension' : name_extension, ! 'package_folder' : package_folder, ! 'path' : path, ! 'properties' : properties, ! 'url' : url, ! 'visible' : visible, ! 'volume' : volume, } item._privelemdict = { --- 236,253 ---- item._superclassnames = [] item._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'busy_status' : _Prop_busy_status, ! 'creation_date' : _Prop_creation_date, ! 'displayed_name' : _Prop_displayed_name, ! 'modification_date' : _Prop_modification_date, ! 'name' : _Prop_name, ! 'name_extension' : _Prop_name_extension, ! 'package_folder' : _Prop_package_folder, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'url' : _Prop_url, ! 'visible' : _Prop_visible, ! 'volume' : _Prop_volume, } item._privelemdict = { *************** *** 255,267 **** file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'creator_type' : creator_type, ! 'file_type' : file_type, ! 'physical_size' : physical_size, ! 'product_version' : product_version, ! 'properties' : properties, ! 'size' : size, ! 'stationery' : stationery, ! 'version' : version, } file._privelemdict = { --- 255,267 ---- file._superclassnames = ['item'] file._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'creator_type' : _Prop_creator_type, ! 'file_type' : _Prop_file_type, ! 'physical_size' : _Prop_physical_size, ! 'product_version' : _Prop_product_version, ! 'properties' : _Prop_properties, ! 'size' : _Prop_size, ! 'stationery' : _Prop_stationery, ! 'version' : _Prop_version, } file._privelemdict = { *************** *** 295,335 **** 'cobj' : item, 'file' : file, - } - - _propdeclarations = { - 'ascd' : creation_date, - 'asmo' : modification_date, - 'asty' : file_type, - 'busy' : busy_status, - 'c@#^' : _3c_Inheritance_3e_, - 'capa' : capacity, - 'dfmt' : format, - 'dnam' : displayed_name, - 'extn' : name_extension, - 'fcrt' : creator_type, - 'frsp' : free_space, - 'igpr' : ignore_privileges, - 'isej' : ejectable, - 'isrv' : local_volume, - 'istd' : startup, - 'pALL' : properties, - 'phys' : physical_size, - 'pkgf' : package_folder, - 'pnam' : name, - 'posx' : POSIX_path, - 'ppth' : path, - 'pspd' : stationery, - 'ptsz' : size, - 'pvis' : visible, - 'url ' : url, - 'ver2' : product_version, - 'vers' : version, - 'volu' : volume, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'edfm' : _Enum_edfm, } --- 295,297 ---- Index: Folder_Actions_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Folder_Actions_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Folder_Actions_Suite.py 1 Apr 2003 22:05:02 -0000 1.2 *************** *** 151,175 **** """folder action - An action attached to a folder in the file system """ want = 'foac' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class enabled(aetools.NProperty): """enabled - Is the folder action enabled? """ which = 'enaB' want = 'bool' ! class name(aetools.NProperty): """name - the name of the folder action, which is also the name of the folder """ which = 'pnam' want = 'utxt' ! class path(aetools.NProperty): """path - the path to the folder to which the folder action applies """ which = 'ppth' want = '****' ! class properties(aetools.NProperty): """properties - every property of the folder action """ which = 'pALL' want = '****' ! class volume(aetools.NProperty): """volume - the volume on which the folder action resides """ which = 'volu' --- 151,175 ---- """folder action - An action attached to a folder in the file system """ want = 'foac' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_enabled(aetools.NProperty): """enabled - Is the folder action enabled? """ which = 'enaB' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the folder action, which is also the name of the folder """ which = 'pnam' want = 'utxt' ! class _Prop_path(aetools.NProperty): """path - the path to the folder to which the folder action applies """ which = 'ppth' want = '****' ! class _Prop_properties(aetools.NProperty): """properties - every property of the folder action """ which = 'pALL' want = '****' ! class _Prop_volume(aetools.NProperty): """volume - the volume on which the folder action resides """ which = 'volu' *************** *** 182,186 **** """script - A script invoked by a folder action """ want = 'scpt' ! class POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the disk """ which = 'posx' --- 182,186 ---- """script - A script invoked by a folder action """ want = 'scpt' ! class _Prop_POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the disk """ which = 'posx' *************** *** 191,200 **** folder_action._superclassnames = ['item'] folder_action._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'enabled' : enabled, ! 'name' : name, ! 'path' : path, ! 'properties' : properties, ! 'volume' : volume, } folder_action._privelemdict = { --- 191,200 ---- folder_action._superclassnames = ['item'] folder_action._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'enabled' : _Prop_enabled, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, ! 'volume' : _Prop_volume, } folder_action._privelemdict = { *************** *** 203,211 **** script._superclassnames = ['item'] script._privpropdict = { ! 'POSIX_path' : POSIX_path, ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'name' : name, ! 'path' : path, ! 'properties' : properties, } script._privelemdict = { --- 203,211 ---- script._superclassnames = ['item'] script._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'name' : _Prop_name, ! 'path' : _Prop_path, ! 'properties' : _Prop_properties, } script._privelemdict = { *************** *** 226,245 **** 'foac' : folder_action, 'scpt' : script, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'enaB' : enabled, - 'pALL' : properties, - 'pnam' : name, - 'posx' : POSIX_path, - 'ppth' : path, - 'volu' : volume, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'actn' : _Enum_actn, } --- 226,228 ---- Index: Hidden_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Hidden_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Hidden_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Hidden_Suite.py 1 Apr 2003 22:05:03 -0000 1.2 *************** *** 40,50 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 40,41 ---- Index: Login_Items_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Login_Items_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Login_Items_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Login_Items_Suite.py 1 Apr 2003 22:05:03 -0000 1.2 *************** *** 19,39 **** """login item - an item to be launched or opened at login """ want = 'logi' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class hidden(aetools.NProperty): """hidden - Is the Login Item hidden when launched? """ which = 'hidn' want = 'bool' ! class kind(aetools.NProperty): """kind - the file type of the Login Item """ which = 'kind' want = 'utxt' ! class name(aetools.NProperty): """name - the name of the Login Item """ which = 'pnam' want = 'utxt' ! class path(aetools.NProperty): """path - the file system path to the Login Item """ which = 'ppth' --- 19,39 ---- """login item - an item to be launched or opened at login """ want = 'logi' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_hidden(aetools.NProperty): """hidden - Is the Login Item hidden when launched? """ which = 'hidn' want = 'bool' ! class _Prop_kind(aetools.NProperty): """kind - the file type of the Login Item """ which = 'kind' want = 'utxt' ! class _Prop_name(aetools.NProperty): """name - the name of the Login Item """ which = 'pnam' want = 'utxt' ! class _Prop_path(aetools.NProperty): """path - the file system path to the Login Item """ which = 'ppth' *************** *** 44,52 **** login_item._superclassnames = ['item'] login_item._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'hidden' : hidden, ! 'kind' : kind, ! 'name' : name, ! 'path' : path, } login_item._privelemdict = { --- 44,52 ---- login_item._superclassnames = ['item'] login_item._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'hidden' : _Prop_hidden, ! 'kind' : _Prop_kind, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } login_item._privelemdict = { *************** *** 58,74 **** _classdeclarations = { 'logi' : login_item, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'hidn' : hidden, - 'kind' : kind, - 'pnam' : name, - 'ppth' : path, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 58,60 ---- Index: Power_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Power_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Power_Suite.py 1 Apr 2003 22:05:05 -0000 1.2 *************** *** 79,89 **** _classdeclarations = { } - - _propdeclarations = { - } - - _compdeclarations = { - } - - _enumdeclarations = { - } --- 79,80 ---- Index: Processes_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Processes_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Processes_Suite.py 1 Apr 2003 22:05:06 -0000 1.2 *************** *** 228,232 **** """browser - A browser belonging to a window """ want = 'broW' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' --- 228,232 ---- """browser - A browser belonging to a window """ want = 'broW' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' *************** *** 1207,1211 **** """application process - A process launched from an application file """ want = 'pcap' ! class application_file(aetools.NProperty): """application file - a reference to the application file from which this process was launched """ which = 'appf' --- 1207,1211 ---- """application process - A process launched from an application file """ want = 'pcap' ! class _Prop_application_file(aetools.NProperty): """application file - a reference to the application file from which this process was launched """ which = 'appf' *************** *** 1260,1264 **** """desk accessory process - A process launched from an desk accessory file """ want = 'pcda' ! class desk_accessory_file(aetools.NProperty): """desk accessory file - a reference to the desk accessory file from which this process was launched """ which = 'dafi' --- 1260,1264 ---- """desk accessory process - A process launched from an desk accessory file """ want = 'pcda' ! class _Prop_desk_accessory_file(aetools.NProperty): """desk accessory file - a reference to the desk accessory file from which this process was launched """ which = 'dafi' *************** *** 1360,1416 **** """process - A process running on this computer """ want = 'prcs' ! class Classic(aetools.NProperty): """Classic - Is the process running in the Classic environment? """ which = 'clsc' want = 'bool' ! class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'utxt' ! class displayed_name(aetools.NProperty): """displayed name - the name of the file from which the process was launched, as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = '****' ! class file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'utxt' ! class frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process """ which = 'pisf' want = 'bool' ! class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'utxt' ! class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'magn' ! class properties(aetools.NProperty): """properties - every property of the process """ which = 'pALL' want = '****' ! class total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'magn' ! class visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' --- 1360,1416 ---- """process - A process running on this computer """ want = 'prcs' ! class _Prop_Classic(aetools.NProperty): """Classic - Is the process running in the Classic environment? """ which = 'clsc' want = 'bool' ! class _Prop_accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' ! class _Prop_accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' ! class _Prop_creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'utxt' ! class _Prop_displayed_name(aetools.NProperty): """displayed name - the name of the file from which the process was launched, as displayed in the User Interface """ which = 'dnam' want = 'utxt' ! class _Prop_file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = '****' ! class _Prop_file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'utxt' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process """ which = 'pisf' want = 'bool' ! class _Prop_has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'utxt' ! class _Prop_partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'magn' ! class _Prop_properties(aetools.NProperty): """properties - every property of the process """ which = 'pALL' want = '****' ! class _Prop_total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'magn' ! class _Prop_visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' *************** *** 2315,2375 **** """UI element - A piece of the user interface of a process """ want = 'uiel' ! class class_(aetools.NProperty): """class - the class of the UI Element, which identifies it function """ which = 'pcls' want = 'type' ! class description(aetools.NProperty): """description - a more complete description of the UI element and its capabilities """ which = 'desc' want = 'utxt' ! class enabled(aetools.NProperty): """enabled - Is the UI element enabled? ( Does it accept clicks? ) """ which = 'enab' want = 'bool' ! class focused(aetools.NProperty): """focused - Is the focus on this UI element? """ which = 'focu' want = 'bool' ! class help(aetools.NProperty): """help - an encoded description of the UI element and its capabilities """ which = 'help' want = 'utxt' ! class maximum(aetools.NProperty): """maximum - the maximum vale that the UI element can take on """ which = 'maxi' want = 'long' ! class minimum(aetools.NProperty): """minimum - the minimum vale that the UI element can take on """ which = 'mini' want = 'long' ! class orientation(aetools.NProperty): """orientation - the orientation of the UI element """ which = 'orie' want = 'utxt' ! class position(aetools.NProperty): """position - the position of the UI element """ which = 'posn' want = 'QDpt' ! class role(aetools.NProperty): """role - an encoded description of the UI element and its capabilities """ which = 'role' want = 'utxt' ! class selected(aetools.NProperty): """selected - Is the UI element selected? """ which = 'selE' want = '****' ! class size(aetools.NProperty): """size - the size of the UI element """ which = 'ptsz' want = 'QDpt' ! class subrole(aetools.NProperty): """subrole - an encoded description of the UI element and its capabilities """ which = 'sbrl' want = 'utxt' ! class title(aetools.NProperty): """title - the title of the UI element as it appears on the screen """ which = 'titl' want = 'utxt' ! class value(aetools.NProperty): """value - the current value of the UI element """ which = 'valu' --- 2315,2375 ---- """UI element - A piece of the user interface of a process """ want = 'uiel' ! class _Prop_class_(aetools.NProperty): """class - the class of the UI Element, which identifies it function """ which = 'pcls' want = 'type' ! class _Prop_description(aetools.NProperty): """description - a more complete description of the UI element and its capabilities """ which = 'desc' want = 'utxt' ! class _Prop_enabled(aetools.NProperty): """enabled - Is the UI element enabled? ( Does it accept clicks? ) """ which = 'enab' want = 'bool' ! class _Prop_focused(aetools.NProperty): """focused - Is the focus on this UI element? """ which = 'focu' want = 'bool' ! class _Prop_help(aetools.NProperty): """help - an encoded description of the UI element and its capabilities """ which = 'help' want = 'utxt' ! class _Prop_maximum(aetools.NProperty): """maximum - the maximum vale that the UI element can take on """ which = 'maxi' want = 'long' ! class _Prop_minimum(aetools.NProperty): """minimum - the minimum vale that the UI element can take on """ which = 'mini' want = 'long' ! class _Prop_orientation(aetools.NProperty): """orientation - the orientation of the UI element """ which = 'orie' want = 'utxt' ! class _Prop_position(aetools.NProperty): """position - the position of the UI element """ which = 'posn' want = 'QDpt' ! class _Prop_role(aetools.NProperty): """role - an encoded description of the UI element and its capabilities """ which = 'role' want = 'utxt' ! class _Prop_selected(aetools.NProperty): """selected - Is the UI element selected? """ which = 'selE' want = '****' ! class _Prop_size(aetools.NProperty): """size - the size of the UI element """ which = 'ptsz' want = 'QDpt' ! class _Prop_subrole(aetools.NProperty): """subrole - an encoded description of the UI element and its capabilities """ which = 'sbrl' want = 'utxt' ! class _Prop_title(aetools.NProperty): """title - the title of the UI element as it appears on the screen """ which = 'titl' want = 'utxt' ! class _Prop_value(aetools.NProperty): """value - the current value of the UI element """ which = 'valu' *************** *** 2467,2471 **** browser._superclassnames = ['UI_element'] browser._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } browser._privelemdict = { --- 2467,2471 ---- browser._superclassnames = ['UI_element'] browser._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } browser._privelemdict = { *************** *** 2514,2518 **** busy_indicator._superclassnames = ['UI_element'] busy_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } busy_indicator._privelemdict = { --- 2514,2518 ---- busy_indicator._superclassnames = ['UI_element'] busy_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } busy_indicator._privelemdict = { *************** *** 2561,2565 **** button._superclassnames = ['UI_element'] button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } button._privelemdict = { --- 2561,2565 ---- button._superclassnames = ['UI_element'] button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } button._privelemdict = { *************** *** 2608,2612 **** application._superclassnames = ['UI_element'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } application._privelemdict = { --- 2608,2612 ---- application._superclassnames = ['UI_element'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } application._privelemdict = { *************** *** 2655,2659 **** column._superclassnames = ['UI_element'] column._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } column._privelemdict = { --- 2655,2659 ---- column._superclassnames = ['UI_element'] column._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } column._privelemdict = { *************** *** 2702,2706 **** check_box._superclassnames = ['UI_element'] check_box._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } check_box._privelemdict = { --- 2702,2706 ---- check_box._superclassnames = ['UI_element'] check_box._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } check_box._privelemdict = { *************** *** 2749,2753 **** color_well._superclassnames = ['UI_element'] color_well._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color_well._privelemdict = { --- 2749,2753 ---- color_well._superclassnames = ['UI_element'] color_well._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } color_well._privelemdict = { *************** *** 2796,2800 **** combo_box._superclassnames = ['UI_element'] combo_box._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } combo_box._privelemdict = { --- 2796,2800 ---- combo_box._superclassnames = ['UI_element'] combo_box._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } combo_box._privelemdict = { *************** *** 2843,2847 **** row._superclassnames = ['UI_element'] row._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } row._privelemdict = { --- 2843,2847 ---- row._superclassnames = ['UI_element'] row._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } row._privelemdict = { *************** *** 2890,2894 **** window._superclassnames = ['UI_element'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } window._privelemdict = { --- 2890,2894 ---- window._superclassnames = ['UI_element'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } window._privelemdict = { *************** *** 2969,2973 **** drawer._superclassnames = ['UI_element'] drawer._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } drawer._privelemdict = { --- 2969,2973 ---- drawer._superclassnames = ['UI_element'] drawer._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } drawer._privelemdict = { *************** *** 3016,3020 **** grow_area._superclassnames = ['UI_element'] grow_area._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } grow_area._privelemdict = { --- 3016,3020 ---- grow_area._superclassnames = ['UI_element'] grow_area._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } grow_area._privelemdict = { *************** *** 3063,3067 **** image._superclassnames = ['UI_element'] image._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } image._privelemdict = { --- 3063,3067 ---- image._superclassnames = ['UI_element'] image._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } image._privelemdict = { *************** *** 3110,3114 **** incrementor._superclassnames = ['UI_element'] incrementor._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } incrementor._privelemdict = { --- 3110,3114 ---- incrementor._superclassnames = ['UI_element'] incrementor._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } incrementor._privelemdict = { *************** *** 3157,3161 **** list._superclassnames = ['UI_element'] list._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } list._privelemdict = { --- 3157,3161 ---- list._superclassnames = ['UI_element'] list._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } list._privelemdict = { *************** *** 3204,3208 **** menu_bar._superclassnames = ['UI_element'] menu_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu_bar._privelemdict = { --- 3204,3208 ---- menu_bar._superclassnames = ['UI_element'] menu_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu_bar._privelemdict = { *************** *** 3252,3256 **** menu_button._superclassnames = ['UI_element'] menu_button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu_button._privelemdict = { --- 3252,3256 ---- menu_button._superclassnames = ['UI_element'] menu_button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu_button._privelemdict = { *************** *** 3299,3303 **** menu._superclassnames = ['UI_element'] menu._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu._privelemdict = { --- 3299,3303 ---- menu._superclassnames = ['UI_element'] menu._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu._privelemdict = { *************** *** 3347,3351 **** menu_item._superclassnames = ['UI_element'] menu_item._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } menu_item._privelemdict = { --- 3347,3351 ---- menu_item._superclassnames = ['UI_element'] menu_item._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } menu_item._privelemdict = { *************** *** 3395,3399 **** outline._superclassnames = ['UI_element'] outline._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } outline._privelemdict = { --- 3395,3399 ---- outline._superclassnames = ['UI_element'] outline._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } outline._privelemdict = { *************** *** 3442,3447 **** application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'application_file' : application_file, } application_process._privelemdict = { --- 3442,3447 ---- application_process._superclassnames = ['process'] application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'application_file' : _Prop_application_file, } application_process._privelemdict = { *************** *** 3492,3497 **** desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'desk_accessory_file' : desk_accessory_file, } desk_accessory_process._privelemdict = { --- 3492,3497 ---- desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'desk_accessory_file' : _Prop_desk_accessory_file, } desk_accessory_process._privelemdict = { *************** *** 3542,3546 **** pop_up_button._superclassnames = ['UI_element'] pop_up_button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } pop_up_button._privelemdict = { --- 3542,3546 ---- pop_up_button._superclassnames = ['UI_element'] pop_up_button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } pop_up_button._privelemdict = { *************** *** 3589,3607 **** process._superclassnames = ['UI_element'] process._privpropdict = { ! 'Classic' : Classic, ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'accepts_high_level_events' : accepts_high_level_events, ! 'accepts_remote_events' : accepts_remote_events, ! 'creator_type' : creator_type, ! 'displayed_name' : displayed_name, ! 'file' : file, ! 'file_type' : file_type, ! 'frontmost' : frontmost, ! 'has_scripting_terminology' : has_scripting_terminology, ! 'name' : name, ! 'partition_space_used' : partition_space_used, ! 'properties' : properties, ! 'total_partition_size' : total_partition_size, ! 'visible' : visible, } process._privelemdict = { --- 3589,3607 ---- process._superclassnames = ['UI_element'] process._privpropdict = { ! 'Classic' : _Prop_Classic, ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'accepts_high_level_events' : _Prop_accepts_high_level_events, ! 'accepts_remote_events' : _Prop_accepts_remote_events, ! 'creator_type' : _Prop_creator_type, ! 'displayed_name' : _Prop_displayed_name, ! 'file' : _Prop_file, ! 'file_type' : _Prop_file_type, ! 'frontmost' : _Prop_frontmost, ! 'has_scripting_terminology' : _Prop_has_scripting_terminology, ! 'name' : _Prop_name, ! 'partition_space_used' : _Prop_partition_space_used, ! 'properties' : _Prop_properties, ! 'total_partition_size' : _Prop_total_partition_size, ! 'visible' : _Prop_visible, } process._privelemdict = { *************** *** 3652,3656 **** progress_indicator._superclassnames = ['UI_element'] progress_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } progress_indicator._privelemdict = { --- 3652,3656 ---- progress_indicator._superclassnames = ['UI_element'] progress_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } progress_indicator._privelemdict = { *************** *** 3699,3703 **** radio_button._superclassnames = ['UI_element'] radio_button._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } radio_button._privelemdict = { --- 3699,3703 ---- radio_button._superclassnames = ['UI_element'] radio_button._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } radio_button._privelemdict = { *************** *** 3746,3750 **** relevance_indicator._superclassnames = ['UI_element'] relevance_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } relevance_indicator._privelemdict = { --- 3746,3750 ---- relevance_indicator._superclassnames = ['UI_element'] relevance_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } relevance_indicator._privelemdict = { *************** *** 3793,3797 **** radio_group._superclassnames = ['UI_element'] radio_group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } radio_group._privelemdict = { --- 3793,3797 ---- radio_group._superclassnames = ['UI_element'] radio_group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } radio_group._privelemdict = { *************** *** 3841,3845 **** scroll_area._superclassnames = ['UI_element'] scroll_area._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } scroll_area._privelemdict = { --- 3841,3845 ---- scroll_area._superclassnames = ['UI_element'] scroll_area._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } scroll_area._privelemdict = { *************** *** 3888,3892 **** scroll_bar._superclassnames = ['UI_element'] scroll_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } scroll_bar._privelemdict = { --- 3888,3892 ---- scroll_bar._superclassnames = ['UI_element'] scroll_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } scroll_bar._privelemdict = { *************** *** 3937,3941 **** group._superclassnames = ['UI_element'] group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } group._privelemdict = { --- 3937,3941 ---- group._superclassnames = ['UI_element'] group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } group._privelemdict = { *************** *** 3986,3990 **** sheet._superclassnames = ['UI_element'] sheet._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } sheet._privelemdict = { --- 3986,3990 ---- sheet._superclassnames = ['UI_element'] sheet._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } sheet._privelemdict = { *************** *** 4033,4037 **** slider._superclassnames = ['UI_element'] slider._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } slider._privelemdict = { --- 4033,4037 ---- slider._superclassnames = ['UI_element'] slider._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } slider._privelemdict = { *************** *** 4080,4084 **** splitter_group._superclassnames = ['UI_element'] splitter_group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } splitter_group._privelemdict = { --- 4080,4084 ---- splitter_group._superclassnames = ['UI_element'] splitter_group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } splitter_group._privelemdict = { *************** *** 4127,4131 **** splitter._superclassnames = ['UI_element'] splitter._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } splitter._privelemdict = { --- 4127,4131 ---- splitter._superclassnames = ['UI_element'] splitter._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } splitter._privelemdict = { *************** *** 4174,4178 **** static_text._superclassnames = ['UI_element'] static_text._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } static_text._privelemdict = { --- 4174,4178 ---- static_text._superclassnames = ['UI_element'] static_text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } static_text._privelemdict = { *************** *** 4222,4226 **** system_wide_UI_element._superclassnames = ['UI_element'] system_wide_UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } system_wide_UI_element._privelemdict = { --- 4222,4226 ---- system_wide_UI_element._superclassnames = ['UI_element'] system_wide_UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } system_wide_UI_element._privelemdict = { *************** *** 4269,4273 **** tab_group._superclassnames = ['UI_element'] tab_group._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } tab_group._privelemdict = { --- 4269,4273 ---- tab_group._superclassnames = ['UI_element'] tab_group._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } tab_group._privelemdict = { *************** *** 4316,4320 **** table._superclassnames = ['UI_element'] table._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } table._privelemdict = { --- 4316,4320 ---- table._superclassnames = ['UI_element'] table._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } table._privelemdict = { *************** *** 4363,4367 **** tool_bar._superclassnames = ['UI_element'] tool_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } tool_bar._privelemdict = { --- 4363,4367 ---- tool_bar._superclassnames = ['UI_element'] tool_bar._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } tool_bar._privelemdict = { *************** *** 4410,4414 **** text_area._superclassnames = ['UI_element'] text_area._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } text_area._privelemdict = { --- 4410,4414 ---- text_area._superclassnames = ['UI_element'] text_area._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } text_area._privelemdict = { *************** *** 4457,4461 **** text_field._superclassnames = ['UI_element'] text_field._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } text_field._privelemdict = { --- 4457,4461 ---- text_field._superclassnames = ['UI_element'] text_field._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } text_field._privelemdict = { *************** *** 4505,4525 **** UI_element._superclassnames = ['item'] UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'class_' : class_, ! 'description' : description, ! 'enabled' : enabled, ! 'focused' : focused, ! 'help' : help, ! 'maximum' : maximum, ! 'minimum' : minimum, ! 'name' : name, ! 'orientation' : orientation, ! 'position' : position, ! 'role' : role, ! 'selected' : selected, ! 'size' : size, ! 'subrole' : subrole, ! 'title' : title, ! 'value' : value, } UI_element._privelemdict = { --- 4505,4525 ---- UI_element._superclassnames = ['item'] UI_element._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'class_' : _Prop_class_, ! 'description' : _Prop_description, ! 'enabled' : _Prop_enabled, ! 'focused' : _Prop_focused, ! 'help' : _Prop_help, ! 'maximum' : _Prop_maximum, ! 'minimum' : _Prop_minimum, ! 'name' : _Prop_name, ! 'orientation' : _Prop_orientation, ! 'position' : _Prop_position, ! 'role' : _Prop_role, ! 'selected' : _Prop_selected, ! 'size' : _Prop_size, ! 'subrole' : _Prop_subrole, ! 'title' : _Prop_title, ! 'value' : _Prop_value, } UI_element._privelemdict = { *************** *** 4568,4572 **** value_indicator._superclassnames = ['UI_element'] value_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } value_indicator._privelemdict = { --- 4568,4572 ---- value_indicator._superclassnames = ['UI_element'] value_indicator._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } value_indicator._privelemdict = { *************** *** 4676,4721 **** 'uiel' : UI_element, 'vali' : value_indicator, - } - - _propdeclarations = { - 'appf' : application_file, - 'appt' : total_partition_size, - 'asty' : file_type, - 'c@#^' : _3c_Inheritance_3e_, - 'clsc' : Classic, - 'dafi' : desk_accessory_file, - 'desc' : description, - 'dnam' : displayed_name, - 'enab' : enabled, - 'fcrt' : creator_type, - 'file' : file, - 'focu' : focused, - 'help' : help, - 'hscr' : has_scripting_terminology, - 'isab' : accepts_high_level_events, - 'maxi' : maximum, - 'mini' : minimum, - 'orie' : orientation, - 'pALL' : properties, - 'pcls' : class_, - 'pisf' : frontmost, - 'pnam' : name, - 'posn' : position, - 'ptsz' : size, - 'pusd' : partition_space_used, - 'pvis' : visible, - 'revt' : accepts_remote_events, - 'role' : role, - 'sbrl' : subrole, - 'selE' : selected, - 'titl' : title, - 'valu' : value, - } - - _compdeclarations = { - } - - _enumdeclarations = { - 'eMds' : _Enum_eMds, - 'eMky' : _Enum_eMky, } --- 4676,4678 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Standard_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 334,350 **** """application - An application's top level scripting object. """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class version(aetools.NProperty): """version - The version of the application. """ which = 'vers' --- 334,350 ---- """application - An application's top level scripting object. """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' ! class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' ! class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' ! class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' *************** *** 358,366 **** """item - A scriptable object. """ want = 'cobj' ! class class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' --- 358,366 ---- """item - A scriptable object. """ want = 'cobj' ! class _Prop_class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' ! class _Prop_properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' *************** *** 378,434 **** """window - A window. """ want = 'cwin' ! class bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' --- 378,434 ---- """window - A window. """ want = 'cwin' ! class _Prop_bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' ! class _Prop_closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' ! class _Prop_document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' ! class _Prop_floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' ! class _Prop_id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' ! class _Prop_index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' ! class _Prop_miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' ! class _Prop_miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' ! class _Prop_modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' ! class _Prop_resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' ! class _Prop_titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' ! class _Prop_visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' ! class _Prop_zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' ! class _Prop_zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' *************** *** 440,448 **** """document - A document. """ want = 'docu' ! class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class path(aetools.NProperty): """path - The document's path. """ which = 'ppth' --- 440,448 ---- """document - A document. """ want = 'docu' ! class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' ! class _Prop_path(aetools.NProperty): """path - The document's path. """ which = 'ppth' *************** *** 452,459 **** application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'frontmost' : frontmost, ! 'name' : name, ! 'version' : version, } application._privelemdict = { --- 452,459 ---- application._superclassnames = ['item'] application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'frontmost' : _Prop_frontmost, ! 'name' : _Prop_name, ! 'version' : _Prop_version, } application._privelemdict = { *************** *** 463,468 **** item._superclassnames = [] item._privpropdict = { ! 'class_' : class_, ! 'properties' : properties, } item._privelemdict = { --- 463,468 ---- item._superclassnames = [] item._privpropdict = { ! 'class_' : _Prop_class_, ! 'properties' : _Prop_properties, } item._privelemdict = { *************** *** 470,474 **** color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color._privelemdict = { --- 470,474 ---- color._superclassnames = ['item'] color._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, } color._privelemdict = { *************** *** 476,495 **** window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'bounds' : bounds, ! 'closeable' : closeable, ! 'document' : document, ! 'floating' : floating, ! 'id' : id, ! 'index' : index, ! 'miniaturizable' : miniaturizable, ! 'miniaturized' : miniaturized, ! 'modal' : modal, ! 'name' : name, ! 'resizable' : resizable, ! 'titled' : titled, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { --- 476,495 ---- window._superclassnames = ['item'] window._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'bounds' : _Prop_bounds, ! 'closeable' : _Prop_closeable, ! 'document' : _Prop_document, ! 'floating' : _Prop_floating, ! 'id' : _Prop_id, ! 'index' : _Prop_index, ! 'miniaturizable' : _Prop_miniaturizable, ! 'miniaturized' : _Prop_miniaturized, ! 'modal' : _Prop_modal, ! 'name' : _Prop_name, ! 'resizable' : _Prop_resizable, ! 'titled' : _Prop_titled, ! 'visible' : _Prop_visible, ! 'zoomable' : _Prop_zoomable, ! 'zoomed' : _Prop_zoomed, } window._privelemdict = { *************** *** 497,504 **** document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'modified' : modified, ! 'name' : name, ! 'path' : path, } document._privelemdict = { --- 497,504 ---- document._superclassnames = ['item'] document._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'modified' : _Prop_modified, ! 'name' : _Prop_name, ! 'path' : _Prop_path, } document._privelemdict = { *************** *** 536,578 **** 'cwin' : window, 'docu' : document, - } - - _propdeclarations = { - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'docu' : document, - 'hclb' : closeable, - 'imod' : modified, - 'isfl' : floating, - 'ismn' : miniaturizable, - 'iszm' : zoomable, - 'pALL' : properties, - 'pbnd' : bounds, - 'pcls' : class_, - 'pidx' : index, - 'pisf' : frontmost, - 'pmnd' : miniaturized, - 'pmod' : modal, - 'pnam' : name, - 'ppth' : path, - 'prsz' : resizable, - 'ptit' : titled, - 'pvis' : visible, - 'pzum' : zoomed, - 'vers' : version, - } - - _compdeclarations = { - '< ' : _3c_, - '<= ' : _b2_, - '= ' : _3d_, - '> ' : _3e_, - '>= ' : _b3_, - 'bgwt' : starts_with, - 'cont' : contains, - 'ends' : ends_with, - } - - _enumdeclarations = { - 'savo' : _Enum_savo, } --- 536,538 ---- Index: System_Events_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** System_Events_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- System_Events_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 19,35 **** """application - The System Events application """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class folder_actions_enabled(aetools.NProperty): """folder actions enabled - Are Folder Actions currently being processed? """ which = 'faen' want = 'bool' ! class properties(aetools.NProperty): """properties - every property of the System Events application """ which = 'pALL' want = '****' ! class system_wide_UI_element(aetools.NProperty): """system wide UI element - the UI element for the entire system """ which = 'swui' --- 19,35 ---- """application - The System Events application """ want = 'capp' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'capp' ! class _Prop_folder_actions_enabled(aetools.NProperty): """folder actions enabled - Are Folder Actions currently being processed? """ which = 'faen' want = 'bool' ! class _Prop_properties(aetools.NProperty): """properties - every property of the System Events application """ which = 'pALL' want = '****' ! class _Prop_system_wide_UI_element(aetools.NProperty): """system wide UI element - the UI element for the entire system """ which = 'swui' *************** *** 57,64 **** import Processes_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'folder_actions_enabled' : folder_actions_enabled, ! 'properties' : properties, ! 'system_wide_UI_element' : system_wide_UI_element, } application._privelemdict = { --- 57,64 ---- import Processes_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'folder_actions_enabled' : _Prop_folder_actions_enabled, ! 'properties' : _Prop_properties, ! 'system_wide_UI_element' : _Prop_system_wide_UI_element, } application._privelemdict = { *************** *** 83,98 **** _classdeclarations = { 'capp' : application, - } - - _propdeclarations = { - 'c@#^' : _3c_Inheritance_3e_, - 'faen' : folder_actions_enabled, - 'pALL' : properties, - 'swui' : system_wide_UI_element, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 83,85 ---- Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Text_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text_Suite.py 30 Mar 2003 22:41:52 -0000 1.1 --- Text_Suite.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 19,27 **** """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' --- 19,27 ---- """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' ! class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' ! class _Prop_file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' *************** *** 35,47 **** """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' --- 35,47 ---- """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' ! class _Prop_color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' ! class _Prop_font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' ! class _Prop_size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' *************** *** 93,98 **** attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'file_name' : file_name, } attachment._privelemdict = { --- 93,98 ---- attachment._superclassnames = ['text'] attachment._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'file_name' : _Prop_file_name, } attachment._privelemdict = { *************** *** 105,112 **** attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } attribute_run._privelemdict = { --- 105,112 ---- attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } attribute_run._privelemdict = { *************** *** 118,125 **** character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } character._privelemdict = { --- 118,125 ---- character._superclassnames = ['item'] character._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } character._privelemdict = { *************** *** 131,138 **** paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } paragraph._privelemdict = { --- 131,138 ---- paragraph._superclassnames = ['item'] paragraph._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } paragraph._privelemdict = { *************** *** 144,151 **** text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } text._privelemdict = { --- 144,151 ---- text._superclassnames = ['item'] text._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } text._privelemdict = { *************** *** 157,164 **** word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'color' : color, ! 'font' : font, ! 'size' : size, } word._privelemdict = { --- 157,164 ---- word._superclassnames = ['item'] word._privpropdict = { ! '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, ! 'color' : _Prop_color, ! 'font' : _Prop_font, ! 'size' : _Prop_size, } word._privelemdict = { *************** *** 179,195 **** 'ctxt' : text, 'cwor' : word, - } - - _propdeclarations = { - 'atfn' : file_name, - 'c@#^' : _3c_Inheritance_3e_, - 'colr' : color, - 'font' : font, - 'ptsz' : size, - } - - _compdeclarations = { - } - - _enumdeclarations = { } --- 179,181 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Mar 2003 22:41:52 -0000 1.1 --- __init__.py 1 Apr 2003 22:05:09 -0000 1.2 *************** *** 74,79 **** getbaseclasses(attribute_run) getbaseclasses(text) - getbaseclasses(script) - getbaseclasses(folder_action) getbaseclasses(file) getbaseclasses(alias) --- 74,77 ---- *************** *** 86,130 **** getbaseclasses(item) getbaseclasses(document) ! getbaseclasses(login_item) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) ! getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.color_table) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) ! getbaseclasses(StdSuites.Type_Names_Suite.machine_location) ! getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.point) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.menu_item) ! getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) ! getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.menu) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) ! getbaseclasses(StdSuites.Type_Names_Suite.rotation) ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.long_point) ! getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) ! getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) ! getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) ! getbaseclasses(StdSuites.Type_Names_Suite.extended_real) ! getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) ! getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) getbaseclasses(window) getbaseclasses(radio_button) --- 84,89 ---- getbaseclasses(item) getbaseclasses(document) ! getbaseclasses(script) ! getbaseclasses(folder_action) getbaseclasses(window) getbaseclasses(radio_button) *************** *** 171,175 **** --- 130,175 ---- getbaseclasses(combo_box) getbaseclasses(browser) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.string) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) getbaseclasses(application) + getbaseclasses(login_item) # *************** *** 183,188 **** 'catr' : attribute_run, 'ctxt' : text, - 'scpt' : script, - 'foac' : folder_action, 'file' : file, 'alis' : alias, --- 183,186 ---- *************** *** 195,239 **** 'cobj' : item, 'docu' : document, ! 'logi' : login_item, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, 'cwin' : window, 'radB' : radio_button, --- 193,198 ---- 'cobj' : item, 'docu' : document, ! 'scpt' : script, ! 'foac' : folder_action, 'cwin' : window, 'radB' : radio_button, *************** *** 280,284 **** --- 239,284 ---- 'comB' : combo_box, 'broW' : browser, + 'comp' : StdSuites.Type_Names_Suite.double_integer, + 'vers' : StdSuites.Type_Names_Suite.version, + 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, + 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, + 'clrt' : StdSuites.Type_Names_Suite.color_table, + 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, + 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, + 'elin' : StdSuites.Type_Names_Suite.type_element_info, + 'evin' : StdSuites.Type_Names_Suite.type_event_info, + 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, + 'cmen' : StdSuites.Type_Names_Suite.menu_item, + 'styl' : StdSuites.Type_Names_Suite.scrap_styles, + 'aete' : StdSuites.Type_Names_Suite.application_dictionary, + 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, + 'cmnu' : StdSuites.Type_Names_Suite.menu, + 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, + 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, + 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, + 'suin' : StdSuites.Type_Names_Suite.type_suite_info, + 'trot' : StdSuites.Type_Names_Suite.rotation, + 'shor' : StdSuites.Type_Names_Suite.small_integer, + 'fixd' : StdSuites.Type_Names_Suite.fixed, + 'lpnt' : StdSuites.Type_Names_Suite.long_point, + 'gcli' : StdSuites.Type_Names_Suite.type_class_info, + 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, + 'targ' : StdSuites.Type_Names_Suite.target_id, + 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, + 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, + 'exte' : StdSuites.Type_Names_Suite.extended_real, + 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, + 'tdas' : StdSuites.Type_Names_Suite.dash_style, + 'TEXT' : StdSuites.Type_Names_Suite.string, + 'sing' : StdSuites.Type_Names_Suite.small_real, + 'null' : StdSuites.Type_Names_Suite.null, + 'insl' : StdSuites.Type_Names_Suite.location_reference, + 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, 'capp' : application, + 'logi' : login_item, } From nnorwitz@users.sourceforge.net Tue Apr 1 22:13:35 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:13:35 -0800 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.14,2.10.8.15 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv25809/Python Modified Files: Tag: ast-branch symtable.c Log Message: initialize ste_tmpname so list comps start at 1 instead of random numbers Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.14 retrieving revision 2.10.8.15 diff -C2 -d -r2.10.8.14 -r2.10.8.15 *** symtable.c 28 Mar 2003 17:22:24 -0000 2.10.8.14 --- symtable.c 1 Apr 2003 22:13:31 -0000 2.10.8.15 *************** *** 20,23 **** --- 20,24 ---- ste->ste_table = st; ste->ste_id = k; + ste->ste_tmpname = 0; ste->ste_name = name; From nnorwitz@users.sourceforge.net Tue Apr 1 22:17:08 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:17:08 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.49,1.1.2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv26806/Python Modified Files: Tag: ast-branch newcompile.c Log Message: I get to the prompt with this change. Although importing site still fails. * fix referencing freed memory (b) after a resize * always use compiler_use_next_block() after JUMP_FORWARD this fixes a problem with if 1: try: pass ; except ImportError: pass Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.49 retrieving revision 1.1.2.50 diff -C2 -d -r1.1.2.49 -r1.1.2.50 *** newcompile.c 31 Mar 2003 21:44:31 -0000 1.1.2.49 --- newcompile.c 1 Apr 2003 22:17:00 -0000 1.1.2.50 *************** *** 473,476 **** --- 473,477 ---- fprintf(stderr, "resize block %d\n", block); c->u->u_blocks[block] = (struct basicblock *)ptr; + b = ptr; } } *************** *** 816,820 **** VISIT_SEQ(c, stmt, s->v.If.body); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_block(c, next); ADDOP(c, POP_TOP); if (s->v.If.orelse) { --- 817,821 ---- VISIT_SEQ(c, stmt, s->v.If.body); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_next_block(c, next); ADDOP(c, POP_TOP); if (s->v.If.orelse) { *************** *** 1586,1590 **** int end = compiler_new_block(c); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_block(c, cleanup); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); --- 1587,1591 ---- int end = compiler_new_block(c); ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_next_block(c, cleanup); ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); From nnorwitz@users.sourceforge.net Tue Apr 1 22:17:49 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:17:49 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.23,1.1.2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27840/Python Modified Files: Tag: ast-branch ast.c Log Message: fix one memory leak, doc another, still need to fix XXX comments, remove unnecessary breaks Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -C2 -d -r1.1.2.23 -r1.1.2.24 *** ast.c 31 Mar 2003 21:40:03 -0000 1.1.2.23 --- ast.c 1 Apr 2003 22:17:47 -0000 1.1.2.24 *************** *** 534,537 **** --- 534,538 ---- ch = CHILD(ch, 2); } + /* XXX ifs is leaked, we surely have to do something with it */ /* on exit, must guarantee that ch is a list_for */ if (TYPE(ch) == list_iter) *************** *** 770,780 **** case PLUS: return UnaryOp(UAdd, ast_for_expr(CHILD(n, 1))); - break; case MINUS: return UnaryOp(USub, ast_for_expr(CHILD(n, 1))); - break; case TILDE: return UnaryOp(Invert, ast_for_expr(CHILD(n, 1))); - break; } break; --- 771,778 ---- *************** *** 820,824 **** } return e; - break; } default: --- 818,821 ---- *************** *** 1106,1113 **** } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ alias_ty mod = alias_for_import_name(CHILD(n, 1)); aliases = asdl_seq_new((NCH(n) - 2) / 2); for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); ! return ImportFrom(mod->name, aliases, LINENO(n)); } return NULL; --- 1103,1115 ---- } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ alias_ty mod = alias_for_import_name(CHILD(n, 1)); + stmt_ty import; aliases = asdl_seq_new((NCH(n) - 2) / 2); for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); ! import = ImportFrom(mod->name, aliases, LINENO(n)); ! /* XXX we should probably not be using PyObject_Free directly ! should we use asdl_seq_free? we need to cast if so */ ! PyObject_Free(mod); ! return import; } return NULL; From jackjansen@users.sourceforge.net Tue Apr 1 22:30:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:30:29 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation scripting.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv570 Modified Files: scripting.html Log Message: The minimal scripting example now actually works. Index: scripting.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scripting.html 31 Mar 2003 15:10:46 -0000 1.1 --- scripting.html 1 Apr 2003 22:30:23 -0000 1.2 *************** *** 15,32 **** Architecure (OSA, also commonly referred to as AppleScript), allowing you to control scriptable applications from your Python program, ! and with a fairly pythonic interface. The following pieces of ! AppleScript and Python are rougly identical (XXXX Not true right now!):

- tell application "Finder"
- 	get name of window 1
- end tell
- 
- -
  import Finder
  
  f = Finder.Finder()
  print f.get(Finder.window(1).name)
  
--- 15,34 ---- Architecure (OSA, also commonly referred to as AppleScript), allowing you to control scriptable applications from your Python program, ! and with a fairly pythonic interface. This piece of ! Python:

  import Finder
  
  f = Finder.Finder()
  print f.get(Finder.window(1).name)
+ 
+ +

is identical to the following piece of AppleScript:

+ +
+ tell application "Finder"
+ 	get name of window 1
+ end tell
  
From jackjansen@users.sourceforge.net Tue Apr 1 22:33:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:33:41 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.708,1.709 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1802 Modified Files: NEWS Log Message: Added a note about scripting support and the IDE builtin help. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.708 retrieving revision 1.709 diff -C2 -d -r1.708 -r1.709 *** NEWS 31 Mar 2003 18:07:36 -0000 1.708 --- NEWS 1 Apr 2003 22:33:37 -0000 1.709 *************** *** 150,153 **** --- 150,159 ---- currently in the background they will ask to be moved to the foreground before displaying. + + - OSA Scripting support has improved a lot, and gensuitemodule.py can now + be used by mere mortals. + + - The IDE (in a framework build) now includes introductory documentation + in Apple Help Viewer format. From jackjansen@users.sourceforge.net Tue Apr 1 22:27:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 01 Apr 2003 14:27:22 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv31003 Modified Files: aetools.py Log Message: Sigh... The get() and set() commands are not declared in the aete for the Standard_Suite, but various other suites do expect it (the Finder implements get() without declaring it itself). It is probably another case of OSA magic. Adding them to the global base class. Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aetools.py 31 Mar 2003 13:29:32 -0000 1.5 --- aetools.py 1 Apr 2003 22:27:18 -0000 1.6 *************** *** 255,278 **** item.__class__ = as return item ! def _set(self, _object, _arguments = {}, _attributes = {}): ! """ _set: set data for an object ! Required argument: the object ! Keyword argument _parameters: Parameter dictionary for the set operation Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the data """ _code = 'core' _subcode = 'setd' ! _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise Error, decodeerror(_arguments) ! if _arguments.has_key('----'): return _arguments['----'] # Tiny Finder class, for local use only --- 255,287 ---- item.__class__ = as return item + + get = _get + + _argmap_set = { + 'to' : 'data', + } ! def _set(self, _object, _attributes={}, **_arguments): ! """set: Set an object's data. ! Required argument: the object for the command ! Keyword argument to: The new value. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'setd' ! ! keysubst(_arguments, self._argmap_set) _arguments['----'] = _object + _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] + + set = _set # Tiny Finder class, for local use only From jhylton@users.sourceforge.net Wed Apr 2 04:22:19 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 01 Apr 2003 20:22:19 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.24,1.1.2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2380 Modified Files: Tag: ast-branch ast.c Log Message: Two bugs fixes. When creating Raise() stmts, get CHILD of ch not n! When freeing object for ImportFrom, use free() since Python-ast.c uses malloc(). XXX The asdl_c.py generator should use PyObject_Malloc(). Also add abort() to the default: branches of switches for expr and stmt. These cases should be covered. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.24 retrieving revision 1.1.2.25 diff -C2 -d -r1.1.2.24 -r1.1.2.25 *** ast.c 1 Apr 2003 22:17:47 -0000 1.1.2.24 --- ast.c 2 Apr 2003 04:22:16 -0000 1.1.2.25 *************** *** 821,824 **** --- 821,825 ---- default: fprintf(stderr, "unhandled expr: %d\n", TYPE(n)); + abort(); return NULL; } *************** *** 1004,1018 **** return Raise(NULL, NULL, NULL, LINENO(n)); else if (NCH(ch) == 2) ! return Raise(ast_for_expr(CHILD(n, 1)), NULL, NULL, LINENO(n)); else if (NCH(ch) == 4) ! return Raise(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), NULL, LINENO(n)); else if (NCH(ch) == 6) ! return Raise(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), ! ast_for_expr(CHILD(n, 5)), LINENO(n)); default: fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); return NULL; } --- 1005,1020 ---- return Raise(NULL, NULL, NULL, LINENO(n)); else if (NCH(ch) == 2) ! return Raise(ast_for_expr(CHILD(ch, 1)), NULL, NULL, LINENO(n)); else if (NCH(ch) == 4) ! return Raise(ast_for_expr(CHILD(ch, 1)), ! ast_for_expr(CHILD(ch, 3)), NULL, LINENO(n)); else if (NCH(ch) == 6) ! return Raise(ast_for_expr(CHILD(ch, 1)), ! ast_for_expr(CHILD(ch, 3)), ! ast_for_expr(CHILD(ch, 5)), LINENO(n)); default: fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); + abort(); return NULL; } *************** *** 1108,1114 **** asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); import = ImportFrom(mod->name, aliases, LINENO(n)); ! /* XXX we should probably not be using PyObject_Free directly ! should we use asdl_seq_free? we need to cast if so */ ! PyObject_Free(mod); return import; } --- 1110,1114 ---- asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); import = ImportFrom(mod->name, aliases, LINENO(n)); ! free(mod); return import; } From bwarsaw@users.sourceforge.net Wed Apr 2 04:51:36 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 01 Apr 2003 20:51:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv16075 Modified Files: _compat22.py Log Message: Fix a comment Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _compat22.py 26 Mar 2003 17:57:25 -0000 1.6 --- _compat22.py 2 Apr 2003 04:51:33 -0000 1.7 *************** *** 10,14 **** from types import StringTypes ! # Python 2.2.x where x < 2 lacks True/False try: True, False --- 10,14 ---- from types import StringTypes ! # Python 2.2.x where x < 1 lacks True/False try: True, False From doerwalter@users.sourceforge.net Wed Apr 2 16:37:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:37:26 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.709,1.710 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13323/Misc Modified Files: NEWS Log Message: Change formatchar(), so that u"%c" % 0xffffffff now raises an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.709 retrieving revision 1.710 diff -C2 -d -r1.709 -r1.710 *** NEWS 1 Apr 2003 22:33:37 -0000 1.709 --- NEWS 2 Apr 2003 16:37:23 -0000 1.710 *************** *** 36,40 **** - "%c" % u"a" now returns a unicode string instead of raising a ! TypeError. See SF patch #710127. Extension modules --- 36,41 ---- - "%c" % u"a" now returns a unicode string instead of raising a ! TypeError. u"%c" % 0xffffffff now raises a OverflowError instead ! of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Extension modules From doerwalter@users.sourceforge.net Wed Apr 2 16:37:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:37:26 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.184,2.185 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv13323/Objects Modified Files: unicodeobject.c Log Message: Change formatchar(), so that u"%c" % 0xffffffff now raises an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -d -r2.184 -r2.185 *** unicodeobject.c 9 Mar 2003 07:30:43 -0000 2.184 --- unicodeobject.c 2 Apr 2003 16:37:23 -0000 2.185 *************** *** 6158,6162 **** #ifdef Py_UNICODE_WIDE if (x < 0 || x > 0x10ffff) { ! PyErr_SetString(PyExc_ValueError, "%c arg not in range(0x110000) " "(wide Python build)"); --- 6158,6162 ---- #ifdef Py_UNICODE_WIDE if (x < 0 || x > 0x10ffff) { ! PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000) " "(wide Python build)"); *************** *** 6165,6169 **** #else if (x < 0 || x > 0xffff) { ! PyErr_SetString(PyExc_ValueError, "%c arg not in range(0x10000) " "(narrow Python build)"); --- 6165,6169 ---- #else if (x < 0 || x > 0xffff) { ! PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x10000) " "(narrow Python build)"); From doerwalter@users.sourceforge.net Wed Apr 2 16:37:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:37:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13323/Lib/test Modified Files: test_unicode.py Log Message: Change formatchar(), so that u"%c" % 0xffffffff now raises an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** test_unicode.py 31 Mar 2003 18:18:41 -0000 1.81 --- test_unicode.py 2 Apr 2003 16:37:24 -0000 1.82 *************** *** 361,365 **** self.assertEqual(u'%c' % 0x1234, u'\u1234') ! self.assertRaises(ValueError, u"%c".__mod__, (sys.maxunicode+1,)) # formatting jobs delegated from the string implementation: --- 361,365 ---- self.assertEqual(u'%c' % 0x1234, u'\u1234') ! self.assertRaises(OverflowError, u"%c".__mod__, (sys.maxunicode+1,)) # formatting jobs delegated from the string implementation: From doerwalter@users.sourceforge.net Wed Apr 2 16:58:07 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 02 Apr 2003 08:58:07 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.710,1.711 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26974/Misc Modified Files: NEWS Log Message: Fix description: u"%c" % 0xffffffff returned a ValueError not a TypeError. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.710 retrieving revision 1.711 diff -C2 -d -r1.710 -r1.711 *** NEWS 2 Apr 2003 16:37:23 -0000 1.710 --- NEWS 2 Apr 2003 16:57:59 -0000 1.711 *************** *** 37,41 **** - "%c" % u"a" now returns a unicode string instead of raising a TypeError. u"%c" % 0xffffffff now raises a OverflowError instead ! of a TypeError to be consistent with "%c" % 256. See SF patch #710127. Extension modules --- 37,41 ---- - "%c" % u"a" now returns a unicode string instead of raising a TypeError. u"%c" % 0xffffffff now raises a OverflowError instead ! of a ValueError to be consistent with "%c" % 256. See SF patch #710127. Extension modules From nnorwitz@users.sourceforge.net Thu Apr 3 00:49:04 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 02 Apr 2003 16:49:04 -0800 Subject: [Python-checkins] python/dist/src/Python asdl.c,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv23887/Python Modified Files: Tag: ast-branch asdl.c Log Message: Rename variable l to len Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/asdl.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** asdl.c 3 Sep 2002 22:51:43 -0000 1.1.2.3 --- asdl.c 3 Apr 2003 00:49:02 -0000 1.1.2.4 *************** *** 71,80 **** marshal_write_string(PyObject **buf, int *offset, string s) { ! int l = PyString_GET_SIZE(s); ! marshal_write_int(buf, offset, l); ! CHECKSIZE(buf, offset, l); memcpy(PyString_AS_STRING(*buf) + *offset, ! PyString_AS_STRING(s), l); ! *offset += l; return 1; } --- 71,80 ---- marshal_write_string(PyObject **buf, int *offset, string s) { ! int len = PyString_GET_SIZE(s); ! marshal_write_int(buf, offset, len); ! CHECKSIZE(buf, offset, len); memcpy(PyString_AS_STRING(*buf) + *offset, ! PyString_AS_STRING(s), len); ! *offset += len; return 1; } From nnorwitz@users.sourceforge.net Thu Apr 3 00:51:47 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 02 Apr 2003 16:51:47 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.25,1.1.2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24790/Python Modified Files: Tag: ast-branch ast.c Log Message: Add lots of error checking on malloc failure Remove unnecessary breaks/return which follow a return Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.25 retrieving revision 1.1.2.26 diff -C2 -d -r1.1.2.25 -r1.1.2.26 *** ast.c 2 Apr 2003 04:22:16 -0000 1.1.2.25 --- ast.c 3 Apr 2003 00:51:45 -0000 1.1.2.26 *************** *** 104,107 **** --- 104,109 ---- fprintf(stderr, "file_input containing %d statements\n", total); stmts = asdl_seq_new(total); + if (!stmts) + return NULL; for (i = 0; i < NCH(n) - 1; i++) { ch = CHILD(n, i); *************** *** 129,133 **** case eval_input: return Expression(ast_for_testlist(CHILD(n, 0))); - break; case single_input: if (TYPE(CHILD(n, 0)) == NEWLINE) { --- 131,134 ---- *************** *** 337,342 **** seq = asdl_seq_new((NCH(n) + 1) / 2); ! for (i = 0; i < NCH(n); i += 2) { ! asdl_seq_SET(seq, i / 2, ast_for_expr(CHILD(n, i))); } return seq; --- 338,345 ---- seq = asdl_seq_new((NCH(n) + 1) / 2); ! if (seq) { ! for (i = 0; i < NCH(n); i += 2) { ! asdl_seq_SET(seq, i / 2, ast_for_expr(CHILD(n, i))); ! } } return seq; *************** *** 377,381 **** --- 380,390 ---- } args = n_args ? asdl_seq_new(n_args) : NULL; + if (!args && n_args) + return NULL; defaults = n_defaults? asdl_seq_new(n_defaults) : NULL; + if (!defaults && n_defaults) { + if (args) asdl_seq_free(args); + return NULL; + } /* fpdef: NAME | '(' fplist ')' *************** *** 389,392 **** --- 398,405 ---- if (NCH(ch) == 3) { /* XXX don't handle fplist yet */ + if (args) + asdl_seq_free(args); + if (defaults) + asdl_seq_free(defaults); return NULL; } *************** *** 508,511 **** --- 521,528 ---- n_fors = count_list_fors(n); listcomps = asdl_seq_new(n_fors); + if (!listcomps) { + /* XXX free elt? */ + return NULL; + } ch = CHILD(n, 1); for (i = 0; i < n_fors; i++) { *************** *** 526,529 **** --- 543,551 ---- n_ifs = count_list_ifs(ch); ifs = asdl_seq_new(n_ifs); + if (!ifs) { + /* XXX free elt? */ + asdl_seq_free(listcomps); + return NULL; + } for (j = 0; j < n_ifs; j++) { REQ(ch, list_iter); *************** *** 557,571 **** /* All names start in Load context, but may later be changed. */ return Name(NEW_IDENTIFIER(ch), Load); - break; case STRING: /* XXX parsestrplus can return NULL. */ return Str(parsestrplus(n)); - break; case NUMBER: return Num(parsenumber(STR(ch))); - break; case LPAR: /* some parenthesized expressions */ return ast_for_testlist(CHILD(n, 1)); - break; case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); --- 579,589 ---- *************** *** 587,591 **** --- 605,615 ---- size = (NCH(ch) + 1) / 4; /* plus one in case no trailing comma */ keys = asdl_seq_new(size); + if (!keys) + return NULL; values = asdl_seq_new(size); + if (!values) { + asdl_seq_free(keys); + return NULL; + } for (i = 0; i < NCH(ch); i += 4) { asdl_seq_SET(keys, i / 4, ast_for_expr(CHILD(ch, i))); *************** *** 593,601 **** } return Dict(keys, values); - break; } case BACKQUOTE: /* repr */ return Repr(ast_for_testlist(CHILD(n, 1))); - break; default: fprintf(stderr, "unhandled atom %d\n", TYPE(ch)); --- 617,623 ---- *************** *** 710,713 **** --- 732,737 ---- } seq = asdl_seq_new((NCH(n) + 1) / 2); + if (!seq) + return NULL; for (i = 0; i < NCH(n); i += 2) { expr_ty e = ast_for_expr(CHILD(n, i)); *************** *** 737,741 **** --- 761,771 ---- asdl_seq *ops, *cmps; ops = asdl_seq_new(NCH(n) / 2); + if (!ops) + return NULL; cmps = asdl_seq_new(NCH(n) / 2); + if (!cmps) { + asdl_seq_free(ops); + return NULL; + } for (i = 1; i < NCH(n); i += 2) { /* XXX cmpop_ty is just an enum */ *************** *** 805,808 **** --- 835,840 ---- int j; asdl_seq *slices = asdl_seq_new(NCH(ch) / 2); + if (!slices) + return NULL; for (j = 0; j < NCH(ch); j += 2) asdl_seq_SET(slices, j / 2, *************** *** 848,851 **** --- 880,885 ---- args = asdl_seq_new(nargs); + if (!args) + return NULL; for (i = 0; i < NCH(n); i++) { node *ch = CHILD(n, i); *************** *** 905,913 **** REQ(CHILD(n, 1), EQUAL); targets = asdl_seq_new(NCH(n) / 2); for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e = ast_for_testlist(CHILD(n, i)); /* set context to assign */ ! if (!e) ! return NULL; set_context(e, Store); asdl_seq_SET(targets, i / 2, e); --- 939,951 ---- REQ(CHILD(n, 1), EQUAL); targets = asdl_seq_new(NCH(n) / 2); + if (!targets) + return NULL; for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e = ast_for_testlist(CHILD(n, i)); /* set context to assign */ ! if (!e) { ! asdl_seq_free(targets); ! return NULL; ! } set_context(e, Store); asdl_seq_SET(targets, i / 2, e); *************** *** 936,939 **** --- 974,979 ---- } seq = asdl_seq_new((NCH(n) + 1 - start) / 2); + if (!seq) + return NULL; for (i = start; i < NCH(n); i += 2) { asdl_seq_APPEND(seq, ast_for_expr(CHILD(n, i))); *************** *** 954,961 **** seq = asdl_seq_new((NCH(n) + 1) / 2); for (i = 0; i < NCH(n); i += 2) { e = ast_for_expr(CHILD(n, i)); ! if (!e) ! return NULL; if (context) set_context(e, context); --- 994,1005 ---- seq = asdl_seq_new((NCH(n) + 1) / 2); + if (!seq) + return NULL; for (i = 0; i < NCH(n); i += 2) { e = ast_for_expr(CHILD(n, i)); ! if (!e) { ! asdl_seq_free(seq); ! return NULL; ! } if (context) set_context(e, context); *************** *** 1100,1110 **** if (STR(CHILD(n, 0))[0] == 'i') { /* import */ aliases = asdl_seq_new(NCH(n) / 2); for (i = 1; i < NCH(n); i += 2) asdl_seq_SET(aliases, i / 2, alias_for_import_name(CHILD(n, i))); return Import(aliases, LINENO(n)); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ - alias_ty mod = alias_for_import_name(CHILD(n, 1)); stmt_ty import; aliases = asdl_seq_new((NCH(n) - 2) / 2); for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); --- 1144,1162 ---- if (STR(CHILD(n, 0))[0] == 'i') { /* import */ aliases = asdl_seq_new(NCH(n) / 2); + if (!aliases) + return NULL; for (i = 1; i < NCH(n); i += 2) asdl_seq_SET(aliases, i / 2, alias_for_import_name(CHILD(n, i))); return Import(aliases, LINENO(n)); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ stmt_ty import; + alias_ty mod = alias_for_import_name(CHILD(n, 1)); + if (!mod) + return NULL; aliases = asdl_seq_new((NCH(n) - 2) / 2); + if (!aliases) { + free(mod); + return NULL; + } for (i = 3; i <= NCH(n); i += 2) asdl_seq_APPEND(aliases, alias_for_import_name(CHILD(n, i))); *************** *** 1126,1133 **** REQ(n, global_stmt); s = asdl_seq_new(NCH(n) / 2); for (i = 1; i < NCH(n); i += 2) { name = NEW_IDENTIFIER(CHILD(n, i)); ! if (!name) return NULL; asdl_seq_SET(s, i / 2, name); } --- 1178,1189 ---- REQ(n, global_stmt); s = asdl_seq_new(NCH(n) / 2); + if (!s) + return NULL; for (i = 1; i < NCH(n); i += 2) { name = NEW_IDENTIFIER(CHILD(n, i)); ! if (!name) { ! asdl_seq_free(s); return NULL; + } asdl_seq_SET(s, i / 2, name); } *************** *** 1179,1182 **** --- 1235,1240 ---- total = num_stmts(n); seq = asdl_seq_new(total); + if (!seq) + return NULL; if (TYPE(CHILD(n, 0)) == simple_stmt) { n = CHILD(n, 0); *************** *** 1257,1260 **** --- 1315,1320 ---- if (has_else) { orelse = asdl_seq_new(1); + if (!orelse) + return NULL; asdl_seq_SET(orelse, 0, If(ast_for_expr(CHILD(n, NCH(n) - 6)), *************** *** 1270,1273 **** --- 1330,1335 ---- int off = 5 + (n_elif - i - 1) * 4; asdl_seq *new = asdl_seq_new(1); + if (!new) + return NULL; asdl_seq_SET(new, 0, If(ast_for_expr(CHILD(n, off)), *************** *** 1369,1372 **** --- 1431,1436 ---- n_except /= 3; handlers = asdl_seq_new(n_except); + if (!handlers) + return NULL; for (i = 0; i < n_except; i++) asdl_seq_SET(handlers, i, *************** *** 1396,1404 **** else { bases = asdl_seq_new(1); asdl_seq_SET(bases, 0, _bases); } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, ast_for_suite(CHILD(n, 6)), LINENO(n)); - return NULL; } --- 1460,1469 ---- else { bases = asdl_seq_new(1); + if (!bases) + return NULL; asdl_seq_SET(bases, 0, _bases); } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, ast_for_suite(CHILD(n, 6)), LINENO(n)); } From nnorwitz@users.sourceforge.net Thu Apr 3 00:55:03 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 02 Apr 2003 16:55:03 -0800 Subject: [Python-checkins] python/dist/src/Python asdl.c,1.1.2.4,1.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv26182/Python Modified Files: Tag: ast-branch asdl.c Log Message: Need to set PyExc_MemoryError after PyObject_Malloc fails Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/asdl.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** asdl.c 3 Apr 2003 00:49:02 -0000 1.1.2.4 --- asdl.c 3 Apr 2003 00:55:00 -0000 1.1.2.5 *************** *** 7,12 **** asdl_seq *seq = (asdl_seq *)PyObject_Malloc(sizeof(asdl_seq) + sizeof(void *) * (size - 1)); ! if (!seq) return NULL; seq->size = size; seq->offset = 0; --- 7,14 ---- asdl_seq *seq = (asdl_seq *)PyObject_Malloc(sizeof(asdl_seq) + sizeof(void *) * (size - 1)); ! if (!seq) { ! PyErr_SetString(PyExc_MemoryError, "no memory"); return NULL; + } seq->size = size; seq->offset = 0; From loewis@users.sourceforge.net Thu Apr 3 04:49:14 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:14 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.711,1.712 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Misc Modified Files: NEWS Log Message: Revert Patch #670715: iconv support. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.711 retrieving revision 1.712 diff -C2 -d -r1.711 -r1.712 *** NEWS 2 Apr 2003 16:57:59 -0000 1.711 --- NEWS 3 Apr 2003 04:49:11 -0000 1.712 *************** *** 42,45 **** --- 42,47 ---- ----------------- + - The iconv module has been removed from this release. + - The platform-independent routines for packing floats in IEEE formats (struct.pack's f, d codes; pickle and cPickle's protocol 1 *************** *** 106,111 **** ----- - - Fix build problems when _iconv_codec failed. (SF bug #690012.) - - Fix problem building on OSF1 because the compiler only accepted preprocessor directives that start in column 1. (SF bug #691793.) --- 108,111 ---- *************** *** 276,282 **** - The SSL module now handles sockets with a timeout set correctly (SF patch #675750, fixing SF bug #675552). - - - A new module _iconv_codec has been added, to expose the iconv(3) - library. - os/posixmodule has grown the sysexits.h constants (EX_OK and friends). --- 276,279 ---- From loewis@users.sourceforge.net Thu Apr 3 04:49:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.136,1.137 test_iconv_codecs.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Lib/test Modified Files: regrtest.py Removed Files: test_iconv_codecs.py Log Message: Revert Patch #670715: iconv support. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** regrtest.py 29 Mar 2003 22:01:17 -0000 1.136 --- regrtest.py 3 Apr 2003 04:49:11 -0000 1.137 *************** *** 570,574 **** test_gl test_grp - test_iconv_codecs test_imgfile test_ioctl --- 570,573 ---- *************** *** 627,631 **** test_gl test_grp - test_iconv_codecs test_ioctl test_imgfile --- 626,629 ---- *************** *** 775,779 **** test_gdbm test_gl - test_iconv_codecs test_imgfile test_largefile --- 773,776 ---- *************** *** 891,895 **** test_email_codecs test_gl - test_iconv_codecs test_imgfile test_largefile --- 888,891 ---- --- test_iconv_codecs.py DELETED --- From loewis@users.sourceforge.net Thu Apr 3 04:49:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:13 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv24599 Modified Files: setup.py Log Message: Revert Patch #670715: iconv support. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** setup.py 31 Mar 2003 15:53:29 -0000 1.158 --- setup.py 3 Apr 2003 04:49:11 -0000 1.159 *************** *** 623,644 **** libraries = libs) ) - # Hye-Shik Chang's iconv_codec C interface - iconv_incs = find_file('iconv.h', inc_dirs, - ['/usr/local/include', '/usr/pkg/include']) - iconv_libs = find_library_file(self.compiler, 'iconv', lib_dirs, - ['/usr/local/lib', '/usr/pkg/lib']) - - if platform not in ['darwin'] and iconv_incs is not None: - if iconv_libs is not None: - iconv_libraries = ['iconv'] - else: - iconv_libraries = [] # in libc - - exts.append( Extension('_iconv_codec', - ['_iconv_codec.c'], - include_dirs = iconv_incs, - library_dirs = iconv_libs, - libraries = iconv_libraries), ) - # Curses support, requring the System V version of curses, often # provided by the ncurses library. --- 623,626 ---- From loewis@users.sourceforge.net Thu Apr 3 04:49:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:15 -0800 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.38,1.39 _iconv_codec.c,1.14,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Modules Modified Files: Setup.dist Removed Files: _iconv_codec.c Log Message: Revert Patch #670715: iconv support. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Setup.dist 20 Mar 2003 23:37:24 -0000 1.38 --- Setup.dist 3 Apr 2003 04:49:12 -0000 1.39 *************** *** 479,486 **** #pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat - # Wrapper for iconv(3). This requires either GNU iconv, or a native - # iconv implementation (only Linux, Solaris, and BSD are known to work) - #_iconv_codec _iconv_codec -I$(prefix)/include -L$(exec_prefix)/lib -liconv - # Example -- included for reference only: # xx xxmodule.c --- 479,482 ---- --- _iconv_codec.c DELETED --- From loewis@users.sourceforge.net Thu Apr 3 04:49:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 02 Apr 2003 20:49:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.16,1.17 iconv_codec.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1:/tmp/cvs-serv24599/Lib/encodings Modified Files: __init__.py Removed Files: iconv_codec.py Log Message: Revert Patch #670715: iconv support. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** __init__.py 28 Feb 2003 20:00:42 -0000 1.16 --- __init__.py 3 Apr 2003 04:49:11 -0000 1.17 *************** *** 122,128 **** codecs.register(search_function) - # Register iconv_codec lookup function if available - try: - import iconv_codec - except (ImportError, RuntimeError): - pass --- 122,123 ---- --- iconv_codec.py DELETED --- From jhylton@users.sourceforge.net Thu Apr 3 13:50:40 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 05:50:40 -0800 Subject: [Python-checkins] python/dist/src/Include compile.h,2.37.2.5,2.37.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv5307 Modified Files: Tag: ast-branch compile.h Log Message: Add i_lineno to struct instr. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37.2.5 retrieving revision 2.37.2.6 diff -C2 -d -r2.37.2.5 -r2.37.2.6 *** compile.h 24 Mar 2003 23:44:18 -0000 2.37.2.5 --- compile.h 3 Apr 2003 13:50:37 -0000 2.37.2.6 *************** *** 26,30 **** DL_IMPORT(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); ! #define DEFAULT_BLOCK_SIZE 32 #define DEFAULT_BLOCKS 8 #define DEFAULT_CODE_SIZE 128 --- 26,30 ---- DL_IMPORT(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); ! #define DEFAULT_BLOCK_SIZE 16 #define DEFAULT_BLOCKS 8 #define DEFAULT_CODE_SIZE 128 *************** *** 36,39 **** --- 36,40 ---- unsigned char i_opcode; int i_oparg; + int i_lineno; }; From jhylton@users.sourceforge.net Thu Apr 3 13:52:27 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 05:52:27 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.50,1.1.2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5957 Modified Files: Tag: ast-branch newcompile.c Log Message: Add some infrastructure for creating lnotab. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.50 retrieving revision 1.1.2.51 diff -C2 -d -r1.1.2.50 -r1.1.2.51 *** newcompile.c 1 Apr 2003 22:17:00 -0000 1.1.2.50 --- newcompile.c 3 Apr 2003 13:52:24 -0000 1.1.2.51 *************** *** 44,48 **** int u_curblock; /* index of current block in u_blocks */ int u_tmpname; /* temporary variables for list comps */ ! identifier u_tmp; /* name for u_tmpname */ struct basicblock u_exit; struct basicblock **u_blocks; --- 44,48 ---- int u_curblock; /* index of current block in u_blocks */ int u_tmpname; /* temporary variables for list comps */ ! identifier u_tmp; /* name for u_tmpname */ struct basicblock u_exit; struct basicblock **u_blocks; *************** *** 51,55 **** struct fblockinfo u_fblock[CO_MAXBLOCKS]; ! int u_lineno; }; --- 51,57 ---- struct fblockinfo u_fblock[CO_MAXBLOCKS]; ! int u_lineno; /* the lineno for the current stmt */ ! bool u_lineno_set; /* boolean to indicate whether instr ! has been generated with current lineno */ }; *************** *** 68,71 **** --- 70,74 ---- struct assembler { PyObject *a_bytecode; /* string containing bytecode */ + PyObject *a_lnotab; /* string containing lnotab */ int a_offset; /* offset into bytecode */ int a_nblocks; /* number of reachable blocks */ *************** *** 285,288 **** --- 288,293 ---- u->u_tmpname = 0; u->u_nfblocks = 0; + u->u_lineno = 0; + u->u_lineno_set = true; memset(u->u_blocks, 0, sizeof(struct basicblock *) * DEFAULT_BLOCKS); u->u_consts = PyDict_New(); *************** *** 483,486 **** --- 488,502 ---- */ + static void + compiler_set_lineno(struct compiler *c, int off) + { + struct basicblock *b; + if (c->u->u_lineno_set) + return; + c->u->u_lineno_set = true; + b = c->u->u_blocks[c->u->u_curblock]; + b->b_instr[off].i_lineno = c->u->u_lineno; + } + static int compiler_addop(struct compiler *c, int opcode) *************** *** 492,495 **** --- 508,512 ---- if (off < 0) return 0; + compiler_set_lineno(c, off); b = c->u->u_blocks[c->u->u_curblock]; i = &b->b_instr[off]; *************** *** 537,540 **** --- 554,558 ---- if (off < 0) return 0; + compiler_set_lineno(c, off); i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off]; i->i_opcode = opcode; *************** *** 549,555 **** --- 567,576 ---- struct instr *i; int off; + + assert(block >= 0); off = compiler_next_instr(c, c->u->u_curblock); if (off < 0) return 0; + compiler_set_lineno(c, off); i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off]; i->i_opcode = opcode; *************** *** 1192,1196 **** fprintf(stderr, "compile stmt %d lineno %d\n", s->kind, s->lineno); ! c->u->u_lineno = s->lineno; /* XXX this isn't right */ switch (s->kind) { case FunctionDef_kind: --- 1213,1218 ---- fprintf(stderr, "compile stmt %d lineno %d\n", s->kind, s->lineno); ! c->u->u_lineno = s->lineno; ! c->u->u_lineno_set = false; switch (s->kind) { case FunctionDef_kind: *************** *** 1563,1567 **** compiler_compare(struct compiler *c, expr_ty e) { ! int i, n, cleanup; VISIT(c, expr, e->v.Compare.left); --- 1585,1589 ---- compiler_compare(struct compiler *c, expr_ty e) { ! int i, n, cleanup = -1; VISIT(c, expr, e->v.Compare.left); *************** *** 2026,2029 **** --- 2048,2101 ---- } + /* All about c_lnotab. + + c_lnotab is an array of unsigned bytes disguised as a Python string. In -O + mode, SET_LINENO opcodes aren't generated, and bytecode offsets are mapped + to source code line #s (when needed for tracebacks) via c_lnotab instead. + The array is conceptually a list of + (bytecode offset increment, line number increment) + pairs. The details are important and delicate, best illustrated by example: + + byte code offset source code line number + 0 1 + 6 2 + 50 7 + 350 307 + 361 308 + + The first trick is that these numbers aren't stored, only the increments + from one row to the next (this doesn't really work, but it's a start): + + 0, 1, 6, 1, 44, 5, 300, 300, 11, 1 + + The second trick is that an unsigned byte can't hold negative values, or + values larger than 255, so (a) there's a deep assumption that byte code + offsets and their corresponding line #s both increase monotonically, and (b) + if at least one column jumps by more than 255 from one row to the next, more + than one pair is written to the table. In case #b, there's no way to know + from looking at the table later how many were written. That's the delicate + part. A user of c_lnotab desiring to find the source line number + corresponding to a bytecode address A should do something like this + + lineno = addr = 0 + for addr_incr, line_incr in c_lnotab: + addr += addr_incr + if addr > A: + return lineno + lineno += line_incr + + In order for this to work, when the addr field increments by more than 255, + the line # increment in each pair generated must be 0 until the remaining addr + increment is < 256. So, in the example above, com_set_lineno should not (as + was actually done until 2.2) expand 300, 300 to 255, 255, 45, 45, but to + 255, 0, 45, 255, 0, 45. + */ + + static int + assemble_lnotab(struct assembler *a) + { + return 1; + } + /* Return the size of a basic block in bytes. */ *************** *** 2251,2254 **** --- 2323,2328 ---- /* Can't modify the bytecode after computing jump offsets. */ if (!assemble_jump_offsets(&a, c)) + goto error; + if (!assemble_lnotab(&a)) goto error; From jhylton@users.sourceforge.net Thu Apr 3 16:28:44 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 08:28:44 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25214/Modules Modified Files: gcmodule.c Log Message: Add get_referrents() helper function. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** gcmodule.c 9 Nov 2002 19:54:06 -0000 2.56 --- gcmodule.c 3 Apr 2003 16:28:38 -0000 2.57 *************** *** 829,832 **** --- 829,860 ---- } + static int + referrentsvisit(PyObject *obj, PyObject *list) + { + if (PyList_Append(list, obj) < 0) + return 1; + return 0; + } + + PyDoc_STRVAR(gc_get_referrents__doc__, + "get_referrents(*objs) -> list\n\ + Return the list of objects that directly refer to any of objs."); + + static PyObject * + gc_get_referrents(PyObject *self, PyObject *args) + { + int i; + PyObject *result = PyList_New(0); + for (i = 0; i < PyTuple_GET_SIZE(args); i++) { + PyObject *obj = PyTuple_GET_ITEM(args, i); + traverseproc traverse = obj->ob_type->tp_traverse; + if (!traverse) + continue; + if (traverse(obj, (visitproc)referrentsvisit, result)) + return NULL; + } + return result; + } + PyDoc_STRVAR(gc_get_objects__doc__, "get_objects() -> [...]\n" *************** *** 885,889 **** "get_threshold() -- Return the current the collection thresholds.\n" "get_objects() -- Return a list of all objects tracked by the collector.\n" ! "get_referrers() -- Return the list of objects that refer to an object.\n"); static PyMethodDef GcMethods[] = { --- 913,918 ---- "get_threshold() -- Return the current the collection thresholds.\n" "get_objects() -- Return a list of all objects tracked by the collector.\n" ! "get_referrers() -- Return the list of objects that refer to an object.\n" ! "get_referrents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { *************** *** 899,902 **** --- 928,933 ---- {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, + {"get_referrents", gc_get_referrents, METH_VARARGS, + gc_get_referrents__doc__}, {NULL, NULL} /* Sentinel */ }; From jhylton@users.sourceforge.net Thu Apr 3 16:29:16 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 08:29:16 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25530/Modules Modified Files: gcmodule.c Log Message: Add get_referrents() helper function. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** gcmodule.c 3 Apr 2003 16:28:38 -0000 2.57 --- gcmodule.c 3 Apr 2003 16:29:13 -0000 2.58 *************** *** 839,843 **** PyDoc_STRVAR(gc_get_referrents__doc__, "get_referrents(*objs) -> list\n\ ! Return the list of objects that directly refer to any of objs."); static PyObject * --- 839,843 ---- PyDoc_STRVAR(gc_get_referrents__doc__, "get_referrents(*objs) -> list\n\ ! Return the list of objects that are directly referred to by objs."); static PyObject * From jhylton@users.sourceforge.net Thu Apr 3 23:02:34 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 03 Apr 2003 15:02:34 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.5,2.33.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26899 Modified Files: Tag: release22-maint gcmodule.c Log Message: Fix memory corruption in garbage collection. The move_finalizers() routine checks each object in the unreachable list to see if it has a finalizer. If it does, it is moved to the finalizers list. The collector checks by calling, effectively, hasattr(obj, "__del__"). The hasattr() call can result in an arbitrary amount of Python code being run, because it will invoke getattr hooks on obj. If a getattr() hook is run from move_finalizers(), it may end up resurrecting or deallocating objects in the unreachable list. In fact, it's possible that the hook causes the next object in the list to be deallocated. That is, the object pointed to by gc->gc.gc_next may be freed before has_finalizer() returns. The problem with the previous revision is that it followed gc->gc.gc_next before calling has_finalizer(). If has_finalizer() gc->happened to deallocate the object FROM_GC(gc->gc.gc_next), then the next time through the loop gc would point to freed memory. The fix is to always follow the next pointer after calling has_finalizer(). Note that Python 2.3 does not have this problem, because has_finalizer() checks the tp_del slot and never runs Python code. Tim, Barry, and I peed away the better part of two days tracking this down. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.5 retrieving revision 2.33.6.6 diff -C2 -d -r2.33.6.5 -r2.33.6.6 *** gcmodule.c 30 Jun 2002 18:48:53 -0000 2.33.6.5 --- gcmodule.c 3 Apr 2003 23:02:29 -0000 2.33.6.6 *************** *** 277,286 **** for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! next = gc->gc.gc_next; if (has_finalizer(op)) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } } } --- 277,290 ---- for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* has_finalizer() may result in arbitrary Python ! code being run. */ if (has_finalizer(op)) { + next = gc->gc.gc_next; gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } + else + next = gc->gc.gc_next; } } From gward@users.sourceforge.net Fri Apr 4 01:47:45 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 03 Apr 2003 17:47:45 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13667/Modules Modified Files: ossaudiodev.c Log Message: Use fcntl() to put the audio device *back* into blocking mode after opening it in non-blocking mode. Both Guido and David Hammerton have reported that this fixes their problems with ossaudiodev -- hooray! Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ossaudiodev.c 11 Mar 2003 16:53:13 -0000 1.25 --- ossaudiodev.c 4 Apr 2003 01:47:42 -0000 1.26 *************** *** 140,143 **** --- 140,152 ---- return NULL; } + + /* And (try to) put it back in blocking mode so we get the + expected write() semantics. */ + if (fcntl(fd, F_SETFL, 0) == -1) { + close(fd); + PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); + return NULL; + } + if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); From bwarsaw@users.sourceforge.net Fri Apr 4 02:46:41 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:46:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.13.2.3,1.13.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv597 Modified Files: Tag: release22-maint Header.py Log Message: Backporting: revision 1.27 date: 2003/03/30 20:46:47; author: bwarsaw; state: Exp; lines: +3 -3 __unicode__(): Fix the logic for calculating whether to add a separating space or not between encoded chunks. Closes SF bug #710498. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.13.2.3 retrieving revision 1.13.2.4 diff -C2 -d -r1.13.2.3 -r1.13.2.4 *** Header.py 21 Mar 2003 21:09:31 -0000 1.13.2.3 --- Header.py 4 Apr 2003 02:46:38 -0000 1.13.2.4 *************** *** 216,224 **** nextcs = charset if uchunks: ! if lastcs is not None: ! if nextcs is None or nextcs == 'us-ascii': uchunks.append(USPACE) nextcs = None ! elif nextcs is not None and nextcs <> 'us-ascii': uchunks.append(USPACE) lastcs = nextcs --- 216,224 ---- nextcs = charset if uchunks: ! if lastcs not in (None, 'us-ascii'): ! if nextcs in (None, 'us-ascii'): uchunks.append(USPACE) nextcs = None ! elif nextcs not in (None, 'us-ascii'): uchunks.append(USPACE) lastcs = nextcs From bwarsaw@users.sourceforge.net Fri Apr 4 02:47:09 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:47:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.4.10.5,1.4.10.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv790 Modified Files: Tag: release22-maint __init__.py Log Message: Backporting email 2.5.1 patches. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.4.10.5 retrieving revision 1.4.10.6 diff -C2 -d -r1.4.10.5 -r1.4.10.6 *** __init__.py 21 Mar 2003 21:09:31 -0000 1.4.10.5 --- __init__.py 4 Apr 2003 02:47:07 -0000 1.4.10.6 *************** *** 5,9 **** """ ! __version__ = '2.5' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.1' __all__ = [ From bwarsaw@users.sourceforge.net Fri Apr 4 02:47:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:47:56 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py,1.4.2.2,1.4.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1057 Modified Files: Tag: release22-maint _compat21.py Log Message: Backporting: typed_subpart_iterator(): Fix these to use non-deprecated APIs, i.e. get_content_maintype() and get_content_subtype(). Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** _compat21.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 --- _compat21.py 4 Apr 2003 02:47:54 -0000 1.4.2.3 *************** *** 64,69 **** parts = [] for subpart in msg.walk(): ! if subpart.get_main_type('text') == maintype: ! if subtype is None or subpart.get_subtype('plain') == subtype: parts.append(subpart) return parts --- 64,69 ---- parts = [] for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: parts.append(subpart) return parts From bwarsaw@users.sourceforge.net Fri Apr 4 02:48:20 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 03 Apr 2003 18:48:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.4.2.2,1.4.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1257 Modified Files: Tag: release22-maint _compat22.py Log Message: Backporting: typed_subpart_iterator(): Fix these to use non-deprecated APIs, i.e. get_content_maintype() and get_content_subtype(). Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** _compat22.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 --- _compat22.py 4 Apr 2003 02:48:18 -0000 1.4.2.3 *************** *** 2,6 **** # Author: barry@zope.com ! """Module containing compatibility functions for Python 2.1. """ --- 2,6 ---- # Author: barry@zope.com ! """Module containing compatibility functions for Python 2.2. """ *************** *** 10,13 **** --- 10,20 ---- from types import StringTypes + # Python 2.2.x where x < 1 lacks True/False + try: + True, False + except NameError: + True = 1 + False = 0 + *************** *** 59,63 **** """ for subpart in msg.walk(): ! if subpart.get_main_type('text') == maintype: ! if subtype is None or subpart.get_subtype('plain') == subtype: yield subpart --- 66,70 ---- """ for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: yield subpart From jhylton@users.sourceforge.net Fri Apr 4 19:59:10 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 04 Apr 2003 11:59:10 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv829 Modified Files: gcmodule.c Log Message: Fix Tim's boom example. move_finalizers() moves every object from unreachable to collectable or finalizers, unless the object is deallocated first. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** gcmodule.c 3 Apr 2003 16:29:13 -0000 2.58 --- gcmodule.c 4 Apr 2003 19:59:06 -0000 2.59 *************** *** 60,63 **** --- 60,66 ---- static PyObject *gc_str; + /* Python string used to looked for __del__ attribute. */ + static PyObject *delstr; + /* set for debugging information */ #define DEBUG_STATS (1<<0) /* print collection statistics */ *************** *** 341,350 **** has_finalizer(PyObject *op) { - static PyObject *delstr = NULL; - if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); - if (delstr == NULL) - Py_FatalError("PyGC: can't initialize __del__ string"); - } return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) : PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ? --- 344,347 ---- *************** *** 352,369 **** } ! /* Move all objects with finalizers (instances with __del__) */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { ! PyGC_Head *next; ! PyGC_Head *gc = unreachable->gc.gc_next; ! for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! next = gc->gc.gc_next; ! if (has_finalizer(op)) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_REACHABLE; } } } --- 349,393 ---- } ! /* Move all objects out of unreachable and into collectable or finalizers. ! */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *collectable, ! PyGC_Head *finalizers) { ! while (!gc_list_is_empty(unreachable)) { ! PyGC_Head *gc = unreachable->gc.gc_next; PyObject *op = FROM_GC(gc); ! int finalizer; ! ! if (PyInstance_Check(op)) { ! /* The HasAttr() check may run enough Python ! code to deallocate the object or make it ! reachable again. INCREF the object before ! calling HasAttr() to guard against the client ! code deallocating the object. ! */ ! Py_INCREF(op); ! finalizer = PyObject_HasAttr(op, delstr); ! if (op->ob_refcnt == 1) { ! /* The object will be deallocated. ! Nothing left to do. ! */ ! Py_DECREF(op); ! continue; ! } ! Py_DECREF(op); ! } ! else ! finalizer = has_finalizer(op); ! if (finalizer) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_REACHABLE; } + else { + gc_list_remove(gc); + gc_list_append(gc, collectable); + /* XXX change gc_refs? */ + } } } *************** *** 438,441 **** --- 462,466 ---- gc = finalizers->gc.gc_next) { PyObject *op = FROM_GC(gc); + /* XXX has_finalizer() is not safe here. */ if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { /* If SAVEALL is not set then just append objects with *************** *** 458,467 **** */ static void ! delete_garbage(PyGC_Head *unreachable, PyGC_Head *old) { inquiry clear; ! while (!gc_list_is_empty(unreachable)) { ! PyGC_Head *gc = unreachable->gc.gc_next; PyObject *op = FROM_GC(gc); --- 483,492 ---- */ static void ! delete_garbage(PyGC_Head *collectable, PyGC_Head *old) { inquiry clear; ! while (!gc_list_is_empty(collectable)) { ! PyGC_Head *gc = collectable->gc.gc_next; PyObject *op = FROM_GC(gc); *************** *** 477,481 **** } } ! if (unreachable->gc.gc_next == gc) { /* object is still alive, move it, it may die later */ gc_list_remove(gc); --- 502,506 ---- } } ! if (collectable->gc.gc_next == gc) { /* object is still alive, move it, it may die later */ gc_list_remove(gc); *************** *** 497,500 **** --- 522,526 ---- PyGC_Head *old; /* next older generation */ PyGC_Head unreachable; + PyGC_Head collectable; PyGC_Head finalizers; PyGC_Head *gc; *************** *** 553,564 **** * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. */ gc_list_init(&finalizers); ! move_finalizers(&unreachable, &finalizers); move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; --- 579,595 ---- * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. + * + * Move each object into the collectable set or the finalizers set. + * It's possible that a classic class with a getattr() hook will + * be revived or deallocated in this step. */ + gc_list_init(&collectable); gc_list_init(&finalizers); ! move_finalizers(&unreachable, &collectable, &finalizers); move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = collectable.gc.gc_next; gc != &collectable; gc = gc->gc.gc_next) { m++; *************** *** 570,574 **** * the reference cycles to be broken. It may also cause some objects in * finalizers to be freed */ ! delete_garbage(&unreachable, old); /* Collect statistics on uncollectable objects found and print --- 601,605 ---- * the reference cycles to be broken. It may also cause some objects in * finalizers to be freed */ ! delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print *************** *** 939,942 **** --- 970,976 ---- PyObject *d; + delstr = PyString_InternFromString("__del__"); + if (!delstr) + return; m = Py_InitModule4("gc", GcMethods, From jhylton@users.sourceforge.net Fri Apr 4 20:00:12 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 04 Apr 2003 12:00:12 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1131 Modified Files: test_gc.py Log Message: Add Tim's gc boom test to the test suite. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_gc.py 11 Aug 2002 04:15:09 -0000 1.23 --- test_gc.py 4 Apr 2003 20:00:04 -0000 1.24 *************** *** 254,257 **** --- 254,275 ---- gc.disable() + class C: + def __getattr__(self, attr): + del self.attr + raise AttributeError + + def test_boom(): + a = C() + b = C() + a.attr = b + b.attr = a + + gc.collect() + del a, b + # the collection will invoke the getattr and decref one of the + # object. so they are deallocated without being reported as + # part of a cycle. + expect(gc.collect(), 0, "boom") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 272,275 **** --- 290,294 ---- run_test("saveall", test_saveall) run_test("trashcan", test_trashcan) + run_test("boom", test_boom) def test(): From goodger@users.sourceforge.net Fri Apr 4 21:20:03 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 04 Apr 2003 13:20:03 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv747 Modified Files: pep-0313.txt Log Message: update from Mike Meyer Index: pep-0313.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0313.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0313.txt 1 Apr 2003 17:41:34 -0000 1.2 --- pep-0313.txt 4 Apr 2003 21:19:59 -0000 1.3 *************** *** 14,21 **** Abstract ! This PEP proposes adding Roman numerals as a literal type. It ! also proposes the new built-in function "roman", which converts an ! object to an integer, then converts the integer to a string that ! is the Roman numeral literal equivalent to the integer. --- 14,22 ---- Abstract ! This PEP (also known as PEP CCCXIII) proposes adding Roman ! numerals as a literal type. It also proposes the new built-in ! function "roman", which converts an object to an integer, then ! converts the integer to a string that is the Roman numeral literal ! equivalent to the integer. *************** *** 39,48 **** 1. Except as noted below, they must appear in the order M, D, C, ! L, X, V then I. Each occurence of each character adds 1000, 500, 100, 50, 10, 5 and 1 to the value of the literal, respectively. 2. Only one D, V or L may appear in any given literal. ! 3. At most three Is, Xs and Cs may appear in any given literal. 4. A single I may appear immediately to the left of the single V, --- 40,50 ---- 1. Except as noted below, they must appear in the order M, D, C, ! L, X, V then I. Each occurrence of each character adds 1000, 500, 100, 50, 10, 5 and 1 to the value of the literal, respectively. 2. Only one D, V or L may appear in any given literal. ! 3. At most three each of Is, Xs and Cs may appear consecutively ! in any given literal. 4. A single I may appear immediately to the left of the single V, *************** *** 63,74 **** ! Builtin "roman" Function ! The new builtin function "roman" will aide the translation from integers to Roman numeral literals. It will accept a single object as an argument, and return a string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239 [1]) it will passed through the existing ! builtin "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal --- 65,76 ---- ! Built-In "roman" Function ! The new built-in function "roman" will aide the translation from integers to Roman numeral literals. It will accept a single object as an argument, and return a string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239 [1]) it will passed through the existing ! built-in "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal *************** *** 77,81 **** ! Compatability Issues No new keywords are introduced by this proposal. Programs that --- 79,83 ---- ! Compatibility Issues No new keywords are introduced by this proposal. Programs that From goodger@users.sourceforge.net Fri Apr 4 21:21:42 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 04 Apr 2003 13:21:42 -0800 Subject: [Python-checkins] python/nondist/peps pep-0313.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv1644 Modified Files: pep-0313.txt Log Message: real ^L Index: pep-0313.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0313.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0313.txt 4 Apr 2003 21:19:59 -0000 1.3 --- pep-0313.txt 4 Apr 2003 21:21:38 -0000 1.4 *************** *** 109,113 **** ! ^L Local Variables: mode: indented-text --- 109,113 ---- ! Local Variables: mode: indented-text From rhettinger@users.sourceforge.net Fri Apr 4 22:56:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 04 Apr 2003 14:56:44 -0800 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18890/Lib Modified Files: unittest.py Log Message: SF bug #715145: unittest.py still uses != in failUnlessEqual Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** unittest.py 27 Feb 2003 20:14:43 -0000 1.22 --- unittest.py 4 Apr 2003 22:56:41 -0000 1.23 *************** *** 286,293 **** def failUnlessEqual(self, first, second, msg=None): ! """Fail if the two objects are unequal as determined by the '!=' operator. """ ! if first != second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) --- 286,293 ---- def failUnlessEqual(self, first, second, msg=None): ! """Fail if the two objects are unequal as determined by the '==' operator. """ ! if not first == second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) From rhettinger@users.sourceforge.net Fri Apr 4 22:56:45 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 04 Apr 2003 14:56:45 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.712,1.713 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18890/Misc Modified Files: NEWS Log Message: SF bug #715145: unittest.py still uses != in failUnlessEqual Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.712 retrieving revision 1.713 diff -C2 -d -r1.712 -r1.713 *** NEWS 3 Apr 2003 04:49:11 -0000 1.712 --- NEWS 4 Apr 2003 22:56:42 -0000 1.713 *************** *** 74,77 **** --- 74,81 ---- ------- + - unittest.failUnlessEqual and its equivalent unittest.assertEqual now + return 'not a == b' rather than 'a != b'. This gives the desired + result for classes that define __eq__ without defining __ne__. + - sgmllib now supports SGML marked sections, in particular the MS Office extensions. From tim_one@users.sourceforge.net Sat Apr 5 17:15:47 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 09:15:47 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv1289/Modules Modified Files: gcmodule.c Log Message: Fixed new seemingly random segfaults, by moving the initialization of delstr from initgc() into collect(). initgc() isn't called unless the user explicitly imports gc, so can be used only for initialization of user-visible module features; delstr needs to be initialized for proper internal operation, whether or not gc is explicitly imported. Bugfix candidate? I don't know whether the new bug was backported to 2.2 already. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** gcmodule.c 4 Apr 2003 19:59:06 -0000 2.59 --- gcmodule.c 5 Apr 2003 17:15:44 -0000 2.60 *************** *** 60,65 **** static PyObject *gc_str; ! /* Python string used to looked for __del__ attribute. */ ! static PyObject *delstr; /* set for debugging information */ --- 60,65 ---- static PyObject *gc_str; ! /* Python string used to look for __del__ attribute. */ ! static PyObject *delstr = NULL; /* set for debugging information */ *************** *** 370,374 **** finalizer = PyObject_HasAttr(op, delstr); if (op->ob_refcnt == 1) { ! /* The object will be deallocated. Nothing left to do. */ --- 370,374 ---- finalizer = PyObject_HasAttr(op, delstr); if (op->ob_refcnt == 1) { ! /* The object will be deallocated. Nothing left to do. */ *************** *** 526,529 **** --- 526,535 ---- PyGC_Head *gc; + if (delstr == NULL) { + delstr = PyString_InternFromString("__del__"); + if (delstr == NULL) + Py_FatalError("gc couldn't allocate \"__del__\""); + } + if (debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", *************** *** 579,583 **** * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. ! * * Move each object into the collectable set or the finalizers set. * It's possible that a classic class with a getattr() hook will --- 585,589 ---- * care not to create such things. For Python, finalizers means * instance objects with __del__ methods. ! * * Move each object into the collectable set or the finalizers set. * It's possible that a classic class with a getattr() hook will *************** *** 878,882 **** PyObject *result = PyList_New(0); for (i = 0; i < PyTuple_GET_SIZE(args); i++) { ! PyObject *obj = PyTuple_GET_ITEM(args, i); traverseproc traverse = obj->ob_type->tp_traverse; if (!traverse) --- 884,888 ---- PyObject *result = PyList_New(0); for (i = 0; i < PyTuple_GET_SIZE(args); i++) { ! PyObject *obj = PyTuple_GET_ITEM(args, i); traverseproc traverse = obj->ob_type->tp_traverse; if (!traverse) *************** *** 970,976 **** PyObject *d; - delstr = PyString_InternFromString("__del__"); - if (!delstr) - return; m = Py_InitModule4("gc", GcMethods, --- 976,979 ---- From tim_one@users.sourceforge.net Sat Apr 5 17:35:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 09:35:56 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv8673/python/Modules Modified Files: gcmodule.c Log Message: New comments. Rewrote has_finalizer() as a sequence of ifs instead of squashed-together conditional operators; makes it much easier to step thru in the debugger, and to set a breakpoint on the only dangerous path. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** gcmodule.c 5 Apr 2003 17:15:44 -0000 2.60 --- gcmodule.c 5 Apr 2003 17:35:54 -0000 2.61 *************** *** 340,350 **** } ! /* return true if object has a finalization method */ static int has_finalizer(PyObject *op) { ! return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) : ! PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ? ! op->ob_type->tp_del != NULL : 0; } --- 340,363 ---- } ! /* Return true if object has a finalization method. ! * CAUTION: An instance of an old-style class has to be checked for a ! *__del__ method, and that can cause arbitrary Python code to get executed ! * via the class's __getattr__ hook (if any). This function can therefore ! * mutate the object graph, and that's been the source of subtle bugs. ! */ static int has_finalizer(PyObject *op) { ! if (PyInstance_Check(op)) { ! /* This is the dangerous path: hasattr can invoke ! * the class __getattr__(), and that can do anything. ! */ ! assert(delstr != NULL); ! return PyObject_HasAttr(op, delstr); ! } ! else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! return op->ob_type->tp_del != NULL; ! else ! return 0; } *************** *** 587,592 **** * * Move each object into the collectable set or the finalizers set. ! * It's possible that a classic class with a getattr() hook will ! * be revived or deallocated in this step. */ gc_list_init(&collectable); --- 600,607 ---- * * Move each object into the collectable set or the finalizers set. ! * Because we need to check for __del__ methods on instances of ! * classic classes, arbitrary Python code may get executed by ! * getattr hooks: that may resurrect or deallocate (via refcount ! * falling to 0) unreachable objects, so this is very delicate. */ gc_list_init(&collectable); From tim_one@users.sourceforge.net Sat Apr 5 17:46:07 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 09:46:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12012/Lib/test Modified Files: test_gc.py Log Message: test_boom: More comments. Also check that len(gc.garbage) doesn't change (it would be another kind of bug if the trash cycle weren't reclaimed). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_gc.py 4 Apr 2003 20:00:04 -0000 1.24 --- test_gc.py 5 Apr 2003 17:46:04 -0000 1.25 *************** *** 255,259 **** class C: ! def __getattr__(self, attr): del self.attr raise AttributeError --- 255,259 ---- class C: ! def __getattr__(self, someattribute): del self.attr raise AttributeError *************** *** 266,274 **** gc.collect() del a, b ! # the collection will invoke the getattr and decref one of the ! # object. so they are deallocated without being reported as ! # part of a cycle. expect(gc.collect(), 0, "boom") def test_all(): --- 266,279 ---- gc.collect() + garbagelen = len(gc.garbage) del a, b ! # a<->b are in a trash cycle now. Collection will invoke C.__getattr__ ! # (to see whether a and b have __del__ methods), and __getattr__ deletes ! # the internal "attr" attributes as a side effect. That causes the ! # trash cycle to get reclaimed via refcounts falling to 0, thus mutating ! # the trash graph as a side effect of merely asking whether __del__ ! # exists. This used to (before 2.3b1) crash Python. expect(gc.collect(), 0, "boom") + expect(len(gc.garbage), garbagelen, "boom") def test_all(): From tim_one@users.sourceforge.net Sat Apr 5 18:40:53 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 10:40:53 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29089/Modules Modified Files: gcmodule.c Log Message: move_finalizers(): Rewrote. It's not necessary for this routine to special-case classic classes, or to worry about refcounts; has_finalizer() deleted the current object iff the first entry in the unreachable list has changed. I don't believe it was correct to check for ob_refcnt == 1, either: the dealloc routine would get called by Py_DECREF then, but there's nothing to stop the dealloc routine from ressurecting the object, and then gc would remain at the head of the unreachable list despite that its refcount temporarily fell to 0 (and that would lead to an infinite loop in move_finalizers()). I'm still worried about has_finalizer() resurrecting other objects in the unreachable list: what's to stop them from getting collected? Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** gcmodule.c 5 Apr 2003 17:35:54 -0000 2.61 --- gcmodule.c 5 Apr 2003 18:40:50 -0000 2.62 *************** *** 362,366 **** } ! /* Move all objects out of unreachable and into collectable or finalizers. */ static void --- 362,374 ---- } ! /* Move all objects out of unreachable, into collectable or finalizers. ! * It's possible that some objects will get collected (via refcount falling ! * to 0), or resurrected, as a side effect of checking for __del__ methods. ! * After, finalizers contains all the objects from unreachable that haven't ! * been collected by magic, and that have a finalizer. gc_refs is ! * GC_REACHABLE for all of those. collectable contains all the remaining ! * objects from unreachable, and gc_refs remains GC_TENTATIVELY_UNREACHABLE ! * for those (we're still not sure they're reclaimable after this! Some ! * may yet by reachable *from* the objects in finalizers). */ static void *************** *** 373,406 **** int finalizer; ! if (PyInstance_Check(op)) { ! /* The HasAttr() check may run enough Python ! code to deallocate the object or make it ! reachable again. INCREF the object before ! calling HasAttr() to guard against the client ! code deallocating the object. ! */ ! Py_INCREF(op); ! finalizer = PyObject_HasAttr(op, delstr); ! if (op->ob_refcnt == 1) { ! /* The object will be deallocated. ! Nothing left to do. ! */ ! Py_DECREF(op); ! continue; ! } ! Py_DECREF(op); ! } ! else ! finalizer = has_finalizer(op); ! if (finalizer) { ! gc_list_remove(gc); ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! else { gc_list_remove(gc); ! gc_list_append(gc, collectable); ! /* XXX change gc_refs? */ } } } --- 381,397 ---- int finalizer; ! assert(IS_TENTATIVELY_UNREACHABLE(op)); ! ! finalizer = has_finalizer(op); ! if (unreachable->gc.gc_next == gc) { gc_list_remove(gc); ! if (finalizer) { ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! else ! gc_list_append(gc, collectable); } + /* else has_finalizer() deleted op via side effect */ } } From tim_one@users.sourceforge.net Sun Apr 6 00:11:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 16:11:41 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11222/python/Modules Modified Files: gcmodule.c Log Message: Reworked move_finalizer_reachable() to create two distinct lists: externally unreachable objects with finalizers, and externally unreachable objects without finalizers reachable from such objects. This allows us to call has_finalizer() at most once per object, and so limit the pain of nasty getattr hooks. This fixes the failing "boom 2" example Jeremy posted (a non-printing variant of which is now part of test_gc), via never triggering the nasty part of its __getattr__ method. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** gcmodule.c 5 Apr 2003 18:40:50 -0000 2.62 --- gcmodule.c 6 Apr 2003 00:11:39 -0000 2.63 *************** *** 52,62 **** /* true if we are currently running the collector */ ! static int collecting; /* list of uncollectable objects */ ! static PyObject *garbage; /* Python string to use if unhandled exception occurs */ ! static PyObject *gc_str; /* Python string used to look for __del__ attribute. */ --- 52,62 ---- /* true if we are currently running the collector */ ! static int collecting = 0; /* list of uncollectable objects */ ! static PyObject *garbage = NULL; /* Python string to use if unhandled exception occurs */ ! static PyObject *gc_str = NULL; /* Python string used to look for __del__ attribute. */ *************** *** 413,429 **** /* Move objects that are reachable from finalizers, from the unreachable set ! * into the finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers) { traverseproc traverse; PyGC_Head *gc = finalizers->gc.gc_next; ! for (; gc != finalizers; gc=gc->gc.gc_next) { ! /* careful, finalizers list is growing here */ traverse = FROM_GC(gc)->ob_type->tp_traverse; (void) traverse(FROM_GC(gc), ! (visitproc)visit_move, ! (void *)finalizers); } } --- 413,430 ---- /* Move objects that are reachable from finalizers, from the unreachable set ! * into the reachable_from_finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers, ! PyGC_Head *reachable_from_finalizers) { traverseproc traverse; PyGC_Head *gc = finalizers->gc.gc_next; ! for (; gc != finalizers; gc = gc->gc.gc_next) { ! /* Note that the finalizers list may grow during this. */ traverse = FROM_GC(gc)->ob_type->tp_traverse; (void) traverse(FROM_GC(gc), ! (visitproc)visit_move, ! (void *)reachable_from_finalizers); } } *************** *** 455,471 **** } ! /* Handle uncollectable garbage (cycles with finalizers). */ static void ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { PyGC_Head *gc; if (garbage == NULL) { garbage = PyList_New(0); } ! for (gc = finalizers->gc.gc_next; gc != finalizers; ! gc = finalizers->gc.gc_next) { PyObject *op = FROM_GC(gc); ! /* XXX has_finalizer() is not safe here. */ ! if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { /* If SAVEALL is not set then just append objects with * finalizers to the list of garbage. All objects in --- 456,478 ---- } ! /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable ! * only from such cycles). ! */ static void ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { PyGC_Head *gc; if (garbage == NULL) { garbage = PyList_New(0); + if (garbage == NULL) + Py_FatalError("gc couldn't create gc.garbage list"); } ! for (gc = finalizers->gc.gc_next; ! gc != finalizers; ! gc = finalizers->gc.gc_next) { PyObject *op = FROM_GC(gc); ! ! assert(IS_REACHABLE(op)); ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { /* If SAVEALL is not set then just append objects with * finalizers to the list of garbage. All objects in *************** *** 475,480 **** PyList_Append(garbage, op); } - /* object is now reachable again */ - assert(IS_REACHABLE(op)); gc_list_remove(gc); gc_list_append(gc, old); --- 482,485 ---- *************** *** 528,531 **** --- 533,537 ---- PyGC_Head collectable; PyGC_Head finalizers; + PyGC_Head reachable_from_finalizers; PyGC_Head *gc; *************** *** 590,603 **** * instance objects with __del__ methods. * ! * Move each object into the collectable set or the finalizers set. ! * Because we need to check for __del__ methods on instances of ! * classic classes, arbitrary Python code may get executed by ! * getattr hooks: that may resurrect or deallocate (via refcount ! * falling to 0) unreachable objects, so this is very delicate. */ gc_list_init(&collectable); gc_list_init(&finalizers); move_finalizers(&unreachable, &collectable, &finalizers); ! move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print --- 596,620 ---- * instance objects with __del__ methods. * ! * Move each unreachable object into the collectable set or the ! * finalizers set. Because we need to check for __del__ methods on ! * instances of classic classes, arbitrary Python code may get ! * executed by getattr hooks: that may resurrect or deallocate (via ! * refcount falling to 0) unreachable objects, so this is very ! * delicate. */ gc_list_init(&collectable); gc_list_init(&finalizers); move_finalizers(&unreachable, &collectable, &finalizers); ! /* finalizers contains the unreachable objects with a finalizer; ! * unreachable objects reachable only *from* those are also ! * uncollectable; we move those into a separate list ! * (reachable_from_finalizers) so we don't have to do the dangerous ! * has_finalizer() test again later. ! */ ! gc_list_init(&reachable_from_finalizers); ! move_finalizer_reachable(&finalizers, &reachable_from_finalizers); ! /* And move everything only reachable from the reachable stuff. */ ! move_finalizer_reachable(&reachable_from_finalizers, ! &reachable_from_finalizers); /* Collect statistics on collectable objects found and print *************** *** 611,626 **** } /* Call tp_clear on objects in the collectable set. This will cause ! * the reference cycles to be broken. It may also cause some objects in ! * finalizers to be freed */ delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; gc != &finalizers; ! gc = gc->gc.gc_next) { n++; ! if (debug & DEBUG_UNCOLLECTABLE) { debug_cycle("uncollectable", FROM_GC(gc)); - } } if (debug & DEBUG_STATS) { --- 628,650 ---- } /* Call tp_clear on objects in the collectable set. This will cause ! * the reference cycles to be broken. It may also cause some objects ! * in finalizers and/or reachable_from_finalizers to be freed */ delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; ! gc != &finalizers; ! gc = gc->gc.gc_next) { n++; ! if (debug & DEBUG_UNCOLLECTABLE) ! debug_cycle("uncollectable", FROM_GC(gc)); ! } ! for (gc = reachable_from_finalizers.gc.gc_next; ! gc != &reachable_from_finalizers; ! gc = gc->gc.gc_next) { ! n++; ! if (debug & DEBUG_UNCOLLECTABLE) debug_cycle("uncollectable", FROM_GC(gc)); } if (debug & DEBUG_STATS) { *************** *** 637,642 **** /* Append instances in the uncollectable set to a Python * reachable list of garbage. The programmer has to deal with ! * this if they insist on creating this type of structure. */ ! handle_finalizers(&finalizers, old); if (PyErr_Occurred()) { --- 661,668 ---- /* Append instances in the uncollectable set to a Python * reachable list of garbage. The programmer has to deal with ! * this if they insist on creating this type of structure. ! */ ! handle_finalizers(&finalizers, old, 1); ! handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { From tim_one@users.sourceforge.net Sun Apr 6 00:11:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 16:11:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11222/python/Lib/test Modified Files: test_gc.py Log Message: Reworked move_finalizer_reachable() to create two distinct lists: externally unreachable objects with finalizers, and externally unreachable objects without finalizers reachable from such objects. This allows us to call has_finalizer() at most once per object, and so limit the pain of nasty getattr hooks. This fixes the failing "boom 2" example Jeremy posted (a non-printing variant of which is now part of test_gc), via never triggering the nasty part of its __getattr__ method. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_gc.py 5 Apr 2003 17:46:04 -0000 1.25 --- test_gc.py 6 Apr 2003 00:11:38 -0000 1.26 *************** *** 254,258 **** gc.disable() ! class C: def __getattr__(self, someattribute): del self.attr --- 254,258 ---- gc.disable() ! class Boom: def __getattr__(self, someattribute): del self.attr *************** *** 260,265 **** def test_boom(): ! a = C() ! b = C() a.attr = b b.attr = a --- 260,265 ---- def test_boom(): ! a = Boom() ! b = Boom() a.attr = b b.attr = a *************** *** 268,272 **** garbagelen = len(gc.garbage) del a, b ! # a<->b are in a trash cycle now. Collection will invoke C.__getattr__ # (to see whether a and b have __del__ methods), and __getattr__ deletes # the internal "attr" attributes as a side effect. That causes the --- 268,272 ---- garbagelen = len(gc.garbage) del a, b ! # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ # (to see whether a and b have __del__ methods), and __getattr__ deletes # the internal "attr" attributes as a side effect. That causes the *************** *** 277,280 **** --- 277,307 ---- expect(len(gc.garbage), garbagelen, "boom") + class Boom2: + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2(): + a = Boom2() + b = Boom2() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # Much like test_boom(), except that __getattr__ doesn't break the + # cycle until the second time gc checks for __del__. As of 2.3b1, + # there isn't a second time, so this simply cleans up the trash cycle. + # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed + # this way. + expect(gc.collect(), 4, "boom2") + expect(len(gc.garbage), garbagelen, "boom2") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 296,299 **** --- 323,327 ---- run_test("trashcan", test_trashcan) run_test("boom", test_boom) + run_test("boom2", test_boom2) def test(): From tim_one@users.sourceforge.net Sun Apr 6 01:50:52 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 05 Apr 2003 17:50:52 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv4669/Modules Modified Files: gcmodule.c Log Message: Switched from METH_VARARGS to METH_NOARGS for the 7 module functions that take no arguments; cuts generated code size. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** gcmodule.c 6 Apr 2003 00:11:39 -0000 2.63 --- gcmodule.c 6 Apr 2003 01:50:50 -0000 2.64 *************** *** 634,638 **** /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; gc != &finalizers; gc = gc->gc.gc_next) { --- 634,638 ---- /* Collect statistics on uncollectable objects found and print * debugging information. */ ! for (gc = finalizers.gc.gc_next; gc != &finalizers; gc = gc->gc.gc_next) { *************** *** 700,711 **** static PyObject * ! gc_enable(PyObject *self, PyObject *args) { - - if (!PyArg_ParseTuple(args, ":enable")) /* check no args */ - return NULL; - enabled = 1; - Py_INCREF(Py_None); return Py_None; --- 700,706 ---- static PyObject * ! gc_enable(PyObject *self, PyObject *noargs) { enabled = 1; Py_INCREF(Py_None); return Py_None; *************** *** 718,729 **** static PyObject * ! gc_disable(PyObject *self, PyObject *args) { - - if (!PyArg_ParseTuple(args, ":disable")) /* check no args */ - return NULL; - enabled = 0; - Py_INCREF(Py_None); return Py_None; --- 713,719 ---- static PyObject * ! gc_disable(PyObject *self, PyObject *noargs) { enabled = 0; Py_INCREF(Py_None); return Py_None; *************** *** 736,745 **** static PyObject * ! gc_isenabled(PyObject *self, PyObject *args) { - - if (!PyArg_ParseTuple(args, ":isenabled")) /* check no args */ - return NULL; - return Py_BuildValue("i", enabled); } --- 726,731 ---- static PyObject * ! gc_isenabled(PyObject *self, PyObject *noargs) { return Py_BuildValue("i", enabled); } *************** *** 751,764 **** static PyObject * ! gc_collect(PyObject *self, PyObject *args) { long n; ! if (!PyArg_ParseTuple(args, ":collect")) /* check no args */ ! return NULL; ! ! if (collecting) { n = 0; /* already collecting, don't do anything */ - } else { collecting = 1; --- 737,746 ---- static PyObject * ! gc_collect(PyObject *self, PyObject *noargs) { long n; ! if (collecting) n = 0; /* already collecting, don't do anything */ else { collecting = 1; *************** *** 802,810 **** static PyObject * ! gc_get_debug(PyObject *self, PyObject *args) { - if (!PyArg_ParseTuple(args, ":get_debug")) /* no args */ - return NULL; - return Py_BuildValue("i", debug); } --- 784,789 ---- static PyObject * ! gc_get_debug(PyObject *self, PyObject *noargs) { return Py_BuildValue("i", debug); } *************** *** 840,848 **** static PyObject * ! gc_get_thresh(PyObject *self, PyObject *args) { - if (!PyArg_ParseTuple(args, ":get_threshold")) /* no args */ - return NULL; - return Py_BuildValue("(iii)", generations[0].threshold, --- 819,824 ---- static PyObject * ! gc_get_thresh(PyObject *self, PyObject *noargs) { return Py_BuildValue("(iii)", generations[0].threshold, *************** *** 949,963 **** static PyObject * ! gc_get_objects(PyObject *self, PyObject *args) { int i; PyObject* result; - if (!PyArg_ParseTuple(args, ":get_objects")) /* check no args */ - return NULL; result = PyList_New(0); ! if (result == NULL) { return NULL; - } for (i = 0; i < NUM_GENERATIONS; i++) { if (append_objects(result, GEN_HEAD(i))) { --- 925,936 ---- static PyObject * ! gc_get_objects(PyObject *self, PyObject *noargs) { int i; PyObject* result; result = PyList_New(0); ! if (result == NULL) return NULL; for (i = 0; i < NUM_GENERATIONS; i++) { if (append_objects(result, GEN_HEAD(i))) { *************** *** 986,998 **** static PyMethodDef GcMethods[] = { ! {"enable", gc_enable, METH_VARARGS, gc_enable__doc__}, ! {"disable", gc_disable, METH_VARARGS, gc_disable__doc__}, ! {"isenabled", gc_isenabled, METH_VARARGS, gc_isenabled__doc__}, {"set_debug", gc_set_debug, METH_VARARGS, gc_set_debug__doc__}, ! {"get_debug", gc_get_debug, METH_VARARGS, gc_get_debug__doc__}, {"set_threshold", gc_set_thresh, METH_VARARGS, gc_set_thresh__doc__}, ! {"get_threshold", gc_get_thresh, METH_VARARGS, gc_get_thresh__doc__}, ! {"collect", gc_collect, METH_VARARGS, gc_collect__doc__}, ! {"get_objects", gc_get_objects,METH_VARARGS, gc_get_objects__doc__}, {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, --- 959,971 ---- static PyMethodDef GcMethods[] = { ! {"enable", gc_enable, METH_NOARGS, gc_enable__doc__}, ! {"disable", gc_disable, METH_NOARGS, gc_disable__doc__}, ! {"isenabled", gc_isenabled, METH_NOARGS, gc_isenabled__doc__}, {"set_debug", gc_set_debug, METH_VARARGS, gc_set_debug__doc__}, ! {"get_debug", gc_get_debug, METH_NOARGS, gc_get_debug__doc__}, {"set_threshold", gc_set_thresh, METH_VARARGS, gc_set_thresh__doc__}, ! {"get_threshold", gc_get_thresh, METH_NOARGS, gc_get_thresh__doc__}, ! {"collect", gc_collect, METH_NOARGS, gc_collect__doc__}, ! {"get_objects", gc_get_objects,METH_NOARGS, gc_get_objects__doc__}, {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, From rhettinger@users.sourceforge.net Sun Apr 6 10:01:18 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:18 -0800 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.283,2.284 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Python Modified Files: bltinmodule.c Log Message: SF patch #701494: more apply removals Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.283 retrieving revision 2.284 diff -C2 -d -r2.283 -r2.284 *** bltinmodule.c 23 Mar 2003 17:52:28 -0000 2.283 --- bltinmodule.c 6 Apr 2003 09:01:11 -0000 2.284 *************** *** 113,117 **** Call a callable object with positional arguments taken from the tuple args,\n\ and keyword arguments taken from the optional dictionary kwargs.\n\ ! Note that classes are callable, as are instances with a __call__() method."); --- 113,120 ---- Call a callable object with positional arguments taken from the tuple args,\n\ and keyword arguments taken from the optional dictionary kwargs.\n\ ! Note that classes are callable, as are instances with a __call__() method.\n\ ! \n\ ! Deprecated since release 2.3. Instead, use the extended call syntax:\n\ ! function(*args, **keywords)."); From rhettinger@users.sourceforge.net Sun Apr 6 10:01:21 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/compiler transformer.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/compiler Modified Files: transformer.py Log Message: SF patch #701494: more apply removals Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** transformer.py 7 Mar 2003 17:30:47 -0000 1.37 --- transformer.py 6 Apr 2003 09:00:45 -0000 1.38 *************** *** 73,77 **** if nodes.has_key(kind): try: ! return apply(nodes[kind], args[1:]) except TypeError: print nodes[kind], len(args), args --- 73,77 ---- if nodes.has_key(kind): try: ! return nodes[kind](*args[1:]) except TypeError: print nodes[kind], len(args), args From rhettinger@users.sourceforge.net Sun Apr 6 10:01:23 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/curses wrapper.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/curses In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/curses Modified Files: wrapper.py Log Message: SF patch #701494: more apply removals Index: wrapper.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/curses/wrapper.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wrapper.py 29 Sep 2002 00:25:51 -0000 1.6 --- wrapper.py 6 Apr 2003 09:00:47 -0000 1.7 *************** *** 42,46 **** pass ! res = apply(func, (stdscr,) + rest) except: # In the event of an error, restore the terminal --- 42,46 ---- pass ! res = func(stdscr, *rest) except: # In the event of an error, restore the terminal From rhettinger@users.sourceforge.net Sun Apr 6 10:01:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon MediaDescr.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/plat-mac/Carbon Modified Files: MediaDescr.py Log Message: SF patch #701494: more apply removals Index: MediaDescr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/MediaDescr.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MediaDescr.py 30 Dec 2002 22:04:21 -0000 1.1 --- MediaDescr.py 6 Apr 2003 09:01:02 -0000 1.2 *************** *** 5,96 **** class _MediaDescriptionCodec: ! def __init__(self, trunc, size, names, fmt): ! self.trunc = trunc ! self.size = size ! self.names = names ! self.fmt = fmt ! ! def decode(self, data): ! if self.trunc: ! data = data[:self.size] ! values = struct.unpack(self.fmt, data) ! if len(values) != len(self.names): ! raise Error, ('Format length does not match number of names', descr) ! rv = {} ! for i in range(len(values)): ! name = self.names[i] ! value = values[i] ! if type(name) == type(()): ! name, cod, dec = name ! value = dec(value) ! rv[name] = value ! return rv ! ! def encode(dict): ! list = [self.fmt] ! for name in self.names: ! if type(name) == type(()): ! name, cod, dec = name ! else: ! cod = dec = None ! value = dict[name] ! if cod: ! value = cod(value) ! list.append(value) ! rv = apply(struct.pack, tuple(list)) ! return rv ! # Helper functions def _tofixed(float): ! hi = int(float) ! lo = int(float*0x10000) & 0xffff ! return (hi<<16)|lo ! def _fromfixed(fixed): ! hi = (fixed >> 16) & 0xffff ! lo = (fixed & 0xffff) ! return hi + (lo / float(0x10000)) ! def _tostr31(str): ! return chr(len(str)) + str + '\0'*(31-len(str)) ! def _fromstr31(str31): ! return str31[1:1+ord(str31[0])] SampleDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 16, # size ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex'), # Attributes ! "l4slhh" # Format ) SoundDescription = _MediaDescriptionCodec( ! 1, ! 36, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed)), ! "l4slhhhh4shhhhl" # Format ) SoundDescriptionV1 = _MediaDescriptionCodec( ! 1, ! 52, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed), 'samplesPerPacket', ! 'bytesPerPacket', 'bytesPerFrame', 'bytesPerSample'), ! "l4slhhhh4shhhhlllll" # Format ) ImageDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 86, # size ! ('idSize', 'cType', 'resvd1', 'resvd2', 'dataRefIndex', 'version', ! 'revisionLevel', 'vendor', 'temporalQuality', 'spatialQuality', ! 'width', 'height', ('hRes', _tofixed, _fromfixed), ('vRes', _tofixed, _fromfixed), ! 'dataSize', 'frameCount', ('name', _tostr31, _fromstr31), ! 'depth', 'clutID'), ! 'l4slhhhh4sllhhlllh32shh', ) --- 5,96 ---- class _MediaDescriptionCodec: ! def __init__(self, trunc, size, names, fmt): ! self.trunc = trunc ! self.size = size ! self.names = names ! self.fmt = fmt ! ! def decode(self, data): ! if self.trunc: ! data = data[:self.size] ! values = struct.unpack(self.fmt, data) ! if len(values) != len(self.names): ! raise Error, ('Format length does not match number of names', descr) ! rv = {} ! for i in range(len(values)): ! name = self.names[i] ! value = values[i] ! if type(name) == type(()): ! name, cod, dec = name ! value = dec(value) ! rv[name] = value ! return rv ! ! def encode(dict): ! list = [self.fmt] ! for name in self.names: ! if type(name) == type(()): ! name, cod, dec = name ! else: ! cod = dec = None ! value = dict[name] ! if cod: ! value = cod(value) ! list.append(value) ! rv = struct.pack(*list) ! return rv ! # Helper functions def _tofixed(float): ! hi = int(float) ! lo = int(float*0x10000) & 0xffff ! return (hi<<16)|lo ! def _fromfixed(fixed): ! hi = (fixed >> 16) & 0xffff ! lo = (fixed & 0xffff) ! return hi + (lo / float(0x10000)) ! def _tostr31(str): ! return chr(len(str)) + str + '\0'*(31-len(str)) ! def _fromstr31(str31): ! return str31[1:1+ord(str31[0])] SampleDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 16, # size ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex'), # Attributes ! "l4slhh" # Format ) SoundDescription = _MediaDescriptionCodec( ! 1, ! 36, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed)), ! "l4slhhhh4shhhhl" # Format ) SoundDescriptionV1 = _MediaDescriptionCodec( ! 1, ! 52, ! ('descSize', 'dataFormat', 'resvd1', 'resvd2', 'dataRefIndex', ! 'version', 'revlevel', 'vendor', 'numChannels', 'sampleSize', ! 'compressionID', 'packetSize', ('sampleRate', _tofixed, _fromfixed), 'samplesPerPacket', ! 'bytesPerPacket', 'bytesPerFrame', 'bytesPerSample'), ! "l4slhhhh4shhhhlllll" # Format ) ImageDescription = _MediaDescriptionCodec( ! 1, # May be longer, truncate ! 86, # size ! ('idSize', 'cType', 'resvd1', 'resvd2', 'dataRefIndex', 'version', ! 'revisionLevel', 'vendor', 'temporalQuality', 'spatialQuality', ! 'width', 'height', ('hRes', _tofixed, _fromfixed), ('vRes', _tofixed, _fromfixed), ! 'dataSize', 'frameCount', ('name', _tostr31, _fromstr31), ! 'depth', 'clutID'), ! 'l4slhhhh4sllhhlllh32shh', ) From rhettinger@users.sourceforge.net Sun Apr 6 10:01:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Canvas.py,1.18,1.19 Dialog.py,1.5,1.6 ScrolledText.py,1.12,1.13 Tix.py,1.15,1.16 Tkinter.py,1.170,1.171 tkColorChooser.py,1.5,1.6 tkCommonDialog.py,1.6,1.7 tkFont.py,1.3,1.4 tkMessageBox.py,1.1,1.2 tkSimpleDialog.py,1.8,1.9 turtle.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/lib-tk Modified Files: Canvas.py Dialog.py ScrolledText.py Tix.py Tkinter.py tkColorChooser.py tkCommonDialog.py tkFont.py tkMessageBox.py tkSimpleDialog.py turtle.py Log Message: SF patch #701494: more apply removals Index: Canvas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Canvas.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Canvas.py 30 Jan 2003 00:56:32 -0000 1.18 --- Canvas.py 6 Apr 2003 09:00:48 -0000 1.19 *************** *** 56,60 **** flat = () for x, y in pts: flat = flat + (x, y) ! return apply(self.canvas.coords, (self.id,) + flat) def dchars(self, first, last=None): self.canvas.dchars(self.id, first, last) --- 56,60 ---- flat = () for x, y in pts: flat = flat + (x, y) ! return self.canvas.coords(self.id, *flat) def dchars(self, first, last=None): self.canvas.dchars(self.id, first, last) *************** *** 85,122 **** class Arc(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'arc') + args, kw) class Bitmap(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'bitmap') + args, kw) class ImageItem(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'image') + args, kw) class Line(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'line') + args, kw) class Oval(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'oval') + args, kw) class Polygon(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'polygon') + args,kw) class Rectangle(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'rectangle')+args,kw) # XXX "Text" is taken by the Text widget... class CanvasText(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'text') + args, kw) class Window(CanvasItem): def __init__(self, canvas, *args, **kw): ! apply(CanvasItem.__init__, (self, canvas, 'window') + args, kw) class Group: --- 85,122 ---- class Arc(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'arc', *args, **kw) class Bitmap(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'bitmap', *args, **kw) class ImageItem(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'image', *args, **kw) class Line(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'line', *args, **kw) class Oval(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'oval', *args, **kw) class Polygon(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'polygon', *args, **kw) class Rectangle(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'rectangle', *args, **kw) # XXX "Text" is taken by the Text widget... class CanvasText(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'text', *args, **kw) class Window(CanvasItem): def __init__(self, canvas, *args, **kw): ! CanvasItem.__init__(self, canvas, 'window', *args, **kw) class Group: Index: Dialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Dialog.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Dialog.py 23 Oct 2000 18:31:14 -0000 1.5 --- Dialog.py 6 Apr 2003 09:00:49 -0000 1.6 *************** *** 16,24 **** Widget._setup(self, master, cnf) self.num = self.tk.getint( ! apply(self.tk.call, ! ('tk_dialog', self._w, ! cnf['title'], cnf['text'], ! cnf['bitmap'], cnf['default']) ! + cnf['strings'])) try: Widget.destroy(self) except TclError: pass --- 16,24 ---- Widget._setup(self, master, cnf) self.num = self.tk.getint( ! self.tk.call( ! 'tk_dialog', self._w, ! cnf['title'], cnf['text'], ! cnf['bitmap'], cnf['default'], ! *cnf['strings'])) try: Widget.destroy(self) except TclError: pass Index: ScrolledText.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/ScrolledText.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ScrolledText.py 12 Dec 2001 12:47:57 -0000 1.12 --- ScrolledText.py 6 Apr 2003 09:00:49 -0000 1.13 *************** *** 25,33 **** fcnf[k] = cnf[k] del cnf[k] ! self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' ! apply(Text.__init__, (self, self.frame), cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set --- 25,33 ---- fcnf[k] = cnf[k] del cnf[k] ! self.frame = Frame(master, **fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' ! Text.__init__(self, self.frame, **cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set Index: Tix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tix.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Tix.py 30 Dec 2002 23:52:00 -0000 1.15 --- Tix.py 6 Apr 2003 09:00:50 -0000 1.16 *************** *** 223,227 **** def config(self, cnf={}, **kw): ! apply(self.tk.call, ('tixForm', self._w) + self._options(cnf, kw)) form = config --- 223,227 ---- def config(self, cnf={}, **kw): ! self.tk.call('tixForm', self._w, *self._options(cnf, kw)) form = config *************** *** 293,297 **** else: static_options = ['options'] ! for k,v in cnf.items()[:]: if k in static_options: --- 293,297 ---- else: static_options = ['options'] ! for k,v in cnf.items()[:]: if k in static_options: *************** *** 305,309 **** # corresponding Tk widget has already been created by Tix if widgetName: ! apply(self.tk.call, (widgetName, self._w) + extra) # Non-static options - to be done via a 'config' command --- 305,309 ---- # corresponding Tk widget has already been created by Tix if widgetName: ! self.tk.call(widgetName, self._w, *extra) # Non-static options - to be done via a 'config' command *************** *** 475,480 **** elif not master: raise RuntimeError, "Too early to create display style: no root window" self.tk = master.tk ! self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) + ! self._options(cnf,kw) ) def __str__(self): --- 475,480 ---- elif not master: raise RuntimeError, "Too early to create display style: no root window" self.tk = master.tk ! self.stylename = self.tk.call('tixDisplayStyle', itemtype, ! *self._options(cnf,kw) ) def __str__(self): *************** *** 500,505 **** return _lst2dict( self.tk.split( ! apply(self.tk.call, ! (self.stylename, 'configure') + self._options(cnf,kw)))) def __getitem__(self,key): --- 500,505 ---- return _lst2dict( self.tk.split( ! self.tk.call( ! self.stylename, 'configure', *self._options(cnf,kw)))) def __getitem__(self,key): *************** *** 533,538 **** """Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time""" ! apply(self.tk.call, ! (self._w, 'bind', widget._w) + self._options(cnf, kw)) def unbind_widget(self, widget): --- 533,537 ---- """Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time""" ! self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw)) def unbind_widget(self, widget): *************** *** 550,555 **** """Add a button with given name to box.""" ! btn = apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn --- 549,553 ---- """Add a button with given name to box.""" ! btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn *************** *** 590,594 **** # align ! def add_history(self, str): self.tk.call(self._w, 'addhistory', str) --- 588,592 ---- # align ! def add_history(self, str): self.tk.call(self._w, 'addhistory', str) *************** *** 863,874 **** def add(self, entry, cnf={}, **kw): ! return apply(self.tk.call, ! (self._w, 'add', entry) + self._options(cnf, kw)) def add_child(self, parent=None, cnf={}, **kw): if not parent: parent = '' ! return apply(self.tk.call, ! (self._w, 'addchild', parent) + self._options(cnf, kw)) def anchor_set(self, entry): --- 861,871 ---- def add(self, entry, cnf={}, **kw): ! return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) def add_child(self, parent=None, cnf={}, **kw): if not parent: parent = '' ! return self.tk.call( ! self._w, 'addchild', parent, *self._options(cnf, kw)) def anchor_set(self, entry): *************** *** 910,915 **** def header_create(self, col, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'header', 'create', col) + self._options(cnf, kw)) def header_configure(self, col, cnf={}, **kw): --- 907,911 ---- def header_create(self, col, cnf={}, **kw): ! self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw)) def header_configure(self, col, cnf={}, **kw): *************** *** 918,923 **** self.tk.split( self.tk.call(self._w, 'header', 'configure', col))) ! apply(self.tk.call, (self._w, 'header', 'configure', col) ! + self._options(cnf, kw)) def header_cget(self, col, opt): --- 914,919 ---- self.tk.split( self.tk.call(self._w, 'header', 'configure', col))) ! self.tk.call(self._w, 'header', 'configure', col, ! *self._options(cnf, kw)) def header_cget(self, col, opt): *************** *** 937,942 **** def indicator_create(self, entry, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'indicator', 'create', entry) + self._options(cnf, kw)) def indicator_configure(self, entry, cnf={}, **kw): --- 933,938 ---- def indicator_create(self, entry, cnf={}, **kw): ! self.tk.call( ! self._w, 'indicator', 'create', entry, *self._options(cnf, kw)) def indicator_configure(self, entry, cnf={}, **kw): *************** *** 945,950 **** self.tk.split( self.tk.call(self._w, 'indicator', 'configure', entry))) ! apply(self.tk.call, ! (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw)) def indicator_cget(self, entry, opt): --- 941,946 ---- self.tk.split( self.tk.call(self._w, 'indicator', 'configure', entry))) ! self.tk.call( ! self._w, 'indicator', 'configure', entry, *self._options(cnf, kw)) def indicator_cget(self, entry, opt): *************** *** 997,1006 **** self.tk.split( self.tk.call(self._w, 'item', 'configure', entry, col))) ! apply(self.tk.call, (self._w, 'item', 'configure', entry, col) + ! self._options(cnf, kw)) def item_create(self, entry, col, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'item', 'create', entry, col) + self._options(cnf, kw)) def item_exists(self, entry, col): --- 993,1002 ---- self.tk.split( self.tk.call(self._w, 'item', 'configure', entry, col))) ! self.tk.call(self._w, 'item', 'configure', entry, col, ! *self._options(cnf, kw)) def item_create(self, entry, col, cnf={}, **kw): ! self.tk.call( ! self._w, 'item', 'create', entry, col, *self._options(cnf, kw)) def item_exists(self, entry, col): *************** *** 1017,1022 **** def selection_clear(self, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'selection', 'clear') + self._options(cnf, kw)) def selection_includes(self, entry): --- 1013,1017 ---- def selection_clear(self, cnf={}, **kw): ! self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) def selection_includes(self, entry): *************** *** 1030,1037 **** def xview(self, *args): ! apply(self.tk.call, (self._w, 'xview') + args) def yview(self, *args): ! apply(self.tk.call, (self._w, 'yview') + args) class InputOnly(TixWidget): --- 1025,1032 ---- def xview(self, *args): ! self.tk.call(self._w, 'xview', *args) def yview(self, *args): ! self.tk.call(self._w, 'yview', *args) class InputOnly(TixWidget): *************** *** 1094,1099 **** def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] --- 1089,1093 ---- def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] *************** *** 1136,1141 **** def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] --- 1130,1134 ---- def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name) return self.subwidget_list[name] *************** *** 1181,1190 **** def add_command(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', 'command', name) + self._options(cnf, kw)) def add_separator(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', 'separator', name) + self._options(cnf, kw)) def delete(self, name): --- 1174,1181 ---- def add_command(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw)) def add_separator(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw)) def delete(self, name): *************** *** 1213,1218 **** # add delete forget panecget paneconfigure panes setsize def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name, check_intermediate=0) --- 1204,1208 ---- # add delete forget panecget paneconfigure panes setsize def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name, check_intermediate=0) *************** *** 1235,1240 **** self.tk.split( self.tk.call(self._w, 'paneconfigure', entry))) ! apply(self.tk.call, ! (self._w, 'paneconfigure', entry) + self._options(cnf, kw)) def panes(self): --- 1225,1229 ---- self.tk.split( self.tk.call(self._w, 'paneconfigure', entry))) ! self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw)) def panes(self): *************** *** 1362,1367 **** def add(self, name, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return self.subwidget_list[name] --- 1351,1355 ---- def add(self, name, cnf={}, **kw): ! self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return self.subwidget_list[name] *************** *** 1459,1464 **** def insert(self, index, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'insert', index) + self._options(cnf, kw)) def info_active(self): --- 1447,1451 ---- def insert(self, index, cnf={}, **kw): ! self.tk.call(self._w, 'insert', index, *self._options(cnf, kw)) def info_active(self): *************** *** 1494,1499 **** def selection_clear(self, cnf={}, **kw): ! apply(self.tk.call, ! (self._w, 'selection', 'clear') + self._options(cnf, kw)) def selection_includes(self, index): --- 1481,1485 ---- def selection_clear(self, cnf={}, **kw): ! self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) def selection_includes(self, index): *************** *** 1504,1511 **** def xview(self, *args): ! apply(self.tk.call, (self._w, 'xview') + args) def yview(self, *args): ! apply(self.tk.call, (self._w, 'yview') + args) class Tree(TixWidget): --- 1490,1497 ---- def xview(self, *args): ! self.tk.call(self._w, 'xview', *args) def yview(self, *args): ! self.tk.call(self._w, 'yview', *args) class Tree(TixWidget): *************** *** 1808,1812 **** # def xview # def yview ! class ScrolledGrid(TixWidget): '''Scrolled Grid widgets''' --- 1794,1798 ---- # def xview # def yview ! class ScrolledGrid(TixWidget): '''Scrolled Grid widgets''' Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** Tkinter.py 29 Mar 2003 09:47:21 -0000 1.170 --- Tkinter.py 6 Apr 2003 09:00:51 -0000 1.171 *************** *** 5,12 **** widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox ! LabelFrame and PanedWindow. ! Properties of the widgets are specified with keyword arguments. ! Keyword arguments have the same name as the corresponding resource under Tk. --- 5,12 ---- widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, [...1265 lines suppressed...] ! Style is a string that contains zero or more of the ! characters n, s, e or w. The string can optionally ! contains spaces or commas, but they are ignored. Each ! letter refers to a side (north, south, east, or west) ! that the window will "stick" to. If both n and s ! (or e and w) are specified, the window will be ! stretched to fill the entire height (or width) of its cavity. width size ! Specify a width for the window. The width will be ! the outer dimension of the window including its ! border, if any. If size is an empty string, or if -width is not specified, then the width requested ! internally by the window will be used initially; the ! width may later be adjusted by the movement of sashes ! in the panedwindow. Size may be any value accepted by Tk_GetPixels. ! """ if cnf is None and not kw: Index: tkColorChooser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkColorChooser.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tkColorChooser.py 16 Jul 2000 12:04:31 -0000 1.5 --- tkColorChooser.py 6 Apr 2003 09:00:52 -0000 1.6 *************** *** 64,68 **** options["initialcolor"] = color ! return apply(Chooser, (), options).show() --- 64,68 ---- options["initialcolor"] = color ! return Chooser(**options).show() Index: tkCommonDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkCommonDialog.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tkCommonDialog.py 16 Feb 2002 23:16:53 -0000 1.6 --- tkCommonDialog.py 6 Apr 2003 09:00:53 -0000 1.7 *************** *** 50,54 **** try: ! s = apply(w.tk.call, (self.command,) + w._options(self.options)) s = self._fixresult(w, s) --- 50,54 ---- try: ! s = w.tk.call(self.command, *w._options(self.options)) s = self._fixresult(w, s) Index: tkFont.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFont.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tkFont.py 9 Feb 2001 11:17:58 -0000 1.3 --- tkFont.py 6 Apr 2003 09:00:53 -0000 1.4 *************** *** 74,78 **** name = "font" + str(id(self)) self.name = name ! apply(root.tk.call, ("font", "create", name) + font) # backlinks! self._root = root --- 74,78 ---- name = "font" + str(id(self)) self.name = name ! root.tk.call("font", "create", name, *font) # backlinks! self._root = root *************** *** 91,95 **** def copy(self): "Return a distinct copy of the current font" ! return apply(Font, (self._root,), self.actual()) def actual(self, option=None): --- 91,95 ---- def copy(self): "Return a distinct copy of the current font" ! return Font(self._root, **self.actual()) def actual(self, option=None): *************** *** 109,114 **** "Modify font attributes" if options: ! apply(self._call, ("font", "config", self.name) + ! self._set(options)) else: return self._mkdict( --- 109,114 ---- "Modify font attributes" if options: ! self._call("font", "config", self.name, ! *self._set(options)) else: return self._mkdict( Index: tkMessageBox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkMessageBox.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tkMessageBox.py 19 Jul 1997 20:02:36 -0000 1.1 --- tkMessageBox.py 6 Apr 2003 09:00:54 -0000 1.2 *************** *** 73,107 **** if title: options["title"] = title if message: options["message"] = message ! return apply(Message, (), options).show() def showinfo(title=None, message=None, **options): "Show an info message" ! return apply(_show, (title, message, INFO, OK), options) def showwarning(title=None, message=None, **options): "Show a warning message" ! return apply(_show, (title, message, WARNING, OK), options) def showerror(title=None, message=None, **options): "Show an error message" ! return apply(_show, (title, message, ERROR, OK), options) def askquestion(title=None, message=None, **options): "Ask a question" ! return apply(_show, (title, message, QUESTION, YESNO), options) def askokcancel(title=None, message=None, **options): "Ask if operation should proceed; return true if the answer is ok" ! s = apply(_show, (title, message, QUESTION, OKCANCEL), options) return s == OK def askyesno(title=None, message=None, **options): "Ask a question; return true if the answer is yes" ! s = apply(_show, (title, message, QUESTION, YESNO), options) return s == YES def askretrycancel(title=None, message=None, **options): "Ask if operation should be retried; return true if the answer is yes" ! s = apply(_show, (title, message, WARNING, RETRYCANCEL), options) return s == RETRY --- 73,107 ---- if title: options["title"] = title if message: options["message"] = message ! return Message(**options).show() def showinfo(title=None, message=None, **options): "Show an info message" ! return _show(title, message, INFO, OK, **options) def showwarning(title=None, message=None, **options): "Show a warning message" ! return _show(title, message, WARNING, OK, **options) def showerror(title=None, message=None, **options): "Show an error message" ! return _show(title, message, ERROR, OK, **options) def askquestion(title=None, message=None, **options): "Ask a question" ! return _show(title, message, QUESTION, YESNO, **options) def askokcancel(title=None, message=None, **options): "Ask if operation should proceed; return true if the answer is ok" ! s = _show(title, message, QUESTION, OKCANCEL, **options) return s == OK def askyesno(title=None, message=None, **options): "Ask a question; return true if the answer is yes" ! s = _show(title, message, QUESTION, YESNO, **options) return s == YES def askretrycancel(title=None, message=None, **options): "Ask if operation should be retried; return true if the answer is yes" ! s = _show(title, message, WARNING, RETRYCANCEL, **options) return s == RETRY Index: tkSimpleDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkSimpleDialog.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tkSimpleDialog.py 6 Dec 2001 16:51:41 -0000 1.8 --- tkSimpleDialog.py 6 Apr 2003 09:00:54 -0000 1.9 *************** *** 250,254 **** Return value is an integer ''' ! d = apply(_QueryInteger, (title, prompt), kw) return d.result --- 250,254 ---- Return value is an integer ''' ! d = _QueryInteger(title, prompt, **kw) return d.result *************** *** 269,273 **** Return value is a float ''' ! d = apply(_QueryFloat, (title, prompt), kw) return d.result --- 269,273 ---- Return value is a float ''' ! d = _QueryFloat(title, prompt, **kw) return d.result *************** *** 301,305 **** Return value is a string ''' ! d = apply(_QueryString, (title, prompt), kw) return d.result --- 301,305 ---- Return value is a string ''' ! d = _QueryString(title, prompt, **kw) return d.result Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** turtle.py 29 Sep 2002 00:25:51 -0000 1.9 --- turtle.py 6 Apr 2003 09:00:58 -0000 1.10 *************** *** 355,363 **** def down(): _getpen().down() def width(width): _getpen().width(width) ! def color(*args): apply(_getpen().color, args) def write(arg, move=0): _getpen().write(arg, move) def fill(flag): _getpen().fill(flag) def circle(radius, extent=None): _getpen().circle(radius, extent) ! def goto(*args): apply(_getpen().goto, args) def heading(): return _getpen().heading() def setheading(angle): _getpen().setheading(angle) --- 355,363 ---- def down(): _getpen().down() def width(width): _getpen().width(width) ! def color(*args): _getpen().color(*args) def write(arg, move=0): _getpen().write(arg, move) def fill(flag): _getpen().fill(flag) def circle(radius, extent=None): _getpen().circle(radius, extent) ! def goto(*args): _getpen().goto(*args) def heading(): return _getpen().heading() def setheading(angle): _getpen().setheading(angle) From rhettinger@users.sourceforge.net Sun Apr 6 10:01:36 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.11,1.12 FrameWork.py,1.3,1.4 MiniAEFrame.py,1.1,1.2 argvemulator.py,1.2,1.3 icopen.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/plat-mac Modified Files: EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py icopen.py Log Message: SF patch #701494: more apply removals Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/EasyDialogs.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** EasyDialogs.py 24 Mar 2003 12:12:24 -0000 1.11 --- EasyDialogs.py 6 Apr 2003 09:00:59 -0000 1.12 *************** *** 6,10 **** AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons. GetArgv(optionlist, commandlist) -- fill a sys.argv-like list using a dialog ! AskFileForOpen(...) -- Ask the user for an existing file AskFileForSave(...) -- Ask the user for an output file AskFolder(...) -- Ask the user to select a folder --- 6,10 ---- AskYesNoCancel(question, default) -- display a question and Yes, No and Cancel buttons. GetArgv(optionlist, commandlist) -- fill a sys.argv-like list using a dialog ! AskFileForOpen(...) -- Ask the user for an existing file AskFileForSave(...) -- Ask the user for an output file [...1587 lines suppressed...] ! time.sleep(0.05) ! bar.set(0,100) ! for i in xrange(100): ! bar.set(i) ! time.sleep(0.05) ! if i % 10 == 0: ! bar.label(text[(i/10) % 4]) ! bar.label("Done.") ! time.sleep(1.0) # give'em a chance to see "Done." ! finally: ! del bar ! if hasattr(MacOS, 'SchedParams'): ! MacOS.SchedParams(*appsw) if __name__ == '__main__': ! try: ! test() ! except KeyboardInterrupt: ! Message("Operation Canceled.") Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/FrameWork.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FrameWork.py 9 Jan 2003 23:18:39 -0000 1.3 --- FrameWork.py 6 Apr 2003 09:00:59 -0000 1.4 *************** *** 30,39 **** try: ! MyFrontWindow = FrontNonFloatingWindow except NameError: ! MyFrontWindow = FrontWindow ! kHighLevelEvent = 23 # Don't know what header file this should come from ! SCROLLBARWIDTH = 16 # Again, not a clue... # Trick to forestall a set of SIOUX menus being added to our menubar [...2106 lines suppressed...] ! def enablehelp(self, *args): ! hm = self.gethelpmenu() ! self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp) ! ! def nohelp(self, *args): ! print "I told you there isn't any!" ! ! def debug(self, *args): ! import pdb ! pdb.set_trace() def test(): ! "Test program" ! app = TestApp() ! app.mainloop() if __name__ == '__main__': ! test() Index: MiniAEFrame.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/MiniAEFrame.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MiniAEFrame.py 30 Dec 2002 22:04:20 -0000 1.1 --- MiniAEFrame.py 6 Apr 2003 09:01:00 -0000 1.2 *************** *** 2,8 **** There are two classes: ! AEServer -- a mixin class offering nice AE handling. ! MiniApplication -- a very minimal alternative to FrameWork.py, ! only suitable for the simplest of AppleEvent servers. """ --- 2,8 ---- There are two classes: ! AEServer -- a mixin class offering nice AE handling. ! MiniApplication -- a very minimal alternative to FrameWork.py, ! only suitable for the simplest of AppleEvent servers. """ *************** *** 22,199 **** import EasyDialogs ! kHighLevelEvent = 23 # Not defined anywhere for Python yet? class MiniApplication: ! ! """A minimal FrameWork.Application-like class""" ! ! def __init__(self): ! self.quitting = 0 ! # Initialize menu ! self.appleid = 1 ! self.quitid = 2 ! Menu.ClearMenuBar() ! self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") ! applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) ! if MacOS.runtimemodel == 'ppc': ! applemenu.AppendResMenu('DRVR') ! applemenu.InsertMenu(0) ! self.quitmenu = Menu.NewMenu(self.quitid, "File") ! self.quitmenu.AppendMenu("Quit") ! self.quitmenu.SetItemCmd(1, ord("Q")) ! self.quitmenu.InsertMenu(0) ! Menu.DrawMenuBar() ! ! def __del__(self): ! self.close() ! ! def close(self): ! pass ! ! def mainloop(self, mask = everyEvent, timeout = 60*60): ! while not self.quitting: ! self.dooneevent(mask, timeout) ! ! def _quit(self): ! self.quitting = 1 ! ! def dooneevent(self, mask = everyEvent, timeout = 60*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! msg = "High Level Event: %s %s" % \ ! (`code(message)`, `code(h | (v<<16))`) ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! elif what == keyDown: ! c = chr(message & charCodeMask) ! if modifiers & cmdKey: ! if c == '.': ! raise KeyboardInterrupt, "Command-period" ! if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! return ! elif what == mouseDown: ! partcode, window = Win.FindWindow(where) ! if partcode == inMenuBar: ! result = Menu.MenuSelect(where) ! id = (result>>16) & 0xffff # Hi word ! item = result & 0xffff # Lo word ! if id == self.appleid: ! if item == 1: ! EasyDialogs.Message(self.getabouttext()) ! elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): ! name = self.applemenu.GetMenuItemText(item) ! Menu.OpenDeskAcc(name) ! elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! Menu.HiliteMenu(0) ! return ! # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event ! ! def getabouttext(self): ! return self.__class__.__name__ ! ! def getaboutmenutext(self): ! return "About %s\311" % self.__class__.__name__ class AEServer: ! ! def __init__(self): ! self.ae_handlers = {} ! ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = apply(_function, (_object,), _parameters) ! else: ! #Same try/except comment as above ! rv = apply(_function, (), _parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) def code(x): ! "Convert a long int to the 4-character code it really is" ! s = '' ! for i in range(4): ! x, c = divmod(x, 256) ! s = chr(c) + s ! return s class _Test(AEServer, MiniApplication): ! """Mini test application, handles required events""" ! ! def __init__(self): ! MiniApplication.__init__(self) ! AEServer.__init__(self) ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'quit', self.quit) ! self.installaehandler('****', '****', self.other) ! self.mainloop() - def quit(self, **args): - self._quit() - - def open_app(self, **args): - pass - - def other(self, _object=None, _class=None, _type=None, **args): - print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args - if __name__ == '__main__': ! _Test() --- 22,199 ---- import EasyDialogs ! kHighLevelEvent = 23 # Not defined anywhere for Python yet? class MiniApplication: ! ! """A minimal FrameWork.Application-like class""" ! ! def __init__(self): ! self.quitting = 0 ! # Initialize menu ! self.appleid = 1 ! self.quitid = 2 ! Menu.ClearMenuBar() ! self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") ! applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) ! if MacOS.runtimemodel == 'ppc': ! applemenu.AppendResMenu('DRVR') ! applemenu.InsertMenu(0) ! self.quitmenu = Menu.NewMenu(self.quitid, "File") ! self.quitmenu.AppendMenu("Quit") ! self.quitmenu.SetItemCmd(1, ord("Q")) ! self.quitmenu.InsertMenu(0) ! Menu.DrawMenuBar() ! ! def __del__(self): ! self.close() ! ! def close(self): ! pass ! ! def mainloop(self, mask = everyEvent, timeout = 60*60): ! while not self.quitting: ! self.dooneevent(mask, timeout) ! ! def _quit(self): ! self.quitting = 1 ! ! def dooneevent(self, mask = everyEvent, timeout = 60*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! msg = "High Level Event: %s %s" % \ ! (`code(message)`, `code(h | (v<<16))`) ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! elif what == keyDown: ! c = chr(message & charCodeMask) ! if modifiers & cmdKey: ! if c == '.': ! raise KeyboardInterrupt, "Command-period" ! if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! return ! elif what == mouseDown: ! partcode, window = Win.FindWindow(where) ! if partcode == inMenuBar: ! result = Menu.MenuSelect(where) ! id = (result>>16) & 0xffff # Hi word ! item = result & 0xffff # Lo word ! if id == self.appleid: ! if item == 1: ! EasyDialogs.Message(self.getabouttext()) ! elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): ! name = self.applemenu.GetMenuItemText(item) ! Menu.OpenDeskAcc(name) ! elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! Menu.HiliteMenu(0) ! return ! # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event ! ! def getabouttext(self): ! return self.__class__.__name__ ! ! def getaboutmenutext(self): ! return "About %s\311" % self.__class__.__name__ class AEServer: ! ! def __init__(self): ! self.ae_handlers = {} ! ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) def code(x): ! "Convert a long int to the 4-character code it really is" ! s = '' ! for i in range(4): ! x, c = divmod(x, 256) ! s = chr(c) + s ! return s class _Test(AEServer, MiniApplication): ! """Mini test application, handles required events""" ! ! def __init__(self): ! MiniApplication.__init__(self) ! AEServer.__init__(self) ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'quit', self.quit) ! self.installaehandler('****', '****', self.other) ! self.mainloop() ! ! def quit(self, **args): ! self._quit() ! ! def open_app(self, **args): ! pass ! ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! _Test() Index: argvemulator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/argvemulator.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** argvemulator.py 18 Feb 2003 23:28:05 -0000 1.2 --- argvemulator.py 6 Apr 2003 09:01:01 -0000 1.3 *************** *** 12,114 **** class ArgvCollector: - - """A minimal FrameWork.Application-like class""" - - def __init__(self): - self.quitting = 0 - self.ae_handlers = {} - # Remove the funny -psn_xxx_xxx argument - if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': - del sys.argv[1] - self.installaehandler('aevt', 'oapp', self.open_app) - self.installaehandler('aevt', 'odoc', self.open_file) - - def installaehandler(self, classe, type, callback): - AE.AEInstallEventHandler(classe, type, self.callback_wrapper) - self.ae_handlers[(classe, type)] = callback - - def close(self): - for classe, type in self.ae_handlers.keys(): - AE.AERemoveEventHandler(classe, type) - - def mainloop(self, mask = highLevelEventMask, timeout = 1*60): - stoptime = Evt.TickCount() + timeout - while not self.quitting and Evt.TickCount() < stoptime: - self.dooneevent(mask, timeout) - self.close() - - def _quit(self): - self.quitting = 1 - - def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): - got, event = Evt.WaitNextEvent(mask, timeout) - if got: - self.lowlevelhandler(event) - - def lowlevelhandler(self, event): - what, message, when, where, modifiers = event - h, v = where - if what == kHighLevelEvent: - try: - AE.AEProcessAppleEvent(event) - except AE.Error, err: - msg = "High Level Event: %s %s" % \ - (`hex(message)`, `hex(h | (v<<16))`) - print 'AE error: ', err - print 'in', msg - traceback.print_exc() - return - else: - print "Unhandled event:", event ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = apply(_function, (_object,), _parameters) ! else: ! #Same try/except comment as above ! rv = apply(_function, (), _parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) ! def open_app(self, **args): ! self._quit() ! ! def open_file(self, _object=None, **args): ! for alias in _object: ! fsr = alias.FSResolveAlias(None)[0] ! pathname = fsr.as_pathname() ! sys.argv.append(pathname) ! self._quit() ! ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! ArgvCollector().mainloop() ! print "sys.argv=", sys.argv --- 12,114 ---- class ArgvCollector: ! """A minimal FrameWork.Application-like class""" ! def __init__(self): ! self.quitting = 0 ! self.ae_handlers = {} ! # Remove the funny -psn_xxx_xxx argument ! if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': ! del sys.argv[1] ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'odoc', self.open_file) ! ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! ! def mainloop(self, mask = highLevelEventMask, timeout = 1*60): ! stoptime = Evt.TickCount() + timeout ! while not self.quitting and Evt.TickCount() < stoptime: ! self.dooneevent(mask, timeout) ! self.close() ! ! def _quit(self): ! self.quitting = 1 ! ! def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! msg = "High Level Event: %s %s" % \ ! (`hex(message)`, `hex(h | (v<<16))`) ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! else: ! print "Unhandled event:", event ! ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! ! # XXXX Do key-to-name mapping here ! ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) ! ! def open_app(self, **args): ! self._quit() ! ! def open_file(self, _object=None, **args): ! for alias in _object: ! fsr = alias.FSResolveAlias(None)[0] ! pathname = fsr.as_pathname() ! sys.argv.append(pathname) ! self._quit() ! ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! ArgvCollector().mainloop() ! print "sys.argv=", sys.argv Index: icopen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/icopen.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** icopen.py 30 Dec 2002 22:04:20 -0000 1.1 --- icopen.py 6 Apr 2003 09:01:02 -0000 1.2 *************** *** 30,34 **** Put this file in your Python path, and create a file named {Python}:sitecustomize.py that contains: ! import icopen (If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.) --- 30,34 ---- Put this file in your Python path, and create a file named {Python}:sitecustomize.py that contains: ! import icopen (If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.) *************** *** 43,58 **** def _open_with_typer(*args): ! file = apply(_builtin_open, args) ! filename = args[0] ! mode = 'r' ! if args[1:]: ! mode = args[1] ! if mode[0] == 'w': ! from ic import error, settypecreator ! try: ! settypecreator(filename) ! except error: ! pass ! return file __builtin__.open = _open_with_typer --- 43,58 ---- def _open_with_typer(*args): ! file = _builtin_open(*args) ! filename = args[0] ! mode = 'r' ! if args[1:]: ! mode = args[1] ! if mode[0] == 'w': ! from ic import error, settypecreator ! try: ! settypecreator(filename) ! except error: ! pass ! return file __builtin__.open = _open_with_typer *************** *** 64,66 **** _open_with_typer('test.html', 'w') _open_with_typer('test.foo', 'w') ! """ \ No newline at end of file --- 64,66 ---- _open_with_typer('test.html', 'w') _open_with_typer('test.foo', 'w') ! """ From rhettinger@users.sourceforge.net Sun Apr 6 10:01:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:40 -0800 Subject: [Python-checkins] python/dist/src/Lib/test reperf.py,1.1,1.2 test_curses.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/test Modified Files: reperf.py test_curses.py Log Message: SF patch #701494: more apply removals Index: reperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/reperf.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** reperf.py 17 Jul 1998 21:10:42 -0000 1.1 --- reperf.py 6 Apr 2003 09:01:03 -0000 1.2 *************** *** 13,17 **** try: for i in range(n): ! result = apply(func, args, kw) return result finally: --- 13,17 ---- try: for i in range(n): ! result = func(*args, **kw) return result finally: Index: test_curses.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_curses.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_curses.py 23 Jul 2002 19:03:47 -0000 1.2 --- test_curses.py 6 Apr 2003 09:01:05 -0000 1.3 *************** *** 27,31 **** for args in [('a'), ('a', curses.A_BOLD), (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]: ! apply(meth, args) for meth in [stdscr.box, stdscr.clear, stdscr.clrtobot, --- 27,31 ---- for args in [('a'), ('a', curses.A_BOLD), (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]: ! meth(*args) for meth in [stdscr.box, stdscr.clear, stdscr.clrtobot, From rhettinger@users.sourceforge.net Sun Apr 6 10:01:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 01:01:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/xml/dom minidom.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory sc8-pr-cvs1:/tmp/cvs-serv1577/Lib/xml/dom Modified Files: minidom.py Log Message: SF patch #701494: more apply removals Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** minidom.py 26 Jan 2003 08:59:32 -0000 1.50 --- minidom.py 6 Apr 2003 09:01:07 -0000 1.51 *************** *** 1903,1907 **** def _do_pulldom_parse(func, args, kwargs): ! events = apply(func, args, kwargs) toktype, rootNode = events.getEvent() events.expandNode(rootNode) --- 1903,1907 ---- def _do_pulldom_parse(func, args, kwargs): ! events = func(*args, **kwargs) toktype, rootNode = events.getEvent() events.expandNode(rootNode) *************** *** 1916,1920 **** else: from xml.dom import pulldom ! return _do_pulldom_parse(pulldom.parse, (file,), {'parser': parser, 'bufsize': bufsize}) --- 1916,1920 ---- else: from xml.dom import pulldom ! return _do_pulldom_parse(pulldom.parse, (file,), {'parser': parser, 'bufsize': bufsize}) From just@letterror.com Sun Apr 6 11:44:33 2003 From: just@letterror.com (Just van Rossum) Date: Sun, 6 Apr 2003 12:44:33 +0200 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.11,1.12 FrameWork.py,1.3,1.4 MiniAEFrame.py,1.1,1.2 argvemulator.py,1.2,1.3 icopen.py,1.1,1.2 In-Reply-To: Message-ID: rhettinger@users.sourceforge.net wrote: > Modified Files: > EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py > icopen.py > Log Message: > SF patch #701494: more apply removals Ouch, this checkin also detabbed these files! This obscures the real change. Also: whether they need to be detabbed is up to Jack. I assume it was a simple oversight, please back this change out. Just From python@rcn.com Sun Apr 6 19:03:17 2003 From: python@rcn.com (Raymond Hettinger) Date: Sun, 6 Apr 2003 14:03:17 -0400 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6 References: Message-ID: <011301c2fc66$cd8b08e0$3311a044@oemcomputer> ----- Original Message ----- From: To: Sent: Tuesday, April 01, 2003 6:27 PM Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.5,1.6 > Update of /cvsroot/python/python/dist/src/Lib/plat-mac > In directory sc8-pr-cvs1:/tmp/cvs-serv31003 > > Modified Files: > aetools.py > Log Message: > Sigh... The get() and set() commands are not declared in the aete for > the Standard_Suite, but various other suites do expect it (the Finder > implements get() without declaring it itself). It is probably another > case of OSA magic. Adding them to the global base class. > > > Index: aetools.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -C2 -d -r1.5 -r1.6 > *** aetools.py 31 Mar 2003 13:29:32 -0000 1.5 > --- aetools.py 1 Apr 2003 22:27:18 -0000 1.6 > *************** > *** 255,278 **** > item.__class__ = as > return item > > ! def _set(self, _object, _arguments = {}, _attributes = {}): > ! """ _set: set data for an object > ! Required argument: the object > ! Keyword argument _parameters: Parameter dictionary for the set operation > Keyword argument _attributes: AppleEvent attribute dictionary > - Returns: the data > """ > _code = 'core' > _subcode = 'setd' > ! > _arguments['----'] = _object > > _reply, _arguments, _attributes = self.send(_code, _subcode, > _arguments, _attributes) > ! if _arguments.has_key('errn'): > raise Error, decodeerror(_arguments) > ! > if _arguments.has_key('----'): > return _arguments['----'] > > # Tiny Finder class, for local use only > --- 255,287 ---- > item.__class__ = as > return item > + > + get = _get > + > + _argmap_set = { > + 'to' : 'data', > + } > > ! def _set(self, _object, _attributes={}, **_arguments): > ! """set: Set an object's data. > ! Required argument: the object for the command > ! Keyword argument to: The new value. > Keyword argument _attributes: AppleEvent attribute dictionary > """ > _code = 'core' > _subcode = 'setd' > ! > ! keysubst(_arguments, self._argmap_set) > _arguments['----'] = _object > > + > _reply, _arguments, _attributes = self.send(_code, _subcode, > _arguments, _attributes) > ! if _arguments.get('errn', 0): > raise Error, decodeerror(_arguments) > ! # XXXX Optionally decode result > if _arguments.has_key('----'): > return _arguments['----'] > + > + set = _set > > # Tiny Finder class, for local use only > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins From rhettinger@users.sourceforge.net Sun Apr 6 20:13:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 12:13:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.187,1.188 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14878/Lib/test Modified Files: test_descr.py Log Message: SF bug #699934: Obscure error message mwh pointed out that the error message did not make sense if obtained by rearranging the bases. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** test_descr.py 12 Mar 2003 04:25:42 -0000 1.187 --- test_descr.py 6 Apr 2003 19:13:40 -0000 1.188 *************** *** 1063,1069 **** Pane, ScrollingMixin, EditingMixin, object)) ! mro_err_msg = """Cannot create class.The superclasses have conflicting ! inheritance trees which leave the method resolution order (MRO) ! undefined for bases """ def mro_disagreement(): --- 1063,1068 ---- Pane, ScrollingMixin, EditingMixin, object)) ! mro_err_msg = """Cannot create a consistent method resolution ! order (MRO) for bases """ def mro_disagreement(): From rhettinger@users.sourceforge.net Sun Apr 6 20:13:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 06 Apr 2003 12:13:44 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.220,2.221 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14878/Objects Modified Files: typeobject.c Log Message: SF bug #699934: Obscure error message mwh pointed out that the error message did not make sense if obtained by rearranging the bases. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.220 retrieving revision 2.221 diff -C2 -d -r2.220 -r2.221 *** typeobject.c 24 Mar 2003 23:49:49 -0000 2.220 --- typeobject.c 6 Apr 2003 19:13:41 -0000 2.221 *************** *** 1083,1090 **** n = PyDict_Size(set); ! off = PyOS_snprintf(buf, sizeof(buf), "Cannot create class.\ ! The superclasses have conflicting\n\ ! inheritance trees which leave the method resolution order (MRO)\n\ ! undefined for bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { --- 1083,1088 ---- n = PyDict_Size(set); ! off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \ ! consistent method resolution\norder (MRO) for bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { From tim_one@users.sourceforge.net Sun Apr 6 20:41:48 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 06 Apr 2003 12:41:48 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.64,2.65 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26159/Modules Modified Files: gcmodule.c Log Message: handle_finalizers(): Rewrote to call append_objects() and gc_list_merge() instead of looping. Smaller and clearer. Faster, too, when we're not appending to gc.garbage: gc_list_merge() takes constant time, regardless of the lists' sizes. append_objects(): Moved up to live with the other list manipulation utilities. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -d -r2.64 -r2.65 *** gcmodule.c 6 Apr 2003 01:50:50 -0000 2.64 --- gcmodule.c 6 Apr 2003 19:41:39 -0000 2.65 *************** *** 183,186 **** --- 183,204 ---- } + /* Append objects in a GC list to a Python list. + * Return 0 if all OK, < 0 if error (out of memory for list). + */ + static int + append_objects(PyObject *py_list, PyGC_Head *gc_list) + { + PyGC_Head *gc; + for (gc = gc_list->gc.gc_next; gc != gc_list; gc = gc->gc.gc_next) { + PyObject *op = FROM_GC(gc); + if (op != py_list) { + if (PyList_Append(py_list, op)) { + return -1; /* exception */ + } + } + } + return 0; + } + /*** end of list stuff ***/ *************** *** 458,466 **** /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). */ ! static void handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { - PyGC_Head *gc; if (garbage == NULL) { garbage = PyList_New(0); --- 476,488 ---- /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). + * If DEBUG_SAVEALL or hasfinalizer, the objects in finalizers are appended + * to the module garbage list (a Python list). The objects in finalizers + * are merged into the old list regardless. + * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). + * The finalizers list is made empty on a successful return. */ ! static int handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { if (garbage == NULL) { garbage = PyList_New(0); *************** *** 468,488 **** Py_FatalError("gc couldn't create gc.garbage list"); } ! for (gc = finalizers->gc.gc_next; ! gc != finalizers; ! gc = finalizers->gc.gc_next) { ! PyObject *op = FROM_GC(gc); ! ! assert(IS_REACHABLE(op)); ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { ! /* If SAVEALL is not set then just append objects with ! * finalizers to the list of garbage. All objects in ! * the finalizers list are reachable from those ! * objects. ! */ ! PyList_Append(garbage, op); ! } ! gc_list_remove(gc); ! gc_list_append(gc, old); } } --- 490,499 ---- Py_FatalError("gc couldn't create gc.garbage list"); } ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { ! if (append_objects(garbage, finalizers) < 0) ! return -1; } + gc_list_merge(finalizers, old); + return 0; } *************** *** 663,668 **** * this if they insist on creating this type of structure. */ ! handle_finalizers(&finalizers, old, 1); ! handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { --- 674,679 ---- * this if they insist on creating this type of structure. */ ! if (handle_finalizers(&finalizers, old, 1) == 0) ! (void)handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { *************** *** 907,926 **** "Return a list of objects tracked by the collector (excluding the list\n" "returned).\n"); - - /* appending objects in a GC list to a Python list */ - static int - append_objects(PyObject *py_list, PyGC_Head *gc_list) - { - PyGC_Head *gc; - for (gc = gc_list->gc.gc_next; gc != gc_list; gc = gc->gc.gc_next) { - PyObject *op = FROM_GC(gc); - if (op != py_list) { - if (PyList_Append(py_list, op)) { - return -1; /* exception */ - } - } - } - return 0; - } static PyObject * --- 918,921 ---- From tim_one@users.sourceforge.net Mon Apr 7 00:30:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 06 Apr 2003 16:30:56 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.65,2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29154/Modules Modified Files: gcmodule.c Log Message: initgc(): Rewrote to use the PyModule_AddXYZ API; cuts code size. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** gcmodule.c 6 Apr 2003 19:41:39 -0000 2.65 --- gcmodule.c 6 Apr 2003 23:30:52 -0000 2.66 *************** *** 974,978 **** { PyObject *m; - PyObject *d; m = Py_InitModule4("gc", --- 974,977 ---- *************** *** 981,1003 **** NULL, PYTHON_API_VERSION); ! d = PyModule_GetDict(m); if (garbage == NULL) { garbage = PyList_New(0); } ! PyDict_SetItemString(d, "garbage", garbage); ! PyDict_SetItemString(d, "DEBUG_STATS", ! PyInt_FromLong(DEBUG_STATS)); ! PyDict_SetItemString(d, "DEBUG_COLLECTABLE", ! PyInt_FromLong(DEBUG_COLLECTABLE)); ! PyDict_SetItemString(d, "DEBUG_UNCOLLECTABLE", ! PyInt_FromLong(DEBUG_UNCOLLECTABLE)); ! PyDict_SetItemString(d, "DEBUG_INSTANCES", ! PyInt_FromLong(DEBUG_INSTANCES)); ! PyDict_SetItemString(d, "DEBUG_OBJECTS", ! PyInt_FromLong(DEBUG_OBJECTS)); ! PyDict_SetItemString(d, "DEBUG_SAVEALL", ! PyInt_FromLong(DEBUG_SAVEALL)); ! PyDict_SetItemString(d, "DEBUG_LEAK", ! PyInt_FromLong(DEBUG_LEAK)); } --- 980,1000 ---- NULL, PYTHON_API_VERSION); ! if (garbage == NULL) { garbage = PyList_New(0); + if (garbage == NULL) + return; } ! if (PyModule_AddObject(m, "garbage", garbage) < 0) ! return; ! #define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) return ! ADD_INT(DEBUG_STATS); ! ADD_INT(DEBUG_COLLECTABLE); ! ADD_INT(DEBUG_UNCOLLECTABLE); ! ADD_INT(DEBUG_INSTANCES); ! ADD_INT(DEBUG_OBJECTS); ! ADD_INT(DEBUG_SAVEALL); ! ADD_INT(DEBUG_LEAK); ! #undef ADD_INT } From anthonybaxter@users.sourceforge.net Mon Apr 7 13:19:17 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 07 Apr 2003 05:19:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,NONE,1.1 lib.tex,1.216,1.217 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19214 Modified Files: lib.tex Added Files: libhotshot.tex Log Message: patch [ 698505 ] docs for hotshot module --- NEW FILE: libhotshot.tex --- \section{\module{hotshot} --- High performance logging profiler} \declaremodule{standard}{hotshot} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} \versionadded{2.2} \modulesynopsis{High performance logging profiler, mostly written in C.} This module provides a nicer interface to the \code{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's written mostly in C, it should result in a much smaller performance impact than the existing profile module. \begin{classdesc}{Profile}{logfile, \optional{, lineevents=0, linetimings=1}} The profiler object. The argument \var{logfile} is the name of a log file to use for logged profile data. The argument \var{lineevents} specifies whether to generate events for every source line, or just on function call/return. It defaults to 0 (only log function call/return). The argument \var{linetimings} specifies whether to record timing information. It defaults to 1 (store timing information). \end{classdesc} \subsection{Profile Objects \label{hotshot-objects}} Profile objects have the following methods: \begin{methoddesc}{addinfo}{key, value} Add an arbitrary labelled value to the profile output. \end{methoddesc} \begin{methoddesc}{close}{} Close the logfile and terminate the profiler. \end{methoddesc} % \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. \end{methoddesc} \begin{methoddesc}{run}{cmd} Profile an exec-compatible string in the script environment. The globals from the \module{__main__} module are used as both the globals and locals for the script. \end{methoddesc} \begin{methoddesc}{runcall}{func, *args, **keywords} Profile a single call of a callable. Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are allowed to propogate cleanly, while ensuring that profiling is disabled on the way out. \end{methoddesc} \begin{methoddesc}{runctx}{cmd, globals, locals} Evaluate an exec-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} \begin{methoddesc}{start}{} Start the profiler. \end{methoddesc} \begin{methoddesc}{stop}{} Stop the profiler. \end{methoddesc} \subsection{Using hotshot data} \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} \seemodule{profile}{The profile module's \class{Stats} class. } \end{seealso} \subsection{Example Usage \label{hotshot-example}} \begin{verbatim} >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") >>> benchtime, stones = prof.runcall(test.pystone.pystones) >>> prof.close() >>> stats = hotshot.stats.load("stones.prof") >>> stats.strip_dirs() >>> stats.sort_stats('time', 'calls') >>> stats.print_stats(20) 850004 function calls in 10.090 CPU seconds Ordered by: internal time, call count ncalls tottime percall cumtime percall filename:lineno(function) 1 3.295 3.295 10.090 10.090 pystone.py:79(Proc0) 150000 1.315 0.000 1.315 0.000 pystone.py:203(Proc7) 50000 1.313 0.000 1.463 0.000 pystone.py:229(Func2) . . . \end{verbatim} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** lib.tex 20 Mar 2003 23:35:00 -0000 1.216 --- lib.tex 7 Apr 2003 12:19:14 -0000 1.217 *************** *** 206,209 **** --- 206,210 ---- \input{libprofile} % The Python Profiler + \input{libhotshot} % New profiler \input{internet} % Internet Protocols From anthonybaxter@users.sourceforge.net Mon Apr 7 13:22:00 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 07 Apr 2003 05:22:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20202 Modified Files: libhotshot.tex Log Message: add note suggested by rhettinger about example. Index: libhotshot.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhotshot.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libhotshot.tex 7 Apr 2003 12:19:15 -0000 1.1 --- libhotshot.tex 7 Apr 2003 12:21:56 -0000 1.2 *************** *** 97,100 **** --- 97,103 ---- \subsection{Example Usage \label{hotshot-example}} + Note that this example runs the python "benchmark" pystones. It can + take some time to run, and will produce large output files. + \begin{verbatim} From tim_one@users.sourceforge.net Mon Apr 7 18:52:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 10:52:01 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv9658/Include Modified Files: classobject.h Log Message: New private API function _PyInstance_Lookup. gc will use this to figure out whether __del__ exists, without executing any Python-level code. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** classobject.h 12 Aug 2002 07:21:56 -0000 2.41 --- classobject.h 7 Apr 2003 17:51:58 -0000 2.42 *************** *** 52,55 **** --- 52,67 ---- PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); + /* Look up attribute with name (a string) on instance object pinst, using + * only the instance and base class dicts. If a descriptor is found in + * a class dict, the descriptor is returned without calling it. + * Returns NULL if nothing found, else a borrowed reference to the + * value associated with name in the dict in which name was found. + * The point of this routine is that it never calls arbitrary Python + * code, so is always "safe": all it does is dict lookups. The function + * can't fail, never sets an exceptionm, and NULL is not an error (it just + * means "not found"). + */ + PyAPI_FUNC(PyObject *)_PyInstance_Lookup(PyObject *pinst, PyObject *name); + /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ From tim_one@users.sourceforge.net Mon Apr 7 18:52:03 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 10:52:03 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.168,2.169 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv9658/Objects Modified Files: classobject.c Log Message: New private API function _PyInstance_Lookup. gc will use this to figure out whether __del__ exists, without executing any Python-level code. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** classobject.c 11 Feb 2003 18:43:00 -0000 2.168 --- classobject.c 7 Apr 2003 17:51:59 -0000 2.169 *************** *** 760,763 **** --- 760,784 ---- } + /* See classobject.h comments: this only does dict lookups, and is always + * safe to call. + */ + PyObject * + _PyInstance_Lookup(PyObject *pinst, PyObject *name) + { + PyObject *v; + PyClassObject *class; + PyInstanceObject *inst; /* pinst cast to the right type */ + + assert(PyInstance_Check(pinst)); + inst = (PyInstanceObject *)pinst; + + assert(PyString_Check(name)); + + v = PyDict_GetItem(inst->in_dict, name); + if (v == NULL) + v = class_lookup(inst->in_class, name, &class); + return v; + } + static int instance_setattr1(PyInstanceObject *inst, PyObject *name, PyObject *v) From tim_one@users.sourceforge.net Mon Apr 7 20:21:21 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 12:21:21 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25392/python/Modules Modified Files: gcmodule.c Log Message: Reworked has_finalizer() to use the new _PyObject_Lookup() instead of PyObject_HasAttr(); the former promises never to execute arbitrary Python code. Undid many of the changes recently made to worm around the worst consequences of that PyObject_HasAttr() could execute arbitrary Python code. Compatibility is hard to discuss, because the dangerous cases are so perverse, and much of this appears to rely on implementation accidents. To start with, using hasattr() to check for __del__ wasn't only dangerous, in some cases it was wrong: if an instance of an old- style class didn't have "__del__" in its instance dict or in any base class dict, but a getattr hook said __del__ existed, then hasattr() said "yes, this object has a __del__". But instance_dealloc() ignores the possibility of getattr hooks when looking for a __del__, so while object.__del__ succeeds, no __del__ method is called when the object is deleted. gc was therefore incorrect in believing that the object had a finalizer. The new method doesn't suffer that problem (like instance_dealloc(), _PyObject_Lookup() doesn't believe __del__ exists in that case), but does suffer a somewhat opposite-- and even more obscure --oddity: if an instance of an old-style class doesn't have "__del__" in its instance dict, and a base class does have "__del__" in its dict, and the first base class with a "__del__" associates it with a descriptor (an object with a __get__ method), *and* if that descriptor raises an exception when __get__ is called, then (a) the current method believes the instance does have a __del__, but (b) hasattr() does not believe the instance has a __del__. While these disagree, I believe the new method is "more correct": because the descriptor *will* be called when the object is destructed, it can execute arbitrary Python code at the time the object is destructed, and that's really what gc means by "has a finalizer": not specifically a __del__ method, but more generally the possibility of executing arbitrary Python code at object destruction time. Code in a descriptor's __get__() executed at destruction time can be just as problematic as code in a __del__() executed then. So I believe the new method is better on all counts. Bugfix candidate, but it's unclear to me how all this differs in the 2.2 branch (e.g., new-style and old-style classes already took different gc paths in 2.3 before this last round of patches, but don't in the 2.2 branch). Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** gcmodule.c 6 Apr 2003 23:30:52 -0000 2.66 --- gcmodule.c 7 Apr 2003 19:21:15 -0000 2.67 *************** *** 360,366 **** /* Return true if object has a finalization method. * CAUTION: An instance of an old-style class has to be checked for a ! *__del__ method, and that can cause arbitrary Python code to get executed ! * via the class's __getattr__ hook (if any). This function can therefore ! * mutate the object graph, and that's been the source of subtle bugs. */ static int --- 360,367 ---- /* Return true if object has a finalization method. * CAUTION: An instance of an old-style class has to be checked for a ! *__del__ method, and earlier versions of this used to call PyObject_HasAttr, ! * which in turn could call the class's __getattr__ hook (if any). That ! * could invoke arbitrary Python code, mutating the object graph in arbitrary ! * ways, and that was the source of some excruciatingly subtle bugs. */ static int *************** *** 368,376 **** { if (PyInstance_Check(op)) { - /* This is the dangerous path: hasattr can invoke - * the class __getattr__(), and that can do anything. - */ assert(delstr != NULL); ! return PyObject_HasAttr(op, delstr); } else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) --- 369,374 ---- { if (PyInstance_Check(op)) { assert(delstr != NULL); ! return _PyInstance_Lookup(op, delstr) != NULL; } else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) *************** *** 380,415 **** } ! /* Move all objects out of unreachable, into collectable or finalizers. ! * It's possible that some objects will get collected (via refcount falling ! * to 0), or resurrected, as a side effect of checking for __del__ methods. ! * After, finalizers contains all the objects from unreachable that haven't ! * been collected by magic, and that have a finalizer. gc_refs is ! * GC_REACHABLE for all of those. collectable contains all the remaining ! * objects from unreachable, and gc_refs remains GC_TENTATIVELY_UNREACHABLE ! * for those (we're still not sure they're reclaimable after this! Some ! * may yet by reachable *from* the objects in finalizers). */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *collectable, ! PyGC_Head *finalizers) { ! while (!gc_list_is_empty(unreachable)) { ! PyGC_Head *gc = unreachable->gc.gc_next; PyObject *op = FROM_GC(gc); ! int finalizer; assert(IS_TENTATIVELY_UNREACHABLE(op)); ! finalizer = has_finalizer(op); ! if (unreachable->gc.gc_next == gc) { gc_list_remove(gc); ! if (finalizer) { ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! else ! gc_list_append(gc, collectable); } ! /* else has_finalizer() deleted op via side effect */ } } --- 378,403 ---- } ! /* Move the objects in unreachable with __del__ methods into finalizers. ! * The objects remaining in unreachable do not have __del__ methods, and ! * gc_refs remains GC_TENTATIVELY_UNREACHABLE for them. The objects ! * moved into finalizers have gc_refs changed to GC_REACHABLE. */ static void ! move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { ! PyGC_Head *gc = unreachable->gc.gc_next; ! ! while (gc != unreachable) { PyObject *op = FROM_GC(gc); ! PyGC_Head *next = gc->gc.gc_next; assert(IS_TENTATIVELY_UNREACHABLE(op)); ! if (has_finalizer(op)) { gc_list_remove(gc); ! gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; } ! gc = next; } } *************** *** 431,439 **** /* Move objects that are reachable from finalizers, from the unreachable set ! * into the reachable_from_finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers, ! PyGC_Head *reachable_from_finalizers) { traverseproc traverse; --- 419,426 ---- /* Move objects that are reachable from finalizers, from the unreachable set ! * into finalizers set. */ static void ! move_finalizer_reachable(PyGC_Head *finalizers) { traverseproc traverse; *************** *** 444,448 **** (void) traverse(FROM_GC(gc), (visitproc)visit_move, ! (void *)reachable_from_finalizers); } } --- 431,435 ---- (void) traverse(FROM_GC(gc), (visitproc)visit_move, ! (void *)finalizers); } } *************** *** 476,488 **** /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). ! * If DEBUG_SAVEALL or hasfinalizer, the objects in finalizers are appended ! * to the module garbage list (a Python list). The objects in finalizers ! * are merged into the old list regardless. * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). * The finalizers list is made empty on a successful return. */ static int ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old, int hasfinalizer) { if (garbage == NULL) { garbage = PyList_New(0); --- 463,478 ---- /* Handle uncollectable garbage (cycles with finalizers, and stuff reachable * only from such cycles). ! * If DEBUG_SAVEALL, all objects in finalizers are appended to the module ! * garbage list (a Python list), else only the objects in finalizers with ! * __del__ methods are appended to garbage. All objects in finalizers are ! * merged into the old list regardless. * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). * The finalizers list is made empty on a successful return. */ static int ! handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { + PyGC_Head *gc = finalizers->gc.gc_next; + if (garbage == NULL) { garbage = PyList_New(0); *************** *** 490,497 **** Py_FatalError("gc couldn't create gc.garbage list"); } ! if ((debug & DEBUG_SAVEALL) || hasfinalizer) { ! if (append_objects(garbage, finalizers) < 0) ! return -1; } gc_list_merge(finalizers, old); return 0; --- 480,492 ---- Py_FatalError("gc couldn't create gc.garbage list"); } ! for (; gc != finalizers; gc = gc->gc.gc_next) { ! PyObject *op = FROM_GC(gc); ! ! if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { ! if (PyList_Append(garbage, op) < 0) ! return -1; ! } } + gc_list_merge(finalizers, old); return 0; *************** *** 542,548 **** PyGC_Head *old; /* next older generation */ PyGC_Head unreachable; - PyGC_Head collectable; PyGC_Head finalizers; - PyGC_Head reachable_from_finalizers; PyGC_Head *gc; --- 537,541 ---- *************** *** 607,635 **** * instance objects with __del__ methods. * ! * Move each unreachable object into the collectable set or the ! * finalizers set. Because we need to check for __del__ methods on ! * instances of classic classes, arbitrary Python code may get ! * executed by getattr hooks: that may resurrect or deallocate (via ! * refcount falling to 0) unreachable objects, so this is very ! * delicate. ! */ ! gc_list_init(&collectable); gc_list_init(&finalizers); ! move_finalizers(&unreachable, &collectable, &finalizers); /* finalizers contains the unreachable objects with a finalizer; * unreachable objects reachable only *from* those are also ! * uncollectable; we move those into a separate list ! * (reachable_from_finalizers) so we don't have to do the dangerous ! * has_finalizer() test again later. */ ! gc_list_init(&reachable_from_finalizers); ! move_finalizer_reachable(&finalizers, &reachable_from_finalizers); ! /* And move everything only reachable from the reachable stuff. */ ! move_finalizer_reachable(&reachable_from_finalizers, ! &reachable_from_finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = collectable.gc.gc_next; gc != &collectable; gc = gc->gc.gc_next) { m++; --- 600,616 ---- * instance objects with __del__ methods. * ! * Move unreachable objects with finalizers into a different list. ! */ gc_list_init(&finalizers); ! move_finalizers(&unreachable, &finalizers); /* finalizers contains the unreachable objects with a finalizer; * unreachable objects reachable only *from* those are also ! * uncollectable, and we move those into the finalizers list too. */ ! move_finalizer_reachable(&finalizers); /* Collect statistics on collectable objects found and print * debugging information. */ ! for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; *************** *** 641,645 **** * the reference cycles to be broken. It may also cause some objects * in finalizers and/or reachable_from_finalizers to be freed */ ! delete_garbage(&collectable, old); /* Collect statistics on uncollectable objects found and print --- 622,626 ---- * the reference cycles to be broken. It may also cause some objects * in finalizers and/or reachable_from_finalizers to be freed */ ! delete_garbage(&unreachable, old); /* Collect statistics on uncollectable objects found and print *************** *** 652,662 **** debug_cycle("uncollectable", FROM_GC(gc)); } - for (gc = reachable_from_finalizers.gc.gc_next; - gc != &reachable_from_finalizers; - gc = gc->gc.gc_next) { - n++; - if (debug & DEBUG_UNCOLLECTABLE) - debug_cycle("uncollectable", FROM_GC(gc)); - } if (debug & DEBUG_STATS) { if (m == 0 && n == 0) { --- 633,636 ---- *************** *** 674,684 **** * this if they insist on creating this type of structure. */ ! if (handle_finalizers(&finalizers, old, 1) == 0) ! (void)handle_finalizers(&reachable_from_finalizers, old, 0); if (PyErr_Occurred()) { ! if (gc_str == NULL) { gc_str = PyString_FromString("garbage collection"); - } PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); --- 648,656 ---- * this if they insist on creating this type of structure. */ ! (void)handle_finalizers(&finalizers, old); if (PyErr_Occurred()) { ! if (gc_str == NULL) gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); From tim_one@users.sourceforge.net Mon Apr 7 20:21:45 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 12:21:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25392/python/Lib/test Modified Files: test_gc.py Log Message: Reworked has_finalizer() to use the new _PyObject_Lookup() instead of PyObject_HasAttr(); the former promises never to execute arbitrary Python code. Undid many of the changes recently made to worm around the worst consequences of that PyObject_HasAttr() could execute arbitrary Python code. Compatibility is hard to discuss, because the dangerous cases are so perverse, and much of this appears to rely on implementation accidents. To start with, using hasattr() to check for __del__ wasn't only dangerous, in some cases it was wrong: if an instance of an old- style class didn't have "__del__" in its instance dict or in any base class dict, but a getattr hook said __del__ existed, then hasattr() said "yes, this object has a __del__". But instance_dealloc() ignores the possibility of getattr hooks when looking for a __del__, so while object.__del__ succeeds, no __del__ method is called when the object is deleted. gc was therefore incorrect in believing that the object had a finalizer. The new method doesn't suffer that problem (like instance_dealloc(), _PyObject_Lookup() doesn't believe __del__ exists in that case), but does suffer a somewhat opposite-- and even more obscure --oddity: if an instance of an old-style class doesn't have "__del__" in its instance dict, and a base class does have "__del__" in its dict, and the first base class with a "__del__" associates it with a descriptor (an object with a __get__ method), *and* if that descriptor raises an exception when __get__ is called, then (a) the current method believes the instance does have a __del__, but (b) hasattr() does not believe the instance has a __del__. While these disagree, I believe the new method is "more correct": because the descriptor *will* be called when the object is destructed, it can execute arbitrary Python code at the time the object is destructed, and that's really what gc means by "has a finalizer": not specifically a __del__ method, but more generally the possibility of executing arbitrary Python code at object destruction time. Code in a descriptor's __get__() executed at destruction time can be just as problematic as code in a __del__() executed then. So I believe the new method is better on all counts. Bugfix candidate, but it's unclear to me how all this differs in the 2.2 branch (e.g., new-style and old-style classes already took different gc paths in 2.3 before this last round of patches, but don't in the 2.2 branch). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_gc.py 6 Apr 2003 00:11:38 -0000 1.26 --- test_gc.py 7 Apr 2003 19:21:11 -0000 1.27 *************** *** 273,278 **** # trash cycle to get reclaimed via refcounts falling to 0, thus mutating # the trash graph as a side effect of merely asking whether __del__ ! # exists. This used to (before 2.3b1) crash Python. ! expect(gc.collect(), 0, "boom") expect(len(gc.garbage), garbagelen, "boom") --- 273,279 ---- # trash cycle to get reclaimed via refcounts falling to 0, thus mutating # the trash graph as a side effect of merely asking whether __del__ ! # exists. This used to (before 2.3b1) crash Python. Now __getattr__ ! # isn't called. ! expect(gc.collect(), 4, "boom") expect(len(gc.garbage), garbagelen, "boom") From tim_one@users.sourceforge.net Mon Apr 7 20:21:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 12:21:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.713,1.714 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25392/python/Misc Modified Files: NEWS Log Message: Reworked has_finalizer() to use the new _PyObject_Lookup() instead of PyObject_HasAttr(); the former promises never to execute arbitrary Python code. Undid many of the changes recently made to worm around the worst consequences of that PyObject_HasAttr() could execute arbitrary Python code. Compatibility is hard to discuss, because the dangerous cases are so perverse, and much of this appears to rely on implementation accidents. To start with, using hasattr() to check for __del__ wasn't only dangerous, in some cases it was wrong: if an instance of an old- style class didn't have "__del__" in its instance dict or in any base class dict, but a getattr hook said __del__ existed, then hasattr() said "yes, this object has a __del__". But instance_dealloc() ignores the possibility of getattr hooks when looking for a __del__, so while object.__del__ succeeds, no __del__ method is called when the object is deleted. gc was therefore incorrect in believing that the object had a finalizer. The new method doesn't suffer that problem (like instance_dealloc(), _PyObject_Lookup() doesn't believe __del__ exists in that case), but does suffer a somewhat opposite-- and even more obscure --oddity: if an instance of an old-style class doesn't have "__del__" in its instance dict, and a base class does have "__del__" in its dict, and the first base class with a "__del__" associates it with a descriptor (an object with a __get__ method), *and* if that descriptor raises an exception when __get__ is called, then (a) the current method believes the instance does have a __del__, but (b) hasattr() does not believe the instance has a __del__. While these disagree, I believe the new method is "more correct": because the descriptor *will* be called when the object is destructed, it can execute arbitrary Python code at the time the object is destructed, and that's really what gc means by "has a finalizer": not specifically a __del__ method, but more generally the possibility of executing arbitrary Python code at object destruction time. Code in a descriptor's __get__() executed at destruction time can be just as problematic as code in a __del__() executed then. So I believe the new method is better on all counts. Bugfix candidate, but it's unclear to me how all this differs in the 2.2 branch (e.g., new-style and old-style classes already took different gc paths in 2.3 before this last round of patches, but don't in the 2.2 branch). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.713 retrieving revision 1.714 diff -C2 -d -r1.713 -r1.714 *** NEWS 4 Apr 2003 22:56:42 -0000 1.713 --- NEWS 7 Apr 2003 19:21:12 -0000 1.714 *************** *** 13,16 **** --- 13,24 ---- ----------------- + - Some horridly obscure problems were fixed involving interaction + between garbage collection and old-style classes with "ambitious" + getattr hooks. If an old-style instance didn't have a __del__ method, + but did have a __getattr__ hook, and the instance became reachable + only from an unreachable cycle, and the hook resurrected or deleted + unreachable objects when asked to resolve "__del__", anything up to + a segfault could happen. That's been repaired. + - dict.pop now takes an optional argument specifying a default value to return if the key is not in the dict. If a default is not *************** *** 78,82 **** result for classes that define __eq__ without defining __ne__. ! - sgmllib now supports SGML marked sections, in particular the MS Office extensions. --- 86,90 ---- result for classes that define __eq__ without defining __ne__. ! - sgmllib now supports SGML marked sections, in particular the MS Office extensions. *************** *** 155,162 **** currently in the background they will ask to be moved to the foreground before displaying. ! - OSA Scripting support has improved a lot, and gensuitemodule.py can now be used by mere mortals. ! - The IDE (in a framework build) now includes introductory documentation in Apple Help Viewer format. --- 163,170 ---- currently in the background they will ask to be moved to the foreground before displaying. ! - OSA Scripting support has improved a lot, and gensuitemodule.py can now be used by mere mortals. ! - The IDE (in a framework build) now includes introductory documentation in Apple Help Viewer format. From tim_one@users.sourceforge.net Mon Apr 7 23:41:29 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 07 Apr 2003 15:41:29 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.67,2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24916/python/Modules Modified Files: gcmodule.c Log Message: Comment repair; no semantic changes. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** gcmodule.c 7 Apr 2003 19:21:15 -0000 2.67 --- gcmodule.c 7 Apr 2003 22:41:24 -0000 2.68 *************** *** 619,625 **** } } ! /* Call tp_clear on objects in the collectable set. This will cause ! * the reference cycles to be broken. It may also cause some objects ! * in finalizers and/or reachable_from_finalizers to be freed */ delete_garbage(&unreachable, old); --- 619,626 ---- } } ! /* Call tp_clear on objects in the unreachable set. This will cause ! * the reference cycles to be broken. It may also cause some objects ! * in finalizers to be freed. ! */ delete_garbage(&unreachable, old); *************** *** 652,656 **** if (PyErr_Occurred()) { if (gc_str == NULL) ! gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); --- 653,657 ---- if (PyErr_Occurred()) { if (gc_str == NULL) ! gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); From tim_one@users.sourceforge.net Tue Apr 8 17:39:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:39:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.714,1.715 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Misc Modified Files: NEWS Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.714 retrieving revision 1.715 diff -C2 -d -r1.714 -r1.715 *** NEWS 7 Apr 2003 19:21:12 -0000 1.714 --- NEWS 8 Apr 2003 16:39:41 -0000 1.715 *************** *** 50,53 **** --- 50,58 ---- ----------------- + - New function gc.get_referrents(obj) returns a list of objects + directly referenced by obj. In effect, it exposes what the object's + tp_traverse slot does, and can be helpful when debugging memory + leaks. + - The iconv module has been removed from this release. From tim_one@users.sourceforge.net Tue Apr 8 17:39:52 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:39:52 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.68,2.69 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Modules Modified Files: gcmodule.c Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** gcmodule.c 7 Apr 2003 22:41:24 -0000 2.68 --- gcmodule.c 8 Apr 2003 16:39:48 -0000 2.69 *************** *** 858,867 **** } static int referrentsvisit(PyObject *obj, PyObject *list) { ! if (PyList_Append(list, obj) < 0) ! return 1; ! return 0; } --- 858,866 ---- } + /* Append obj to list; return true if error (out of memory), false if OK. */ static int referrentsvisit(PyObject *obj, PyObject *list) { ! return PyList_Append(list, obj) < 0; } *************** *** 875,885 **** int i; PyObject *result = PyList_New(0); for (i = 0; i < PyTuple_GET_SIZE(args); i++) { PyObject *obj = PyTuple_GET_ITEM(args, i); ! traverseproc traverse = obj->ob_type->tp_traverse; ! if (!traverse) continue; ! if (traverse(obj, (visitproc)referrentsvisit, result)) return NULL; } return result; --- 874,894 ---- int i; PyObject *result = PyList_New(0); + + if (result == NULL) + return NULL; + for (i = 0; i < PyTuple_GET_SIZE(args); i++) { + traverseproc traverse; PyObject *obj = PyTuple_GET_ITEM(args, i); ! ! if (! PyObject_IS_GC(obj)) continue; ! traverse = obj->ob_type->tp_traverse; ! if (! traverse) ! continue; ! if (traverse(obj, (visitproc)referrentsvisit, result)) { ! Py_DECREF(result); return NULL; + } } return result; From tim_one@users.sourceforge.net Tue Apr 8 17:40:12 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:40:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Doc/lib Modified Files: libgc.tex Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libgc.tex 10 Jul 2002 19:21:07 -0000 1.11 --- libgc.tex 8 Apr 2003 16:39:38 -0000 1.12 *************** *** 100,103 **** --- 100,116 ---- \end{funcdesc} + \begin{funcdesc}{get_referrents}{*objs} + Return a list of objects directly referred to by any of the arguments. + The referrents returned are those objects visited by the arguments' + C-level \cfunction{tp_traverse} methods (if any), and may not be all + objects actually directly reachable. \cfunction{tp_traverse} methods + are supported only by objects that support garbage collection, and are + only required to visit objects that may be involved in a cycle. So, + for example, if an integer is directly reachable from an argument, that + integer object may or may not appear in the result list. + + \versionadded{2.3} + \end{funcdesc} + The following variable is provided for read-only access (you can mutate its value but should not rebind it): From tim_one@users.sourceforge.net Tue Apr 8 17:40:16 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 09:40:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv2197/python/Lib/test Modified Files: test_gc.py Log Message: Finished implementing gc.get_referrents(): dealt with error and end cases, wrote docs, added a test. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_gc.py 7 Apr 2003 19:21:11 -0000 1.27 --- test_gc.py 8 Apr 2003 16:39:39 -0000 1.28 *************** *** 5,9 **** def expect(actual, expected, name): if actual != expected: ! raise TestFailed, "test_%s: actual %d, expected %d" % ( name, actual, expected) --- 5,9 ---- def expect(actual, expected, name): if actual != expected: ! raise TestFailed, "test_%s: actual %r, expected %r" % ( name, actual, expected) *************** *** 305,308 **** --- 305,331 ---- expect(len(gc.garbage), garbagelen, "boom2") + def test_get_referrents(): + alist = [1, 3, 5] + got = gc.get_referrents(alist) + got.sort() + expect(got, alist, "get_referrents") + + atuple = tuple(alist) + got = gc.get_referrents(atuple) + got.sort() + expect(got, alist, "get_referrents") + + adict = {1: 3, 5: 7} + expected = [1, 3, 5, 7] + got = gc.get_referrents(adict) + got.sort() + expect(got, expected, "get_referrents") + + got = gc.get_referrents([1, 2], {3: 4}, (0, 0, 0)) + got.sort() + expect(got, [0, 0] + range(5), "get_referrents") + + expect(gc.get_referrents(1, 'a', 4j), [], "get_referrents") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 325,328 **** --- 348,352 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) + run_test("get_referrents", test_get_referrents) def test(): From tim_one@users.sourceforge.net Tue Apr 8 18:17:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:19 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.715,1.716 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Misc Modified Files: NEWS Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.715 retrieving revision 1.716 diff -C2 -d -r1.715 -r1.716 *** NEWS 8 Apr 2003 16:39:41 -0000 1.715 --- NEWS 8 Apr 2003 17:17:16 -0000 1.716 *************** *** 50,54 **** ----------------- ! - New function gc.get_referrents(obj) returns a list of objects directly referenced by obj. In effect, it exposes what the object's tp_traverse slot does, and can be helpful when debugging memory --- 50,54 ---- ----------------- ! - New function gc.get_referents(obj) returns a list of objects directly referenced by obj. In effect, it exposes what the object's tp_traverse slot does, and can be helpful when debugging memory From tim_one@users.sourceforge.net Tue Apr 8 18:17:21 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:21 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Modules Modified Files: gcmodule.c Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** gcmodule.c 8 Apr 2003 16:39:48 -0000 2.69 --- gcmodule.c 8 Apr 2003 17:17:17 -0000 2.70 *************** *** 860,874 **** /* Append obj to list; return true if error (out of memory), false if OK. */ static int ! referrentsvisit(PyObject *obj, PyObject *list) { return PyList_Append(list, obj) < 0; } ! PyDoc_STRVAR(gc_get_referrents__doc__, ! "get_referrents(*objs) -> list\n\ Return the list of objects that are directly referred to by objs."); static PyObject * ! gc_get_referrents(PyObject *self, PyObject *args) { int i; --- 860,874 ---- /* Append obj to list; return true if error (out of memory), false if OK. */ static int ! referentsvisit(PyObject *obj, PyObject *list) { return PyList_Append(list, obj) < 0; } ! PyDoc_STRVAR(gc_get_referents__doc__, ! "get_referents(*objs) -> list\n\ Return the list of objects that are directly referred to by objs."); static PyObject * ! gc_get_referents(PyObject *self, PyObject *args) { int i; *************** *** 887,891 **** if (! traverse) continue; ! if (traverse(obj, (visitproc)referrentsvisit, result)) { Py_DECREF(result); return NULL; --- 887,891 ---- if (! traverse) continue; ! if (traverse(obj, (visitproc)referentsvisit, result)) { Py_DECREF(result); return NULL; *************** *** 933,937 **** "get_objects() -- Return a list of all objects tracked by the collector.\n" "get_referrers() -- Return the list of objects that refer to an object.\n" ! "get_referrents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { --- 933,937 ---- "get_objects() -- Return a list of all objects tracked by the collector.\n" "get_referrers() -- Return the list of objects that refer to an object.\n" ! "get_referents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { *************** *** 947,952 **** {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, ! {"get_referrents", gc_get_referrents, METH_VARARGS, ! gc_get_referrents__doc__}, {NULL, NULL} /* Sentinel */ }; --- 947,952 ---- {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, ! {"get_referents", gc_get_referents, METH_VARARGS, ! gc_get_referents__doc__}, {NULL, NULL} /* Sentinel */ }; From tim_one@users.sourceforge.net Tue Apr 8 18:17:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Doc/lib Modified Files: libgc.tex Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libgc.tex 8 Apr 2003 16:39:38 -0000 1.12 --- libgc.tex 8 Apr 2003 17:17:14 -0000 1.13 *************** *** 100,106 **** \end{funcdesc} ! \begin{funcdesc}{get_referrents}{*objs} Return a list of objects directly referred to by any of the arguments. ! The referrents returned are those objects visited by the arguments' C-level \cfunction{tp_traverse} methods (if any), and may not be all objects actually directly reachable. \cfunction{tp_traverse} methods --- 100,106 ---- \end{funcdesc} ! \begin{funcdesc}{get_referents}{*objs} Return a list of objects directly referred to by any of the arguments. ! The referents returned are those objects visited by the arguments' C-level \cfunction{tp_traverse} methods (if any), and may not be all objects actually directly reachable. \cfunction{tp_traverse} methods From tim_one@users.sourceforge.net Tue Apr 8 18:17:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:17:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20017/python/Lib/test Modified Files: test_gc.py Log Message: s/referrents/referents/g. Gotta love that referrers remains rife with rs. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_gc.py 8 Apr 2003 16:39:39 -0000 1.28 --- test_gc.py 8 Apr 2003 17:17:15 -0000 1.29 *************** *** 305,330 **** expect(len(gc.garbage), garbagelen, "boom2") ! def test_get_referrents(): alist = [1, 3, 5] ! got = gc.get_referrents(alist) got.sort() ! expect(got, alist, "get_referrents") atuple = tuple(alist) ! got = gc.get_referrents(atuple) got.sort() ! expect(got, alist, "get_referrents") adict = {1: 3, 5: 7} expected = [1, 3, 5, 7] ! got = gc.get_referrents(adict) got.sort() ! expect(got, expected, "get_referrents") ! got = gc.get_referrents([1, 2], {3: 4}, (0, 0, 0)) got.sort() ! expect(got, [0, 0] + range(5), "get_referrents") ! expect(gc.get_referrents(1, 'a', 4j), [], "get_referrents") def test_all(): --- 305,330 ---- expect(len(gc.garbage), garbagelen, "boom2") ! def test_get_referents(): alist = [1, 3, 5] ! got = gc.get_referents(alist) got.sort() ! expect(got, alist, "get_referents") atuple = tuple(alist) ! got = gc.get_referents(atuple) got.sort() ! expect(got, alist, "get_referents") adict = {1: 3, 5: 7} expected = [1, 3, 5, 7] ! got = gc.get_referents(adict) got.sort() ! expect(got, expected, "get_referents") ! got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) got.sort() ! expect(got, [0, 0] + range(5), "get_referents") ! expect(gc.get_referents(1, 'a', 4j), [], "get_referents") def test_all(): *************** *** 348,352 **** run_test("boom", test_boom) run_test("boom2", test_boom2) ! run_test("get_referrents", test_get_referrents) def test(): --- 348,352 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) ! run_test("get_referents", test_get_referents) def test(): From fdrake@users.sourceforge.net Tue Apr 8 18:37:52 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:37:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30310 Modified Files: libgc.tex Log Message: Markup fix. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libgc.tex 8 Apr 2003 17:17:14 -0000 1.13 --- libgc.tex 8 Apr 2003 17:37:47 -0000 1.14 *************** *** 103,108 **** Return a list of objects directly referred to by any of the arguments. The referents returned are those objects visited by the arguments' ! C-level \cfunction{tp_traverse} methods (if any), and may not be all ! objects actually directly reachable. \cfunction{tp_traverse} methods are supported only by objects that support garbage collection, and are only required to visit objects that may be involved in a cycle. So, --- 103,108 ---- Return a list of objects directly referred to by any of the arguments. The referents returned are those objects visited by the arguments' ! C-level \member{tp_traverse} methods (if any), and may not be all ! objects actually directly reachable. \member{tp_traverse} methods are supported only by objects that support garbage collection, and are only required to visit objects that may be involved in a cycle. So, From fdrake@users.sourceforge.net Tue Apr 8 18:46:35 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:46:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libatexit.tex,1.7,1.7.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1914 Modified Files: Tag: release22-maint libatexit.tex Log Message: Added example of using positional and keyword args with atexit.register(). Based on a suggestion from a reader. Index: libatexit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libatexit.tex,v retrieving revision 1.7 retrieving revision 1.7.24.1 diff -C2 -d -r1.7 -r1.7.24.1 *** libatexit.tex 9 Sep 2000 03:25:11 -0000 1.7 --- libatexit.tex 8 Apr 2003 17:46:33 -0000 1.7.24.1 *************** *** 73,74 **** --- 73,89 ---- atexit.register(savecounter) \end{verbatim} + + Positional and keyword arguments may also be passed to + \function{register()} to be passed along to the registered function + when it is called: + + \begin{verbatim} + def goodbye(name, adjective): + print 'Goodbye, %s, it was %s to meet you.' % (name, adjective) + + import atexit + atexit.register(goodbye, 'Donny', 'nice') + + # or: + atexit.register(goodbye, adjective='nice', name='Donny') + \end{verbatim} From fdrake@users.sourceforge.net Tue Apr 8 18:46:55 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 10:46:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libatexit.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2032 Modified Files: libatexit.tex Log Message: Added example of using positional and keyword args with atexit.register(). Based on a suggestion from a reader. Index: libatexit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libatexit.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libatexit.tex 9 Sep 2000 03:25:11 -0000 1.7 --- libatexit.tex 8 Apr 2003 17:46:53 -0000 1.8 *************** *** 73,74 **** --- 73,89 ---- atexit.register(savecounter) \end{verbatim} + + Positional and keyword arguments may also be passed to + \function{register()} to be passed along to the registered function + when it is called: + + \begin{verbatim} + def goodbye(name, adjective): + print 'Goodbye, %s, it was %s to meet you.' % (name, adjective) + + import atexit + atexit.register(goodbye, 'Donny', 'nice') + + # or: + atexit.register(goodbye, adjective='nice', name='Donny') + \end{verbatim} From tim_one@users.sourceforge.net Tue Apr 8 19:47:24 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 11:47:24 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv32665/Python/Include Modified Files: classobject.h Log Message: Typo repair. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** classobject.h 7 Apr 2003 17:51:58 -0000 2.42 --- classobject.h 8 Apr 2003 18:47:21 -0000 2.43 *************** *** 59,66 **** * The point of this routine is that it never calls arbitrary Python * code, so is always "safe": all it does is dict lookups. The function ! * can't fail, never sets an exceptionm, and NULL is not an error (it just * means "not found"). */ ! PyAPI_FUNC(PyObject *)_PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* --- 59,66 ---- * The point of this routine is that it never calls arbitrary Python * code, so is always "safe": all it does is dict lookups. The function ! * can't fail, never sets an exception, and NULL is not an error (it just * means "not found"). */ ! PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* From tim_one@users.sourceforge.net Tue Apr 8 20:02:37 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:02:37 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.40,2.40.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv6707/Include Modified Files: Tag: release22-maint classobject.h Log Message: Added private API function _PyInstance_Lookup(). This is part of backporting fixes so that garbage collection doesn't have to trigger execution of arbitrary Python code just to figure out whether an object has a __del__ method. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.40 retrieving revision 2.40.6.1 diff -C2 -d -r2.40 -r2.40.6.1 *** classobject.h 7 Dec 2001 21:54:33 -0000 2.40 --- classobject.h 8 Apr 2003 19:02:30 -0000 2.40.6.1 *************** *** 52,55 **** --- 52,67 ---- extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *); + /* Look up attribute with name (a string) on instance object pinst, using + * only the instance and base class dicts. If a descriptor is found in + * a class dict, the descriptor is returned without calling it. + * Returns NULL if nothing found, else a borrowed reference to the + * value associated with name in the dict in which name was found. + * The point of this routine is that it never calls arbitrary Python + * code, so is always "safe": all it does is dict lookups. The function + * can't fail, never sets an exception, and NULL is not an error (it just + * means "not found"). + */ + PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); + /* Macros for direct access to these values. Type checks are *not* done, so use with care. */ From tim_one@users.sourceforge.net Tue Apr 8 20:02:38 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:02:38 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.154.8.3,2.154.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv6707/Objects Modified Files: Tag: release22-maint classobject.c Log Message: Added private API function _PyInstance_Lookup(). This is part of backporting fixes so that garbage collection doesn't have to trigger execution of arbitrary Python code just to figure out whether an object has a __del__ method. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.154.8.3 retrieving revision 2.154.8.4 diff -C2 -d -r2.154.8.3 -r2.154.8.4 *** classobject.c 2 Feb 2003 19:37:32 -0000 2.154.8.3 --- classobject.c 8 Apr 2003 19:02:34 -0000 2.154.8.4 *************** *** 730,733 **** --- 730,754 ---- } + /* See classobject.h comments: this only does dict lookups, and is always + * safe to call. + */ + PyObject * + _PyInstance_Lookup(PyObject *pinst, PyObject *name) + { + PyObject *v; + PyClassObject *class; + PyInstanceObject *inst; /* pinst cast to the right type */ + + assert(PyInstance_Check(pinst)); + inst = (PyInstanceObject *)pinst; + + assert(PyString_Check(name)); + + v = PyDict_GetItem(inst->in_dict, name); + if (v == NULL) + v = class_lookup(inst->in_class, name, &class); + return v; + } + static int instance_setattr1(PyInstanceObject *inst, PyObject *name, PyObject *v) *************** *** 1057,1061 **** if (!start) return NULL; ! end = PyInt_FromLong((long)j); if (!end) { --- 1078,1082 ---- if (!start) return NULL; ! end = PyInt_FromLong((long)j); if (!end) { *************** *** 1089,1095 **** return NULL; arg = Py_BuildValue("(N)", sliceobj_from_intint(i, j)); ! } else arg = Py_BuildValue("(ii)", i, j); ! if (arg == NULL) { Py_DECREF(func); --- 1110,1116 ---- return NULL; arg = Py_BuildValue("(N)", sliceobj_from_intint(i, j)); ! } else arg = Py_BuildValue("(ii)", i, j); ! if (arg == NULL) { Py_DECREF(func); *************** *** 1220,1224 **** Py_DECREF(func); Py_DECREF(arg); ! if(res == NULL) return -1; ret = PyObject_IsTrue(res); --- 1241,1245 ---- Py_DECREF(func); Py_DECREF(arg); ! if(res == NULL) return -1; ret = PyObject_IsTrue(res); *************** *** 1293,1297 **** /* Try one half of a binary operator involving a class instance. */ static PyObject * ! half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, int swapped) { --- 1314,1318 ---- /* Try one half of a binary operator involving a class instance. */ static PyObject * ! half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, int swapped) { *************** *** 1301,1305 **** PyObject *v1; PyObject *result; ! if (!PyInstance_Check(v)) { Py_INCREF(Py_NotImplemented); --- 1322,1326 ---- PyObject *v1; PyObject *result; ! if (!PyInstance_Check(v)) { Py_INCREF(Py_NotImplemented); *************** *** 1655,1659 **** static PyObject * instance_pow(PyObject *v, PyObject *w, PyObject *z) ! { if (z == Py_None) { return do_binop(v, w, "__pow__", "__rpow__", bin_power); --- 1676,1680 ---- static PyObject * instance_pow(PyObject *v, PyObject *w, PyObject *z) ! { if (z == Py_None) { return do_binop(v, w, "__pow__", "__rpow__", bin_power); *************** *** 1724,1728 **** static PyObject **name_op = NULL; ! static int init_name_op(void) { --- 1745,1749 ---- static PyObject **name_op = NULL; ! static int init_name_op(void) { From tim_one@users.sourceforge.net Tue Apr 8 20:13:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:13:17 -0700 Subject: [Python-checkins] python/dist/src/Include classobject.h,2.40.6.1,2.40.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv10581/Include Modified Files: Tag: release22-maint classobject.h Log Message: More backporting of gc-vs-__del__ fixes. It should be fixed for instances of classic classes now. Alas, new-style classes are still a problem, and didn't need to be fixed in 2.3 (they were already immune in 2.3 due to the new-in-2.3 tp_del slot). Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.40.6.1 retrieving revision 2.40.6.2 diff -C2 -d -r2.40.6.1 -r2.40.6.2 *** classobject.h 8 Apr 2003 19:02:30 -0000 2.40.6.1 --- classobject.h 8 Apr 2003 19:13:10 -0000 2.40.6.2 *************** *** 62,66 **** * means "not found"). */ ! PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* --- 62,66 ---- * means "not found"). */ ! extern DL_IMPORT(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); /* Macros for direct access to these values. Type checks are *not* From tim_one@users.sourceforge.net Tue Apr 8 20:13:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:13:20 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.6,2.33.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv10581/Modules Modified Files: Tag: release22-maint gcmodule.c Log Message: More backporting of gc-vs-__del__ fixes. It should be fixed for instances of classic classes now. Alas, new-style classes are still a problem, and didn't need to be fixed in 2.3 (they were already immune in 2.3 due to the new-in-2.3 tp_del slot). Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.6 retrieving revision 2.33.6.7 diff -C2 -d -r2.33.6.6 -r2.33.6.7 *** gcmodule.c 3 Apr 2003 23:02:29 -0000 2.33.6.6 --- gcmodule.c 8 Apr 2003 19:13:14 -0000 2.33.6.7 *************** *** 254,258 **** } ! /* return true if object has a finalization method */ static int has_finalizer(PyObject *op) --- 254,265 ---- } ! /* Return true if object has a finalization method. ! * CAUTION: class instances have to be checked for a __del__ method, and ! * earlier versions of this used to call PyObject_HasAttr, which in turn ! * could call the class's __getattr__ hook (if any). That could invoke ! * arbitrary Python code, mutating the object graph in arbitrary ways, and ! * that was the source of some excruciatingly subtle bugs. ! * XXX This is still broken for new-style classes. ! */ static int has_finalizer(PyObject *op) *************** *** 264,270 **** Py_FatalError("PyGC: can't initialize __del__ string"); } ! return (PyInstance_Check(op) || ! PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! && PyObject_HasAttr(op, delstr); } --- 271,282 ---- Py_FatalError("PyGC: can't initialize __del__ string"); } ! ! if (PyInstance_Check(op)) ! return _PyInstance_Lookup(op, delstr) != NULL; ! else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! /* XXX This path is still Evil. */ ! return PyObject_HasAttr(op, delstr); ! else ! return 0; } *************** *** 277,281 **** for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* has_finalizer() may result in arbitrary Python code being run. */ if (has_finalizer(op)) { --- 289,293 ---- for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* XXX has_finalizer() may result in arbitrary Python code being run. */ if (has_finalizer(op)) { From tim_one@users.sourceforge.net Tue Apr 8 20:33:02 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:33:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.12.10.2,1.12.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21549/Lib/test Modified Files: Tag: release22-maint test_gc.py Log Message: Backporting new gc-vs-__del__ tests. These pass, but are restricted to old-style classes. New-style classes remain vulnerable in 2.2. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.12.10.2 retrieving revision 1.12.10.3 diff -C2 -d -r1.12.10.2 -r1.12.10.3 *** test_gc.py 12 Jun 2002 14:41:50 -0000 1.12.10.2 --- test_gc.py 8 Apr 2003 19:32:53 -0000 1.12.10.3 *************** *** 207,210 **** --- 207,261 ---- gc.disable() + class Boom: + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + def test_boom(): + a = Boom() + b = Boom() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ + # (to see whether a and b have __del__ methods), and __getattr__ deletes + # the internal "attr" attributes as a side effect. That causes the + # trash cycle to get reclaimed via refcounts falling to 0, thus mutating + # the trash graph as a side effect of merely asking whether __del__ + # exists. This used to (before 2.3b1) crash Python. Now __getattr__ + # isn't called. + expect(gc.collect(), 4, "boom") + expect(len(gc.garbage), garbagelen, "boom") + + class Boom2: + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2(): + a = Boom2() + b = Boom2() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # Much like test_boom(), except that __getattr__ doesn't break the + # cycle until the second time gc checks for __del__. As of 2.3b1, + # there isn't a second time, so this simply cleans up the trash cycle. + # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed + # this way. + expect(gc.collect(), 4, "boom2") + expect(len(gc.garbage), garbagelen, "boom2") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 223,226 **** --- 274,279 ---- run_test("saveall", test_saveall) run_test("trashcan", test_trashcan) + run_test("boom", test_boom) + run_test("boom2", test_boom2) def test(): From montanaro@users.sourceforge.net Tue Apr 8 20:40:22 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:40:22 -0700 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27424 Modified Files: timeit.py Log Message: correct a couple docstring nits Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** timeit.py 21 Mar 2003 14:54:19 -0000 1.9 --- timeit.py 8 Apr 2003 19:40:19 -0000 1.10 *************** *** 158,166 **** def repeat(self, repeat=default_repeat, number=default_number): ! """Call timer() a few times. ! This is a convenience function that calls the timer() repeatedly, returning a list of results. The first argument ! specifies how many times to call timer(), defaulting to 3; the second argument specifies the timer argument, defaulting to one million. --- 158,166 ---- def repeat(self, repeat=default_repeat, number=default_number): ! """Call timeit() a few times. ! This is a convenience function that calls the timeit() repeatedly, returning a list of results. The first argument ! specifies how many times to call timeit(), defaulting to 3; the second argument specifies the timer argument, defaulting to one million. From tim_one@users.sourceforge.net Tue Apr 8 20:44:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:44:17 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28869/Lib/test Modified Files: test_gc.py Log Message: New tests identical to boom and boom2, except using new-style classes. These never failed in 2.3, and the tests confirm it. They still blow up in the 2.2 branch, despite that all the gc-vs-__del__ fixes from 2.3 have been backported (and this is expected -- 2.2 needs more work than 2.3 needed). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** test_gc.py 8 Apr 2003 17:17:15 -0000 1.29 --- test_gc.py 8 Apr 2003 19:44:13 -0000 1.30 *************** *** 305,308 **** --- 305,350 ---- expect(len(gc.garbage), garbagelen, "boom2") + # boom__new and boom2_new are exactly like boom and boom2, except use + # new-style classes. + + class Boom_New(object): + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + def test_boom_new(): + a = Boom_New() + b = Boom_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom_new") + expect(len(gc.garbage), garbagelen, "boom_new") + + class Boom2_New(object): + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2_new(): + a = Boom2_New() + b = Boom2_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom2_new") + expect(len(gc.garbage), garbagelen, "boom2_new") + def test_get_referents(): alist = [1, 3, 5] *************** *** 348,351 **** --- 390,395 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) + run_test("boom_new", test_boom_new) + run_test("boom2_new", test_boom2_new) run_test("get_referents", test_get_referents) From montanaro@users.sourceforge.net Tue Apr 8 20:49:43 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:49:43 -0700 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv764 Modified Files: timeit.py Log Message: add a #! line for unix weenies Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** timeit.py 8 Apr 2003 19:40:19 -0000 1.10 --- timeit.py 8 Apr 2003 19:49:40 -0000 1.11 *************** *** 1,2 **** --- 1,4 ---- + #! /usr/bin/env python + """Tool for measuring execution time of small code snippets. From montanaro@users.sourceforge.net Tue Apr 8 20:50:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 12:50:08 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts setup.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv915 Modified Files: setup.py Log Message: install timeit.py as a command line script Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/setup.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.py 5 Dec 2002 21:12:34 -0000 1.2 --- setup.py 8 Apr 2003 19:50:02 -0000 1.3 *************** *** 13,16 **** --- 13,17 ---- 'logmerge.py', '../../Lib/tabnanny.py', + '../../Lib/timeit.py', 'untabify.py', ], From jvr@users.sourceforge.net Tue Apr 8 21:07:20 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:07:20 -0700 Subject: [Python-checkins] python/dist/src/Modules zipimport.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9111/Modules Modified Files: zipimport.c Log Message: tentative fix for #712322: modification time stamp checking failed when DST began. Index: zipimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** zipimport.c 23 Mar 2003 13:21:03 -0000 1.12 --- zipimport.c 8 Apr 2003 20:07:15 -0000 1.13 *************** *** 994,998 **** stm.tm_mon = ((dosdate >> 5) & 0x0f) - 1; stm.tm_year = ((dosdate >> 9) & 0x7f) + 80; ! stm.tm_isdst = 0; /* wday/yday is ignored */ return mktime(&stm); --- 994,998 ---- stm.tm_mon = ((dosdate >> 5) & 0x0f) - 1; stm.tm_year = ((dosdate >> 9) & 0x7f) + 80; ! stm.tm_isdst = -1; /* wday/yday is ignored */ return mktime(&stm); From tim_one@users.sourceforge.net Tue Apr 8 21:33:11 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:33:11 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.7,2.33.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Modules Modified Files: Tag: release22-maint gcmodule.c Log Message: Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.7 retrieving revision 2.33.6.8 diff -C2 -d -r2.33.6.7 -r2.33.6.8 *** gcmodule.c 8 Apr 2003 19:13:14 -0000 2.33.6.7 --- gcmodule.c 8 Apr 2003 20:33:05 -0000 2.33.6.8 *************** *** 260,264 **** * arbitrary Python code, mutating the object graph in arbitrary ways, and * that was the source of some excruciatingly subtle bugs. - * XXX This is still broken for new-style classes. */ static int --- 260,263 ---- *************** *** 275,280 **** return _PyInstance_Lookup(op, delstr) != NULL; else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! /* XXX This path is still Evil. */ ! return PyObject_HasAttr(op, delstr); else return 0; --- 274,278 ---- return _PyInstance_Lookup(op, delstr) != NULL; else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! return _PyType_Lookup(op->ob_type, delstr) != NULL; else return 0; *************** *** 285,302 **** move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { - PyGC_Head *next; PyGC_Head *gc = unreachable->gc.gc_next; ! for (; gc != unreachable; gc=next) { PyObject *op = FROM_GC(gc); ! /* XXX has_finalizer() may result in arbitrary Python ! code being run. */ if (has_finalizer(op)) { - next = gc->gc.gc_next; gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } ! else ! next = gc->gc.gc_next; } } --- 283,298 ---- move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) { PyGC_Head *gc = unreachable->gc.gc_next; ! ! while (gc != unreachable) { ! PyGC_Head *next = gc->gc.gc_next; PyObject *op = FROM_GC(gc); ! if (has_finalizer(op)) { gc_list_remove(gc); gc_list_append(gc, finalizers); gc->gc.gc_refs = GC_MOVED; } ! gc = next; } } From tim_one@users.sourceforge.net Tue Apr 8 21:33:31 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:33:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.12.10.3,1.12.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Lib/test Modified Files: Tag: release22-maint test_gc.py Log Message: Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.12.10.3 retrieving revision 1.12.10.4 diff -C2 -d -r1.12.10.3 -r1.12.10.4 *** test_gc.py 8 Apr 2003 19:32:53 -0000 1.12.10.3 --- test_gc.py 8 Apr 2003 20:32:57 -0000 1.12.10.4 *************** *** 258,261 **** --- 258,303 ---- expect(len(gc.garbage), garbagelen, "boom2") + # boom__new and boom2_new are exactly like boom and boom2, except use + # new-style classes. + + class Boom_New(object): + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + def test_boom_new(): + a = Boom_New() + b = Boom_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom_new") + expect(len(gc.garbage), garbagelen, "boom_new") + + class Boom2_New(object): + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + def test_boom2_new(): + a = Boom2_New() + b = Boom2_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + expect(gc.collect(), 4, "boom2_new") + expect(len(gc.garbage), garbagelen, "boom2_new") + def test_all(): gc.collect() # Delete 2nd generation garbage *************** *** 276,279 **** --- 318,323 ---- run_test("boom", test_boom) run_test("boom2", test_boom2) + run_test("boom_new", test_boom_new) + run_test("boom2_new", test_boom2_new) def test(): From tim_one@users.sourceforge.net Tue Apr 8 21:33:38 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 08 Apr 2003 13:33:38 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.71,1.337.2.4.2.72 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21203/Misc Modified Files: Tag: release22-maint NEWS Log Message: Fixed the gc-vs-__del__ bugs for new-style classes. That's it for this one. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.71 retrieving revision 1.337.2.4.2.72 diff -C2 -d -r1.337.2.4.2.71 -r1.337.2.4.2.72 *** NEWS 31 Mar 2003 22:12:37 -0000 1.337.2.4.2.71 --- NEWS 8 Apr 2003 20:32:58 -0000 1.337.2.4.2.72 *************** *** 3,6 **** --- 3,14 ---- ============================ + - Some horridly obscure problems were fixed involving interaction + between garbage collection and classes with "ambitious" getattr hooks. + If a class instance didn't have a __del__ method, but did have a + __getattr__ hook, and the instance became reachable only from an + unreachable cycle, and the hook resurrected or deleted unreachable + objects when asked to resolve "__del__", anything up to a segfault + could happen. That's been repaired. + - Skip locale test on Mac OS X. From jhylton@users.sourceforge.net Tue Apr 8 22:28:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 08 Apr 2003 14:28:52 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14428 Modified Files: funcobject.c Log Message: Make staticmethods and classmethods participate in GC. If a class was defined inside a function, used a static or class method, and used super() inside the method body, it would be caught in an uncollectable cycle. (Simplified version: The static/class method object would point to a function object with a closure that referred to the class.) Bugfix candidate. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** funcobject.c 18 Feb 2003 17:18:35 -0000 2.60 --- funcobject.c 8 Apr 2003 21:28:47 -0000 2.61 *************** *** 591,598 **** --- 591,617 ---- cm_dealloc(classmethod *cm) { + _PyObject_GC_UNTRACK((PyObject *)cm); Py_XDECREF(cm->cm_callable); cm->ob_type->tp_free((PyObject *)cm); } + static int + cm_traverse(classmethod *cm, visitproc visit, void *arg) + { + if (!cm->cm_callable) + return 0; + return visit(cm->cm_callable, arg); + } + + static int + cm_clear(classmethod *cm) + { + Py_XDECREF(cm->cm_callable); + cm->cm_callable = NULL; + + return 0; + } + + static PyObject * cm_descr_get(PyObject *self, PyObject *obj, PyObject *type) *************** *** 666,673 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ classmethod_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 685,692 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, classmethod_doc, /* tp_doc */ ! (traverseproc)cm_traverse, /* tp_traverse */ ! (inquiry)cm_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 685,689 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 704,708 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; *************** *** 725,732 **** --- 744,769 ---- sm_dealloc(staticmethod *sm) { + _PyObject_GC_UNTRACK((PyObject *)sm); Py_XDECREF(sm->sm_callable); sm->ob_type->tp_free((PyObject *)sm); } + static int + sm_traverse(staticmethod *sm, visitproc visit, void *arg) + { + if (!sm->sm_callable) + return 0; + return visit(sm->sm_callable, arg); + } + + static int + sm_clear(staticmethod *sm) + { + Py_XDECREF(sm->sm_callable); + sm->sm_callable = NULL; + + return 0; + } + static PyObject * sm_descr_get(PyObject *self, PyObject *obj, PyObject *type) *************** *** 795,802 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ staticmethod_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 832,839 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, staticmethod_doc, /* tp_doc */ ! (traverseproc)sm_traverse, /* tp_traverse */ ! (inquiry)sm_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 814,818 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 851,855 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From montanaro@users.sourceforge.net Wed Apr 9 02:38:55 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 18:38:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtimeit.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10108 Added Files: libtimeit.tex Log Message: doc for timeit module/script - mostly just a recast of Tim's docstring --- NEW FILE: libtimeit.tex --- \section{\module{timeit} --- Measure execution time of small code snippets} \declaremodule{standard}{timeit} \modulesynopsis{Measure the execution time of small code snippets.} \index{Benchmarking} \index{Performance} \versionadded{2.3} This module provides a simple way to time small bits of Python code. It has both command line as well as callable interfaces. It avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the Algorithms chapter in the ``Python Cookbook'', published by O'Reilly. The module interface defines the following public class: \begin{classdesc}{Timer}{\optional{stmt='pass' \optional{, setup='pass' \optional{, timer=}}}} Class for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to 'pass'; the timer function is platform-dependent (see the module doc string). To measure the execution time of the first statement, use the timeit() method. The repeat() method is a convenience to call timeit() multiple times and return a list of results. The statements may contain newlines, as long as they don't contain multi-line string literals. \begin{methoddesc}{print_exc}{\optional{file=None}} Helper to print a traceback from the timed code. Typical use: \begin{verbatim} t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except: t.print_exc() \end{verbatim} The advantage over the standard traceback is that source lines in the compiled template will be displayed. The optional file argument directs where the traceback is sent; it defaults to \code{sys.stderr}. \end{methoddesc} \begin{methoddesc}{repeat}{\optional{repeat=3\optional{, number=1000000}}} Call \method{timeit()} a few times. This is a convenience function that calls the \method{timeit()} repeatedly, returning a list of results. The first argument specifies how many times to call \function{timeit()}. The second argument specifies the \code{number} argument for \function{timeit()}. Note: it's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run the given code snippet; higher values in the result vector are typically not caused by variability in Python's speed, but by other processes interfering with your timing accuracy. So the \function{min()} of the result is probably the only number you should be interested in. After that, you should look at the entire vector and apply common sense rather than statistics. \end{methoddesc} \begin{methoddesc}{timeit}{\optional{number=1000000}} Time \code{number} executions of the main statement. To be precise, this executes the setup statement once, and then returns the time it takes to execute the main statement a number of times, as a float measured in seconds. The argument is the number of times through the loop, defaulting to one million. The main statement, the setup statement and the timer function to be used are passed to the constructor. \end{methoddesc} \end{classdesc} \subsection{Command Line Interface} When called as a program from the command line, the following form is used: \begin{verbatim} python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} where the following options are understood: \begin{description} \item[-n N/--number=N] how many times to execute 'statement' \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default 'pass') \item[-t/--time] use time.time() (default on all platforms but Windows) \item[-c/--clock] use time.clock() (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits precision \item[-h/--help] print a short usage message and exit \end{description} A multi-line statement may be given by specifying each line as a separate statement argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple -s options are treated similarly. If -n is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds. The default timer function is platform dependent. On Windows, clock() has microsecond granularity but time()'s granularity is 1/60th of a second; on Unix, clock() has 1/100th of a second granularity and time() is much more precise. On either platform, the default timer functions measures wall clock time, not the CPU time. This means that other processes running on the same computer may interfere with the timing. The best thing to do when accurate timing is necessary is to repeat the timing a few times and use the best time. The -r option is good for this; the default of 3 repetitions is probably enough in most cases. On Unix, you can use clock() to measure CPU time. Note: there is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should be aware of it. The baseline overhead can be measured by invoking the program without arguments. The baseline overhead differs between Python versions! Also, to fairly compare older Python versions to Python 2.3, you may want to use python -O for the older versions to avoid timing SET_LINENO instructions. \subsection{Examples} Here are two example sessions (one using the command line, one using the module interface) that compare the cost of using \function{hasattr()} vs. try/except to test for missing and present object attributes. \begin{verbatim} \% timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop \% timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop \% timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop \% timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} \begin{verbatim} >>> import timeit >>> s = """\ ... try: ... str.__nonzero__ ... except AttributeError: ... pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 17.09 usec/pass >>> s = """\ ... if hasattr(str, '__nonzero__'): pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 4.85 usec/pass >>> s = """\ ... try: ... int.__nonzero__ ... except AttributeError: ... pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 1.97 usec/pass >>> s = """\ ... if hasattr(int, '__nonzero__'): pass ... """ >>> t = timeit.Timer(stmt=s) >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000) 3.15 usec/pass \end{verbatim} From montanaro@users.sourceforge.net Wed Apr 9 02:39:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 08 Apr 2003 18:39:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex,1.217,1.218 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10190 Modified Files: lib.tex Log Message: + libtimeit Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** lib.tex 7 Apr 2003 12:19:14 -0000 1.217 --- lib.tex 9 Apr 2003 01:39:06 -0000 1.218 *************** *** 207,210 **** --- 207,211 ---- \input{libprofile} % The Python Profiler \input{libhotshot} % New profiler + \input{libtimeit} \input{internet} % Internet Protocols From tim.one@comcast.net Wed Apr 9 02:54:13 2003 From: tim.one@comcast.net (Tim Peters) Date: Tue, 08 Apr 2003 21:54:13 -0400 Subject: [Python-checkins] python/dist/src/Doc/lib libtimeit.tex,NONE,1.1 In-Reply-To: Message-ID: [Skip] > Update of /cvsroot/python/python/dist/src/Doc/lib > In directory sc8-pr-cvs1:/tmp/cvs-serv10108 > > Added Files: > libtimeit.tex > Log Message: > doc for timeit module/script - mostly just a recast of Tim's docstring Just FYI, the module is all Guido's. Jim Fulton and I just supplied motivation and nagging . From fdrake@users.sourceforge.net Wed Apr 9 03:41:38 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 19:41:38 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv27867 Modified Files: Makefile.deps Log Message: Add dependency information for the timeit module docs. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Makefile.deps 22 Mar 2003 16:19:52 -0000 1.102 --- Makefile.deps 9 Apr 2003 02:41:36 -0000 1.103 *************** *** 170,173 **** --- 170,174 ---- lib/libpdb.tex \ lib/libprofile.tex \ + lib/libtimeit.tex \ lib/libcgi.tex \ lib/libcgitb.tex \ From anthonybaxter@users.sourceforge.net Wed Apr 9 04:03:49 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 08 Apr 2003 20:03:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1739 Modified Files: libhotshot.tex Log Message: extra punctuation removed Index: libhotshot.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhotshot.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libhotshot.tex 7 Apr 2003 12:21:56 -0000 1.2 --- libhotshot.tex 9 Apr 2003 03:03:46 -0000 1.3 *************** *** 92,96 **** \begin{seealso} ! \seemodule{profile}{The profile module's \class{Stats} class. } \end{seealso} --- 92,96 ---- \begin{seealso} ! \seemodule{profile}{The profile module's \class{Stats} class } \end{seealso} From fdrake@users.sourceforge.net Wed Apr 9 04:25:09 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 20:25:09 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv8048 Modified Files: Makefile.deps Log Message: Add dependency information for the hotshot package docs. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** Makefile.deps 9 Apr 2003 02:41:36 -0000 1.103 --- Makefile.deps 9 Apr 2003 03:25:07 -0000 1.104 *************** *** 170,173 **** --- 170,174 ---- lib/libpdb.tex \ lib/libprofile.tex \ + lib/libhotshot.tex \ lib/libtimeit.tex \ lib/libcgi.tex \ From fdrake@users.sourceforge.net Wed Apr 9 05:06:39 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 08 Apr 2003 21:06:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhotshot.tex,1.3,1.4 libtimeit.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18713/lib Modified Files: libhotshot.tex libtimeit.tex Log Message: Lots of small markup adjustments. Index: libhotshot.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhotshot.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libhotshot.tex 9 Apr 2003 03:03:46 -0000 1.3 --- libhotshot.tex 9 Apr 2003 04:06:37 -0000 1.4 *************** *** 3,31 **** \declaremodule{standard}{hotshot} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} - \versionadded{2.2} - \modulesynopsis{High performance logging profiler, mostly written in C.} - ! This module provides a nicer interface to the \code{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's ! written mostly in C, it should result in a much smaller performance impact ! than the existing profile module. ! ! \begin{classdesc}{Profile}{logfile, \optional{, lineevents=0, linetimings=1}} ! The profiler object. The argument \var{logfile} is the name of a log file ! to use for logged profile data. The argument \var{lineevents} specifies whether ! to generate events for every source line, or just on function call/return. It ! defaults to 0 (only log function call/return). The argument \var{linetimings} ! specifies whether to record timing information. It defaults to 1 (store timing information). - \end{classdesc} \subsection{Profile Objects \label{hotshot-objects}} --- 3,31 ---- \declaremodule{standard}{hotshot} + \modulesynopsis{High performance logging profiler, mostly written in C.} \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} \sectionauthor{Anthony Baxter}{anthony@interlink.com.au} \versionadded{2.2} ! This module provides a nicer interface to the \module{_hotshot} C module. Hotshot is a replacement for the existing \refmodule{profile} module. As it's ! written mostly in C, it should result in a much smaller performance impact ! than the existing \refmodule{profile} module. ! \begin{classdesc}{Profile}{logfile\optional{, ! lineevents\code{=0}\optional{, ! linetimings\code{=1}}}} ! The profiler object. The argument \var{logfile} is the name of a log ! file to use for logged profile data. The argument \var{lineevents} ! specifies whether to generate events for every source line, or just on ! function call/return. It defaults to \code{0} (only log function ! call/return). The argument \var{linetimings} specifies whether to ! record timing information. It defaults to \code{1} (store timing information). \end{classdesc} + \subsection{Profile Objects \label{hotshot-objects}} *************** *** 39,44 **** Close the logfile and terminate the profiler. \end{methoddesc} ! ! % \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. --- 39,43 ---- Close the logfile and terminate the profiler. \end{methoddesc} ! \begin{methoddesc}{fileno}{} Return the file descriptor of the profiler's log file. *************** *** 46,52 **** \begin{methoddesc}{run}{cmd} ! Profile an exec-compatible string in the script environment. ! ! The globals from the \module{__main__} module are used as both the globals and locals for the script. \end{methoddesc} --- 45,50 ---- \begin{methoddesc}{run}{cmd} ! Profile an \keyword{exec}-compatible string in the script environment. ! The globals from the \refmodule[main]{__main__} module are used as both the globals and locals for the script. \end{methoddesc} *************** *** 54,58 **** \begin{methoddesc}{runcall}{func, *args, **keywords} Profile a single call of a callable. - Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are --- 52,55 ---- *************** *** 63,68 **** \begin{methoddesc}{runctx}{cmd, globals, locals} ! Evaluate an exec-compatible string in a specific environment. ! The string is compiled before profiling begins. \end{methoddesc} --- 60,64 ---- \begin{methoddesc}{runctx}{cmd, globals, locals} ! Evaluate an \keyword{exec}-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} *************** *** 76,105 **** \end{methoddesc} \subsection{Using hotshot data} - \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} ! This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} ! Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} ! \seemodule{profile}{The profile module's \class{Stats} class } \end{seealso} \subsection{Example Usage \label{hotshot-example}} ! Note that this example runs the python "benchmark" pystones. It can take some time to run, and will produce large output files. \begin{verbatim} - >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") --- 72,102 ---- \end{methoddesc} + \subsection{Using hotshot data} + \declaremodule{standard}{hotshot.stats} \modulesynopsis{Statistical analysis for Hotshot} \versionadded{2.2} ! This module loads hotshot profiling data into the standard \module{pstats} Stats objects. \begin{funcdesc}{load}{filename} ! Load hotshot data from \var{filename}. Returns an instance of the \class{pstats.Stats} class. \end{funcdesc} \begin{seealso} ! \seemodule{profile}{The \module{profile} module's \class{Stats} class} \end{seealso} + \subsection{Example Usage \label{hotshot-example}} ! Note that this example runs the python ``benchmark'' pystones. It can take some time to run, and will produce large output files. \begin{verbatim} >>> import hotshot, hotshot.stats, test.pystone >>> prof = hotshot.Profile("stones.prof") *************** *** 121,126 **** . . - \end{verbatim} - - --- 118,120 ---- Index: libtimeit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtimeit.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libtimeit.tex 9 Apr 2003 01:38:53 -0000 1.1 --- libtimeit.tex 9 Apr 2003 04:06:37 -0000 1.2 *************** *** 5,38 **** \modulesynopsis{Measure the execution time of small code snippets.} \index{Benchmarking} \index{Performance} ! \versionadded{2.3} ! ! This module provides a simple way to time small bits of Python code. It has ! both command line as well as callable interfaces. It avoids a number of ! common traps for measuring execution times. See also Tim Peters' ! introduction to the Algorithms chapter in the ``Python Cookbook'', published ! by O'Reilly. ! The module interface defines the following public class: ! \begin{classdesc}{Timer}{\optional{stmt='pass' ! \optional{, setup='pass' ! \optional{, timer=}}}} Class for timing execution speed of small code snippets. ! The constructor takes a statement to be timed, an additional statement used ! for setup, and a timer function. Both statements default to 'pass'; the ! timer function is platform-dependent (see the module doc string). ! ! To measure the execution time of the first statement, use the timeit() ! method. The repeat() method is a convenience to call timeit() multiple ! times and return a list of results. ! The statements may contain newlines, as long as they don't contain ! multi-line string literals. ! \begin{methoddesc}{print_exc}{\optional{file=None}} Helper to print a traceback from the timed code. --- 5,38 ---- \modulesynopsis{Measure the execution time of small code snippets.} + \versionadded{2.3} \index{Benchmarking} \index{Performance} ! This module provides a simple way to time small bits of Python code. ! It has both command line as well as callable interfaces. It avoids a ! number of common traps for measuring execution times. See also Tim ! Peters' introduction to the ``Algorithms'' chapter in the ! \citetitle{Python Cookbook}, published by O'Reilly. ! The module defines the following public class: ! \begin{classdesc}{Timer}{\optional{stmt=\code{'pass'} ! \optional{, setup=\code{'pass'} ! \optional{, timer=}}}} Class for timing execution speed of small code snippets. ! The constructor takes a statement to be timed, an additional statement ! used for setup, and a timer function. Both statements default to ! \code{'pass'}; the timer function is platform-dependent (see the ! module doc string). The statements may contain newlines, as long as ! they don't contain multi-line string literals. ! To measure the execution time of the first statement, use the ! \method{timeit()} method. The \method{repeat()} method is a ! convenience to call \method{timeit()} multiple times and return a list ! of results. ! \end{classdesc} ! \begin{methoddesc}{print_exc}{\optional{file=\constant{None}}} Helper to print a traceback from the timed code. *************** *** 49,66 **** The advantage over the standard traceback is that source lines in the compiled template will be displayed. ! ! The optional file argument directs where the traceback is sent; it defaults ! to \code{sys.stderr}. \end{methoddesc} ! \begin{methoddesc}{repeat}{\optional{repeat=3\optional{, number=1000000}}} Call \method{timeit()} a few times. ! This is a convenience function that calls the \method{timeit()} repeatedly, ! returning a list of results. The first argument specifies how many times to ! call \function{timeit()}. The second argument specifies the \code{number} ! argument for \function{timeit()}. ! Note: it's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run --- 49,67 ---- The advantage over the standard traceback is that source lines in the compiled template will be displayed. ! The optional \var{file} argument directs where the traceback is sent; ! it defaults to \code{sys.stderr}. \end{methoddesc} ! \begin{methoddesc}{repeat}{\optional{repeat\code{=3}\optional{, ! number\code{=1000000}}}} Call \method{timeit()} a few times. ! This is a convenience function that calls the \method{timeit()} ! repeatedly, returning a list of results. The first argument specifies ! how many times to call \method{timeit()}. The second argument ! specifies the \var{number} argument for \function{timeit()}. ! \begin{notice} ! It's tempting to calculate mean and standard deviation from the result vector and report these. However, this is not very useful. In a typical case, the lowest value gives a lower bound for how fast your machine can run *************** *** 71,86 **** should look at the entire vector and apply common sense rather than statistics. \end{methoddesc} ! \begin{methoddesc}{timeit}{\optional{number=1000000}} ! Time \code{number} executions of the main statement. ! ! To be precise, this executes the setup statement once, and then returns the ! time it takes to execute the main statement a number of times, as a float ! measured in seconds. The argument is the number of times through the loop, ! defaulting to one million. The main statement, the setup statement and the ! timer function to be used are passed to the constructor. \end{methoddesc} ! \end{classdesc} \subsection{Command Line Interface} --- 72,88 ---- should look at the entire vector and apply common sense rather than statistics. + \end{notice} \end{methoddesc} ! \begin{methoddesc}{timeit}{\optional{number\code{=1000000}}} ! Time \var{number} executions of the main statement. ! This executes the setup statement once, and then ! returns the time it takes to execute the main statement a number of ! times, measured in seconds as a float. The argument is the number of ! times through the loop, defaulting to one million. The main ! statement, the setup statement and the timer function to be used are ! passed to the constructor. \end{methoddesc} ! \subsection{Command Line Interface} *************** *** 89,93 **** \begin{verbatim} ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} --- 91,95 ---- \begin{verbatim} ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} *************** *** 98,150 **** \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default ! 'pass') ! \item[-t/--time] use time.time() (default on all platforms but Windows) ! \item[-c/--clock] use time.clock() (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits ! precision \item[-h/--help] print a short usage message and exit \end{description} ! A multi-line statement may be given by specifying each line as a separate ! statement argument; indented lines are possible by enclosing an argument in ! quotes and using leading spaces. Multiple -s options are treated similarly. ! If -n is not given, a suitable number of loops is calculated by trying ! successive powers of 10 until the total time is at least 0.2 seconds. ! The default timer function is platform dependent. On Windows, clock() has ! microsecond granularity but time()'s granularity is 1/60th of a second; on ! Unix, clock() has 1/100th of a second granularity and time() is much more ! precise. On either platform, the default timer functions measures wall ! clock time, not the CPU time. This means that other processes running on ! the same computer may interfere with the timing. The best thing to do when ! accurate timing is necessary is to repeat the timing a few times and use the ! best time. The -r option is good for this; the default of 3 repetitions is ! probably enough in most cases. On Unix, you can use clock() to measure CPU ! time. ! Note: there is a certain baseline overhead associated with executing a pass ! statement. The code here doesn't try to hide it, but you should be aware of ! it. The baseline overhead can be measured by invoking the program without ! arguments. ! The baseline overhead differs between Python versions! Also, to fairly ! compare older Python versions to Python 2.3, you may want to use python -O ! for the older versions to avoid timing SET_LINENO instructions. \subsection{Examples} ! Here are two example sessions (one using the command line, one using the ! module interface) that compare the cost of using \function{hasattr()} ! vs. try/except to test for missing and present object attributes. \begin{verbatim} ! \% timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop ! \% timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop ! \% timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop ! \% timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} --- 100,161 ---- \item[-r N/--repeat=N] how many times to repeat the timer (default 3) \item[-s S/--setup=S] statement to be executed once initially (default ! \code{'pass'}) ! \item[-t/--time] use \function{time.time()} ! (default on all platforms but Windows) ! \item[-c/--clock] use \function{time.clock()} (default on Windows) \item[-v/--verbose] print raw timing results; repeat for more digits ! precision \item[-h/--help] print a short usage message and exit \end{description} ! A multi-line statement may be given by specifying each line as a ! separate statement argument; indented lines are possible by enclosing ! an argument in quotes and using leading spaces. Multiple ! \programopt{-s} options are treated similarly. ! If \programopt{-n} is not given, a suitable number of loops is ! calculated by trying successive powers of 10 until the total time is ! at least 0.2 seconds. ! The default timer function is platform dependent. On Windows, ! \function{time.clock()} has microsecond granularity but ! \function{time.time()}'s granularity is 1/60th of a second; on \UNIX, ! \function{time.clock()} has 1/100th of a second granularity and ! \function{time.time()} is much more precise. On either platform, the ! default timer functions measures wall clock time, not the CPU time. ! This means that other processes running on the same computer may ! interfere with the timing. The best thing to do when accurate timing ! is necessary is to repeat the timing a few times and use the best ! time. The \programopt{-r} option is good for this; the default of 3 ! repetitions is probably enough in most cases. On \UNIX, you can use ! \function{time.clock()} to measure CPU time. ! \begin{notice} ! There is a certain baseline overhead associated with executing a ! pass statement. The code here doesn't try to hide it, but you ! should be aware of it. The baseline overhead can be measured by ! invoking the program without arguments. ! \end{notice} ! The baseline overhead differs between Python versions! Also, to ! fairly compare older Python versions to Python 2.3, you may want to ! use Python's \programopt{-O} option for the older versions to avoid ! timing \code{SET_LINENO} instructions. \subsection{Examples} ! Here are two example sessions (one using the command line, one using ! the module interface) that compare the cost of using ! \function{hasattr()} vs. \keyword{try}/\keyword{except} to test for ! missing and present object attributes. \begin{verbatim} ! % timeit.py 'try:' ' str.__nonzero__' 'except AttributeError:' ' pass' 100000 loops, best of 3: 15.7 usec per loop ! % timeit.py 'if hasattr(str, "__nonzero__"): pass' 100000 loops, best of 3: 4.26 usec per loop ! % timeit.py 'try:' ' int.__nonzero__' 'except AttributeError:' ' pass' 1000000 loops, best of 3: 1.43 usec per loop ! % timeit.py 'if hasattr(int, "__nonzero__"): pass' 100000 loops, best of 3: 2.23 usec per loop \end{verbatim} *************** *** 154,160 **** >>> s = """\ ... try: ! ... str.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) --- 165,171 ---- >>> s = """\ ... try: ! ... str.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) *************** *** 169,175 **** >>> s = """\ ... try: ! ... int.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) --- 180,186 ---- >>> s = """\ ... try: ! ... int.__nonzero__ ... except AttributeError: ! ... pass ... """ >>> t = timeit.Timer(stmt=s) From akuchling@users.sourceforge.net Wed Apr 9 13:35:53 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 09 Apr 2003 05:35:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command register.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv8646 Modified Files: register.py Log Message: Remove the --verify option in favor of the standard -n/--dry-run option Index: register.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/register.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** register.py 3 Mar 2003 18:26:01 -0000 1.5 --- register.py 9 Apr 2003 12:35:51 -0000 1.6 *************** *** 23,28 **** ('repository=', 'r', "url of repository [default: %s]"%DEFAULT_REPOSITORY), - ('verify', None, - 'verify the package metadata for correctness'), ('list-classifiers', None, 'list the valid Trove classifiers'), --- 23,26 ---- *************** *** 34,38 **** def initialize_options(self): self.repository = None - self.verify = 0 self.show_response = 0 self.list_classifiers = 0 --- 32,35 ---- *************** *** 44,48 **** def run(self): self.check_metadata() ! if self.verify: self.verify_metadata() elif self.list_classifiers: --- 41,45 ---- def run(self): self.check_metadata() ! if self.dry_run: self.verify_metadata() elif self.list_classifiers: From Jack.Jansen@cwi.nl Wed Apr 9 14:00:31 2003 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 9 Apr 2003 15:00:31 +0200 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.11,1.12 FrameWork.py,1.3,1.4 MiniAEFrame.py,1.1,1.2 argvemulator.py,1.2,1.3 icopen.py,1.1,1.2 In-Reply-To: Message-ID: <3EC47D84-6A8B-11D7-BC28-0030655234CE@cwi.nl> On Sunday, Apr 6, 2003, at 12:44 Europe/Amsterdam, Just van Rossum wrote: > rhettinger@users.sourceforge.net wrote: > >> Modified Files: >> EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py >> icopen.py >> Log Message: >> SF patch #701494: more apply removals > > Ouch, this checkin also detabbed these files! This obscures the real > change. Also: whether they need to be detabbed is up to Jack. I assume > it was a simple oversight, please back this change out. I'll bite the bullet and detab all of Lib/plat-mac. It had to happen one day anyway. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From jackjansen@users.sourceforge.net Wed Apr 9 14:25:21 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 09 Apr 2003 06:25:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon ControlAccessor.py,1.1,1.2 Res.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv29021 Modified Files: ControlAccessor.py Res.py Log Message: Detabbed. Index: ControlAccessor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/ControlAccessor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ControlAccessor.py 30 Dec 2002 22:04:21 -0000 1.1 --- ControlAccessor.py 9 Apr 2003 13:25:19 -0000 1.2 *************** *** 6,57 **** # These needn't go through this module, but are here for completeness def SetControlData_Handle(control, part, selector, data): ! control.SetControlData_Handle(part, selector, data) ! def GetControlData_Handle(control, part, selector): ! return control.GetControlData_Handle(part, selector) ! _accessdict = { ! kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle), } _codingdict = { ! kControlPushButtonDefaultTag : ("b", None, None), ! ! kControlEditTextTextTag: (None, None, None), ! kControlEditTextPasswordTag: (None, None, None), ! ! kControlPopupButtonMenuIDTag: ("h", None, None), ! ! kControlListBoxDoubleClickTag: ("b", None, None), } def SetControlData(control, part, selector, data): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! setfunc(control, part, selector, data) ! return ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! if coder: ! data = coder(data) ! if structfmt: ! data = struct.pack(structfmt, data) ! control.SetControlData(part, selector, data) ! def GetControlData(control, part, selector): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! return getfunc(control, part, selector, data) ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! data = control.GetControlData(part, selector) ! if structfmt: ! data = struct.unpack(structfmt, data) ! if decoder: ! data = decoder(data) ! if type(data) == type(()) and len(data) == 1: ! data = data[0] ! return data ! --- 6,57 ---- # These needn't go through this module, but are here for completeness def SetControlData_Handle(control, part, selector, data): ! control.SetControlData_Handle(part, selector, data) ! def GetControlData_Handle(control, part, selector): ! return control.GetControlData_Handle(part, selector) ! _accessdict = { ! kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle), } _codingdict = { ! kControlPushButtonDefaultTag : ("b", None, None), ! ! kControlEditTextTextTag: (None, None, None), ! kControlEditTextPasswordTag: (None, None, None), ! ! kControlPopupButtonMenuIDTag: ("h", None, None), ! ! kControlListBoxDoubleClickTag: ("b", None, None), } def SetControlData(control, part, selector, data): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! setfunc(control, part, selector, data) ! return ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! if coder: ! data = coder(data) ! if structfmt: ! data = struct.pack(structfmt, data) ! control.SetControlData(part, selector, data) ! def GetControlData(control, part, selector): ! if _accessdict.has_key(selector): ! setfunc, getfunc = _accessdict[selector] ! return getfunc(control, part, selector, data) ! if not _codingdict.has_key(selector): ! raise KeyError, ('Unknown control selector', selector) ! structfmt, coder, decoder = _codingdict[selector] ! data = control.GetControlData(part, selector) ! if structfmt: ! data = struct.unpack(structfmt, data) ! if decoder: ! data = decoder(data) ! if type(data) == type(()) and len(data) == 1: ! data = data[0] ! return data ! Index: Res.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Res.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Res.py 30 Dec 2002 22:04:21 -0000 1.1 --- Res.py 9 Apr 2003 13:25:19 -0000 1.2 *************** *** 1,4 **** try: ! from OverrideFrom23._Res import * except ImportError: ! from _Res import * --- 1,4 ---- try: ! from OverrideFrom23._Res import * except ImportError: ! from _Res import * From jackjansen@users.sourceforge.net Wed Apr 9 14:25:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 09 Apr 2003 06:25:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac Audio_mac.py,1.2,1.3 PixMapWrapper.py,1.2,1.3 aepack.py,1.5,1.6 aetools.py,1.6,1.7 aetypes.py,1.4,1.5 applesingle.py,1.1,1.2 appletrawmain.py,1.1,1.2 appletrunner.py,1.1,1.2 bgenlocations.py,1.3,1.4 buildtools.py,1.8,1.9 bundlebuilder.py,1.24,1.25 cfmfile.py,1.2,1.3 findertools.py,1.3,1.4 gensuitemodule.py,1.5,1.6 ic.py,1.4,1.5 macerrors.py,1.1,1.2 macfs.py,1.9,1.10 macresource.py,1.4,1.5 pimp.py,1.14,1.15 plistlib.py,1.1,1.2 videoreader.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv29131 Modified Files: Audio_mac.py PixMapWrapper.py aepack.py aetools.py aetypes.py applesingle.py appletrawmain.py appletrunner.py bgenlocations.py buildtools.py bundlebuilder.py cfmfile.py findertools.py gensuitemodule.py ic.py macerrors.py macfs.py macresource.py pimp.py plistlib.py videoreader.py Log Message: Detabbed. Index: Audio_mac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Audio_mac.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Audio_mac.py 6 Feb 2003 23:12:23 -0000 1.2 --- Audio_mac.py 9 Apr 2003 13:25:42 -0000 1.3 *************** *** 4,121 **** class Play_Audio_mac: ! def __init__(self, qsize=QSIZE): ! self._chan = None ! self._qsize = qsize ! self._outrate = 22254 ! self._sampwidth = 1 ! self._nchannels = 1 ! self._gc = [] ! self._usercallback = None ! def __del__(self): ! self.stop() ! self._usercallback = None ! def wait(self): ! import time ! while self.getfilled(): ! time.sleep(0.1) ! self._chan = None ! self._gc = [] ! def stop(self, quietNow = 1): ! ##chan = self._chan ! self._chan = None ! ##chan.SndDisposeChannel(1) ! self._gc = [] ! def setoutrate(self, outrate): ! self._outrate = outrate ! def setsampwidth(self, sampwidth): ! self._sampwidth = sampwidth ! def setnchannels(self, nchannels): ! self._nchannels = nchannels ! def writeframes(self, data): ! import time ! from Carbon.Sound import bufferCmd, callBackCmd, extSH ! import struct ! import MacOS ! if not self._chan: ! from Carbon import Snd ! self._chan = Snd.SndNewChannel(5, 0, self._callback) ! nframes = len(data) / self._nchannels / self._sampwidth ! if len(data) != nframes * self._nchannels * self._sampwidth: ! raise error, 'data is not a whole number of frames' ! while self._gc and \ ! self.getfilled() + nframes > \ ! self._qsize / self._nchannels / self._sampwidth: ! time.sleep(0.1) ! if self._sampwidth == 1: ! import audioop ! data = audioop.add(data, '\x80'*len(data), 1) ! h1 = struct.pack('llHhllbbl', ! id(data)+MacOS.string_id_to_buffer, ! self._nchannels, ! self._outrate, 0, ! 0, ! 0, ! extSH, ! 60, ! nframes) ! h2 = 22*'\0' ! h3 = struct.pack('hhlll', ! self._sampwidth*8, ! 0, ! 0, ! 0, ! 0) ! header = h1+h2+h3 ! self._gc.append((header, data)) ! self._chan.SndDoCommand((bufferCmd, 0, header), 0) ! self._chan.SndDoCommand((callBackCmd, 0, 0), 0) ! def _callback(self, *args): ! del self._gc[0] ! if self._usercallback: ! self._usercallback() ! ! def setcallback(self, callback): ! self._usercallback = callback ! def getfilled(self): ! filled = 0 ! for header, data in self._gc: ! filled = filled + len(data) ! return filled / self._nchannels / self._sampwidth ! def getfillable(self): ! return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled() ! def ulaw2lin(self, data): ! import audioop ! return audioop.ulaw2lin(data, 2) def test(): ! import aifc ! import EasyDialogs ! fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",)) ! if not fn: return ! af = aifc.open(fn, 'r') ! print af.getparams() ! p = Play_Audio_mac() ! p.setoutrate(af.getframerate()) ! p.setsampwidth(af.getsampwidth()) ! p.setnchannels(af.getnchannels()) ! BUFSIZ = 10000 ! while 1: ! data = af.readframes(BUFSIZ) ! if not data: break ! p.writeframes(data) ! print 'wrote', len(data), 'space', p.getfillable() ! p.wait() if __name__ == '__main__': ! test() --- 4,121 ---- class Play_Audio_mac: ! def __init__(self, qsize=QSIZE): ! self._chan = None ! self._qsize = qsize ! self._outrate = 22254 ! self._sampwidth = 1 ! self._nchannels = 1 ! self._gc = [] ! self._usercallback = None ! def __del__(self): ! self.stop() ! self._usercallback = None ! def wait(self): ! import time ! while self.getfilled(): ! time.sleep(0.1) ! self._chan = None ! self._gc = [] ! def stop(self, quietNow = 1): ! ##chan = self._chan ! self._chan = None ! ##chan.SndDisposeChannel(1) ! self._gc = [] ! def setoutrate(self, outrate): ! self._outrate = outrate ! def setsampwidth(self, sampwidth): ! self._sampwidth = sampwidth ! def setnchannels(self, nchannels): ! self._nchannels = nchannels ! def writeframes(self, data): ! import time ! from Carbon.Sound import bufferCmd, callBackCmd, extSH ! import struct ! import MacOS ! if not self._chan: ! from Carbon import Snd ! self._chan = Snd.SndNewChannel(5, 0, self._callback) ! nframes = len(data) / self._nchannels / self._sampwidth ! if len(data) != nframes * self._nchannels * self._sampwidth: ! raise error, 'data is not a whole number of frames' ! while self._gc and \ ! self.getfilled() + nframes > \ ! self._qsize / self._nchannels / self._sampwidth: ! time.sleep(0.1) ! if self._sampwidth == 1: ! import audioop ! data = audioop.add(data, '\x80'*len(data), 1) ! h1 = struct.pack('llHhllbbl', ! id(data)+MacOS.string_id_to_buffer, ! self._nchannels, ! self._outrate, 0, ! 0, ! 0, ! extSH, ! 60, ! nframes) ! h2 = 22*'\0' ! h3 = struct.pack('hhlll', ! self._sampwidth*8, ! 0, ! 0, ! 0, ! 0) ! header = h1+h2+h3 ! self._gc.append((header, data)) ! self._chan.SndDoCommand((bufferCmd, 0, header), 0) ! self._chan.SndDoCommand((callBackCmd, 0, 0), 0) ! def _callback(self, *args): ! del self._gc[0] ! if self._usercallback: ! self._usercallback() ! ! def setcallback(self, callback): ! self._usercallback = callback ! def getfilled(self): ! filled = 0 ! for header, data in self._gc: ! filled = filled + len(data) ! return filled / self._nchannels / self._sampwidth ! def getfillable(self): ! return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled() ! def ulaw2lin(self, data): ! import audioop ! return audioop.ulaw2lin(data, 2) def test(): ! import aifc ! import EasyDialogs ! fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",)) ! if not fn: return ! af = aifc.open(fn, 'r') ! print af.getparams() ! p = Play_Audio_mac() ! p.setoutrate(af.getframerate()) ! p.setsampwidth(af.getsampwidth()) ! p.setnchannels(af.getnchannels()) ! BUFSIZ = 10000 ! while 1: ! data = af.readframes(BUFSIZ) ! if not data: break ! p.writeframes(data) ! print 'wrote', len(data), 'space', p.getfillable() ! p.wait() if __name__ == '__main__': ! test() Index: PixMapWrapper.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/PixMapWrapper.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PixMapWrapper.py 21 Feb 2003 23:18:48 -0000 1.2 --- PixMapWrapper.py 9 Apr 2003 13:25:42 -0000 1.3 *************** *** 15,215 **** # PixMap data structure element format (as used with struct) _pmElemFormat = { ! 'baseAddr':'l', # address of pixel data ! 'rowBytes':'H', # bytes per row, plus 0x8000 ! 'bounds':'hhhh', # coordinates imposed over pixel data ! 'top':'h', ! 'left':'h', ! 'bottom':'h', ! 'right':'h', ! 'pmVersion':'h', # flags for Color QuickDraw ! 'packType':'h', # format of compression algorithm ! 'packSize':'l', # size after compression ! 'hRes':'l', # horizontal pixels per inch ! 'vRes':'l', # vertical pixels per inch ! 'pixelType':'h', # pixel format ! 'pixelSize':'h', # bits per pixel ! 'cmpCount':'h', # color components per pixel ! 'cmpSize':'h', # bits per component ! 'planeBytes':'l', # offset in bytes to next plane ! 'pmTable':'l', # handle to color table ! 'pmReserved':'l' # reserved for future use } # PixMap data structure element offset _pmElemOffset = { ! 'baseAddr':0, ! 'rowBytes':4, ! 'bounds':6, ! 'top':6, ! 'left':8, ! 'bottom':10, ! 'right':12, ! 'pmVersion':14, ! 'packType':16, ! 'packSize':18, ! 'hRes':22, ! 'vRes':26, ! 'pixelType':30, ! 'pixelSize':32, ! 'cmpCount':34, ! 'cmpSize':36, ! 'planeBytes':38, ! 'pmTable':42, ! 'pmReserved':46 } class PixMapWrapper: ! """PixMapWrapper -- wraps the QD PixMap object in a Python class, ! with methods to easily get/set various pixmap fields. Note: Use the ! PixMap() method when passing to QD calls.""" ! def __init__(self): ! self.__dict__['data'] = '' ! self._header = struct.pack("lhhhhhhhlllhhhhlll", ! id(self.data)+MacOS.string_id_to_buffer, ! 0, # rowBytes ! 0, 0, 0, 0, # bounds ! 0, # pmVersion ! 0, 0, # packType, packSize ! 72<<16, 72<<16, # hRes, vRes ! QuickDraw.RGBDirect, # pixelType ! 16, # pixelSize ! 2, 5, # cmpCount, cmpSize, ! 0, 0, 0) # planeBytes, pmTable, pmReserved ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! ! def _stuff(self, element, bytes): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! self._header = self._header[:offset] \ ! + struct.pack(fmt, bytes) \ ! + self._header[offset + struct.calcsize(fmt):] ! self.__dict__['_pm'] = None ! ! def _unstuff(self, element): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0] ! def __setattr__(self, attr, val): ! if attr == 'baseAddr': ! raise 'UseErr', "don't assign to .baseAddr -- assign to .data instead" ! elif attr == 'data': ! self.__dict__['data'] = val ! self._stuff('baseAddr', id(self.data) + MacOS.string_id_to_buffer) ! elif attr == 'rowBytes': ! # high bit is always set for some odd reason ! self._stuff('rowBytes', val | 0x8000) ! elif attr == 'bounds': ! # assume val is in official Left, Top, Right, Bottom order! ! self._stuff('left',val[0]) ! self._stuff('top',val[1]) ! self._stuff('right',val[2]) ! self._stuff('bottom',val[3]) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! self._stuff(attr, int(val) << 16) ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just stuff ! self._stuff(attr, val) ! else: ! self.__dict__[attr] = val ! def __getattr__(self, attr): ! if attr == 'rowBytes': ! # high bit is always set for some odd reason ! return self._unstuff('rowBytes') & 0x7FFF ! elif attr == 'bounds': ! # return bounds in official Left, Top, Right, Bottom order! ! return ( \ ! self._unstuff('left'), ! self._unstuff('top'), ! self._unstuff('right'), ! self._unstuff('bottom') ) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! return self._unstuff(attr) >> 16 ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just unstuff ! return self._unstuff(attr) ! else: ! return self.__dict__[attr] ! ! def PixMap(self): ! "Return a QuickDraw PixMap corresponding to this data." ! if not self.__dict__['_pm']: ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! return self.__dict__['_pm'] ! def blit(self, x1=0,y1=0,x2=None,y2=None, port=None): ! """Draw this pixmap into the given (default current) grafport.""" ! src = self.bounds ! dest = [x1,y1,x2,y2] ! if x2 == None: ! dest[2] = x1 + src[2]-src[0] ! if y2 == None: ! dest[3] = y1 + src[3]-src[1] ! if not port: port = Qd.GetPort() ! Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), ! QuickDraw.srcCopy, None) ! ! def fromstring(self,s,width,height,format=imgformat.macrgb): ! """Stuff this pixmap with raw pixel data from a string. ! Supply width, height, and one of the imgformat specifiers.""" ! # we only support 16- and 32-bit mac rgb... ! # so convert if necessary ! if format != imgformat.macrgb and format != imgformat.macrgb16: ! # (LATER!) ! raise "NotImplementedError", "conversion to macrgb or macrgb16" ! self.data = s ! self.bounds = (0,0,width,height) ! self.cmpCount = 3 ! self.pixelType = QuickDraw.RGBDirect ! if format == imgformat.macrgb: ! self.pixelSize = 32 ! self.cmpSize = 8 ! else: ! self.pixelSize = 16 ! self.cmpSize = 5 ! self.rowBytes = width*self.pixelSize/8 ! def tostring(self, format=imgformat.macrgb): ! """Return raw data as a string in the specified format.""" ! # is the native format requested? if so, just return data ! if (format == imgformat.macrgb and self.pixelSize == 32) or \ ! (format == imgformat.macrgb16 and self.pixelsize == 16): ! return self.data ! # otherwise, convert to the requested format ! # (LATER!) ! raise "NotImplementedError", "data format conversion" ! def fromImage(self,im): ! """Initialize this PixMap from a PIL Image object.""" ! # We need data in ARGB format; PIL can't currently do that, ! # but it can do RGBA, which we can use by inserting one null ! # up frontpm = ! if im.mode != 'RGBA': im = im.convert('RGBA') ! data = chr(0) + im.tostring() ! self.fromstring(data, im.size[0], im.size[1]) ! def toImage(self): ! """Return the contents of this PixMap as a PIL Image object.""" ! import Image ! # our tostring() method returns data in ARGB format, ! # whereas Image uses RGBA; a bit of slicing fixes this... ! data = self.tostring()[1:] + chr(0) ! bounds = self.bounds ! return Image.fromstring('RGBA',(bounds[2]-bounds[0],bounds[3]-bounds[1]),data) def test(): ! import MacOS ! import EasyDialogs ! import Image ! path = EasyDialogs.AskFileForOpen("Image File:") ! if not path: return ! pm = PixMapWrapper() ! pm.fromImage( Image.open(path) ) ! pm.blit(20,20) ! return pm --- 15,215 ---- # PixMap data structure element format (as used with struct) _pmElemFormat = { ! 'baseAddr':'l', # address of pixel data ! 'rowBytes':'H', # bytes per row, plus 0x8000 ! 'bounds':'hhhh', # coordinates imposed over pixel data ! 'top':'h', ! 'left':'h', ! 'bottom':'h', ! 'right':'h', ! 'pmVersion':'h', # flags for Color QuickDraw ! 'packType':'h', # format of compression algorithm ! 'packSize':'l', # size after compression ! 'hRes':'l', # horizontal pixels per inch ! 'vRes':'l', # vertical pixels per inch ! 'pixelType':'h', # pixel format ! 'pixelSize':'h', # bits per pixel ! 'cmpCount':'h', # color components per pixel ! 'cmpSize':'h', # bits per component ! 'planeBytes':'l', # offset in bytes to next plane ! 'pmTable':'l', # handle to color table ! 'pmReserved':'l' # reserved for future use } # PixMap data structure element offset _pmElemOffset = { ! 'baseAddr':0, ! 'rowBytes':4, ! 'bounds':6, ! 'top':6, ! 'left':8, ! 'bottom':10, ! 'right':12, ! 'pmVersion':14, ! 'packType':16, ! 'packSize':18, ! 'hRes':22, ! 'vRes':26, ! 'pixelType':30, ! 'pixelSize':32, ! 'cmpCount':34, ! 'cmpSize':36, ! 'planeBytes':38, ! 'pmTable':42, ! 'pmReserved':46 } class PixMapWrapper: ! """PixMapWrapper -- wraps the QD PixMap object in a Python class, ! with methods to easily get/set various pixmap fields. Note: Use the ! PixMap() method when passing to QD calls.""" ! def __init__(self): ! self.__dict__['data'] = '' ! self._header = struct.pack("lhhhhhhhlllhhhhlll", ! id(self.data)+MacOS.string_id_to_buffer, ! 0, # rowBytes ! 0, 0, 0, 0, # bounds ! 0, # pmVersion ! 0, 0, # packType, packSize ! 72<<16, 72<<16, # hRes, vRes ! QuickDraw.RGBDirect, # pixelType ! 16, # pixelSize ! 2, 5, # cmpCount, cmpSize, ! 0, 0, 0) # planeBytes, pmTable, pmReserved ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! ! def _stuff(self, element, bytes): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! self._header = self._header[:offset] \ ! + struct.pack(fmt, bytes) \ ! + self._header[offset + struct.calcsize(fmt):] ! self.__dict__['_pm'] = None ! ! def _unstuff(self, element): ! offset = _pmElemOffset[element] ! fmt = _pmElemFormat[element] ! return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0] ! def __setattr__(self, attr, val): ! if attr == 'baseAddr': ! raise 'UseErr', "don't assign to .baseAddr -- assign to .data instead" ! elif attr == 'data': ! self.__dict__['data'] = val ! self._stuff('baseAddr', id(self.data) + MacOS.string_id_to_buffer) ! elif attr == 'rowBytes': ! # high bit is always set for some odd reason ! self._stuff('rowBytes', val | 0x8000) ! elif attr == 'bounds': ! # assume val is in official Left, Top, Right, Bottom order! ! self._stuff('left',val[0]) ! self._stuff('top',val[1]) ! self._stuff('right',val[2]) ! self._stuff('bottom',val[3]) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! self._stuff(attr, int(val) << 16) ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just stuff ! self._stuff(attr, val) ! else: ! self.__dict__[attr] = val ! def __getattr__(self, attr): ! if attr == 'rowBytes': ! # high bit is always set for some odd reason ! return self._unstuff('rowBytes') & 0x7FFF ! elif attr == 'bounds': ! # return bounds in official Left, Top, Right, Bottom order! ! return ( \ ! self._unstuff('left'), ! self._unstuff('top'), ! self._unstuff('right'), ! self._unstuff('bottom') ) ! elif attr == 'hRes' or attr == 'vRes': ! # 16.16 fixed format, so just shift 16 bits ! return self._unstuff(attr) >> 16 ! elif attr in _pmElemFormat.keys(): ! # any other pm attribute -- just unstuff ! return self._unstuff(attr) ! else: ! return self.__dict__[attr] ! ! def PixMap(self): ! "Return a QuickDraw PixMap corresponding to this data." ! if not self.__dict__['_pm']: ! self.__dict__['_pm'] = Qd.RawBitMap(self._header) ! return self.__dict__['_pm'] ! def blit(self, x1=0,y1=0,x2=None,y2=None, port=None): ! """Draw this pixmap into the given (default current) grafport.""" ! src = self.bounds ! dest = [x1,y1,x2,y2] ! if x2 == None: ! dest[2] = x1 + src[2]-src[0] ! if y2 == None: ! dest[3] = y1 + src[3]-src[1] ! if not port: port = Qd.GetPort() ! Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), ! QuickDraw.srcCopy, None) ! ! def fromstring(self,s,width,height,format=imgformat.macrgb): ! """Stuff this pixmap with raw pixel data from a string. ! Supply width, height, and one of the imgformat specifiers.""" ! # we only support 16- and 32-bit mac rgb... ! # so convert if necessary ! if format != imgformat.macrgb and format != imgformat.macrgb16: ! # (LATER!) ! raise "NotImplementedError", "conversion to macrgb or macrgb16" ! self.data = s ! self.bounds = (0,0,width,height) ! self.cmpCount = 3 ! self.pixelType = QuickDraw.RGBDirect ! if format == imgformat.macrgb: ! self.pixelSize = 32 ! self.cmpSize = 8 ! else: ! self.pixelSize = 16 ! self.cmpSize = 5 ! self.rowBytes = width*self.pixelSize/8 ! def tostring(self, format=imgformat.macrgb): ! """Return raw data as a string in the specified format.""" ! # is the native format requested? if so, just return data ! if (format == imgformat.macrgb and self.pixelSize == 32) or \ ! (format == imgformat.macrgb16 and self.pixelsize == 16): ! return self.data ! # otherwise, convert to the requested format ! # (LATER!) ! raise "NotImplementedError", "data format conversion" ! def fromImage(self,im): ! """Initialize this PixMap from a PIL Image object.""" ! # We need data in ARGB format; PIL can't currently do that, ! # but it can do RGBA, which we can use by inserting one null ! # up frontpm = ! if im.mode != 'RGBA': im = im.convert('RGBA') ! data = chr(0) + im.tostring() ! self.fromstring(data, im.size[0], im.size[1]) ! def toImage(self): ! """Return the contents of this PixMap as a PIL Image object.""" ! import Image ! # our tostring() method returns data in ARGB format, ! # whereas Image uses RGBA; a bit of slicing fixes this... ! data = self.tostring()[1:] + chr(0) ! bounds = self.bounds ! return Image.fromstring('RGBA',(bounds[2]-bounds[0],bounds[3]-bounds[1]),data) def test(): ! import MacOS ! import EasyDialogs ! import Image ! path = EasyDialogs.AskFileForOpen("Image File:") ! if not path: return ! pm = PixMapWrapper() ! pm.fromImage( Image.open(path) ) ! pm.blit(20,20) ! return pm Index: aepack.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aepack.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aepack.py 31 Mar 2003 13:32:59 -0000 1.5 --- aepack.py 9 Apr 2003 13:25:42 -0000 1.6 *************** *** 45,57 **** # unpacker_coercions = { ! typeComp : typeFloat, ! typeColorTable : typeAEList, ! typeDrawingArea : typeAERecord, ! typeFixed : typeFloat, ! typeExtended : typeFloat, ! typePixelMap : typeAERecord, ! typeRotation : typeAERecord, ! typeStyledText : typeAERecord, ! typeTextStyles : typeAERecord, }; --- 45,57 ---- # unpacker_coercions = { ! typeComp : typeFloat, ! typeColorTable : typeAEList, ! typeDrawingArea : typeAERecord, ! typeFixed : typeFloat, ! typeExtended : typeFloat, ! typePixelMap : typeAERecord, ! typeRotation : typeAERecord, ! typeStyledText : typeAERecord, ! typeTextStyles : typeAERecord, }; *************** *** 65,259 **** def packkey(ae, key, value): ! if hasattr(key, 'which'): ! keystr = key.which ! elif hasattr(key, 'want'): ! keystr = key.want ! else: ! keystr = key ! ae.AEPutParamDesc(keystr, pack(value)) def pack(x, forcetype = None): ! """Pack a python object into an AE descriptor""" ! ! if forcetype: ! if type(x) is StringType: ! return AE.AECreateDesc(forcetype, x) ! else: ! return pack(x).AECoerceDesc(forcetype) ! ! if x == None: ! return AE.AECreateDesc('null', '') ! ! if isinstance(x, AEDescType): ! return x ! if isinstance(x, FSSType): ! return AE.AECreateDesc('fss ', x.data) ! if isinstance(x, FSRefType): ! return AE.AECreateDesc('fsrf', x.data) ! if isinstance(x, AliasType): ! return AE.AECreateDesc('alis', x.data) ! if isinstance(x, IntType): ! return AE.AECreateDesc('long', struct.pack('l', x)) ! if isinstance(x, FloatType): ! return AE.AECreateDesc('doub', struct.pack('d', x)) ! if isinstance(x, StringType): ! return AE.AECreateDesc('TEXT', x) ! if isinstance(x, UnicodeType): ! data = x.encode('utf16') ! if data[:2] == '\xfe\xff': ! data = data[2:] ! return AE.AECreateDesc('utxt', data) ! if isinstance(x, ListType): ! list = AE.AECreateList('', 0) ! for item in x: ! list.AEPutDesc(0, pack(item)) ! return list ! if isinstance(x, DictionaryType): ! record = AE.AECreateList('', 1) ! for key, value in x.items(): ! packkey(record, key, value) ! #record.AEPutParamDesc(key, pack(value)) ! return record ! if type(x) == types.ClassType and issubclass(x, ObjectSpecifier): ! # Note: we are getting a class object here, not an instance ! return AE.AECreateDesc('type', x.want) ! if hasattr(x, '__aepack__'): ! return x.__aepack__() ! if hasattr(x, 'which'): ! return AE.AECreateDesc('TEXT', x.which) ! if hasattr(x, 'want'): ! return AE.AECreateDesc('TEXT', x.want) ! return AE.AECreateDesc('TEXT', repr(x)) # Copout def unpack(desc, formodulename=""): ! """Unpack an AE descriptor to a python object""" ! t = desc.type ! ! if unpacker_coercions.has_key(t): ! desc = desc.AECoerceDesc(unpacker_coercions[t]) ! t = desc.type # This is a guess by Jack.... ! ! if t == typeAEList: ! l = [] ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! l.append(unpack(item, formodulename)) ! return l ! if t == typeAERecord: ! d = {} ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! d[keyword] = unpack(item, formodulename) ! return d ! if t == typeAEText: ! record = desc.AECoerceDesc('reco') ! return mkaetext(unpack(record, formodulename)) ! if t == typeAlias: ! return Carbon.File.Alias(rawdata=desc.data) ! # typeAppleEvent returned as unknown ! if t == typeBoolean: ! return struct.unpack('b', desc.data)[0] ! if t == typeChar: ! return desc.data ! if t == typeUnicodeText: ! return unicode(desc.data, 'utf16') ! # typeColorTable coerced to typeAEList ! # typeComp coerced to extended ! # typeData returned as unknown ! # typeDrawingArea coerced to typeAERecord ! if t == typeEnumeration: ! return mkenum(desc.data) ! # typeEPS returned as unknown ! if t == typeFalse: ! return 0 ! if t == typeFloat: ! data = desc.data ! return struct.unpack('d', data)[0] ! if t == typeFSS: ! return Carbon.File.FSSpec(rawdata=desc.data) ! if t == typeFSRef: ! return Carbon.File.FSRef(rawdata=desc.data) ! if t == typeInsertionLoc: ! record = desc.AECoerceDesc('reco') ! return mkinsertionloc(unpack(record, formodulename)) ! # typeInteger equal to typeLongInteger ! if t == typeIntlText: ! script, language = struct.unpack('hh', desc.data[:4]) ! return aetypes.IntlText(script, language, desc.data[4:]) ! if t == typeIntlWritingCode: ! script, language = struct.unpack('hh', desc.data) ! return aetypes.IntlWritingCode(script, language) ! if t == typeKeyword: ! return mkkeyword(desc.data) ! if t == typeLongInteger: ! return struct.unpack('l', desc.data)[0] ! if t == typeLongDateTime: ! a, b = struct.unpack('lL', desc.data) ! return (long(a) << 32) + b ! if t == typeNull: ! return None ! if t == typeMagnitude: ! v = struct.unpack('l', desc.data) ! if v < 0: ! v = 0x100000000L + v ! return v ! if t == typeObjectSpecifier: ! record = desc.AECoerceDesc('reco') ! # If we have been told the name of the module we are unpacking aedescs for, ! # we can attempt to create the right type of python object from that module. ! if formodulename: ! return mkobjectfrommodule(unpack(record, formodulename), formodulename) ! return mkobject(unpack(record, formodulename)) ! # typePict returned as unknown ! # typePixelMap coerced to typeAERecord ! # typePixelMapMinus returned as unknown ! # typeProcessSerialNumber returned as unknown ! if t == typeQDPoint: ! v, h = struct.unpack('hh', desc.data) ! return aetypes.QDPoint(v, h) ! if t == typeQDRectangle: ! v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) ! return aetypes.QDRectangle(v0, h0, v1, h1) ! if t == typeRGBColor: ! r, g, b = struct.unpack('hhh', desc.data) ! return aetypes.RGBColor(r, g, b) ! # typeRotation coerced to typeAERecord ! # typeScrapStyles returned as unknown ! # typeSessionID returned as unknown ! if t == typeShortFloat: ! return struct.unpack('f', desc.data)[0] ! if t == typeShortInteger: ! return struct.unpack('h', desc.data)[0] ! # typeSMFloat identical to typeShortFloat ! # typeSMInt indetical to typeShortInt ! # typeStyledText coerced to typeAERecord ! if t == typeTargetID: ! return mktargetid(desc.data) ! # typeTextStyles coerced to typeAERecord ! # typeTIFF returned as unknown ! if t == typeTrue: ! return 1 ! if t == typeType: ! return mktype(desc.data, formodulename) ! # ! # The following are special ! # ! if t == 'rang': ! record = desc.AECoerceDesc('reco') ! return mkrange(unpack(record, formodulename)) ! if t == 'cmpd': ! record = desc.AECoerceDesc('reco') ! return mkcomparison(unpack(record, formodulename)) ! if t == 'logi': ! record = desc.AECoerceDesc('reco') ! return mklogical(unpack(record, formodulename)) ! return mkunknown(desc.type, desc.data) ! def coerce(data, egdata): ! """Coerce a python object to another type using the AE coercers""" ! pdata = pack(data) ! pegdata = pack(egdata) ! pdata = pdata.AECoerceDesc(pegdata.type) ! return unpack(pdata) # --- 65,259 ---- def packkey(ae, key, value): ! if hasattr(key, 'which'): ! keystr = key.which ! elif hasattr(key, 'want'): ! keystr = key.want ! else: ! keystr = key ! ae.AEPutParamDesc(keystr, pack(value)) def pack(x, forcetype = None): ! """Pack a python object into an AE descriptor""" ! ! if forcetype: ! if type(x) is StringType: ! return AE.AECreateDesc(forcetype, x) ! else: ! return pack(x).AECoerceDesc(forcetype) ! ! if x == None: ! return AE.AECreateDesc('null', '') ! ! if isinstance(x, AEDescType): ! return x ! if isinstance(x, FSSType): ! return AE.AECreateDesc('fss ', x.data) ! if isinstance(x, FSRefType): ! return AE.AECreateDesc('fsrf', x.data) ! if isinstance(x, AliasType): ! return AE.AECreateDesc('alis', x.data) ! if isinstance(x, IntType): ! return AE.AECreateDesc('long', struct.pack('l', x)) ! if isinstance(x, FloatType): ! return AE.AECreateDesc('doub', struct.pack('d', x)) ! if isinstance(x, StringType): ! return AE.AECreateDesc('TEXT', x) ! if isinstance(x, UnicodeType): ! data = x.encode('utf16') ! if data[:2] == '\xfe\xff': ! data = data[2:] ! return AE.AECreateDesc('utxt', data) ! if isinstance(x, ListType): ! list = AE.AECreateList('', 0) ! for item in x: ! list.AEPutDesc(0, pack(item)) ! return list ! if isinstance(x, DictionaryType): ! record = AE.AECreateList('', 1) ! for key, value in x.items(): ! packkey(record, key, value) ! #record.AEPutParamDesc(key, pack(value)) ! return record ! if type(x) == types.ClassType and issubclass(x, ObjectSpecifier): ! # Note: we are getting a class object here, not an instance ! return AE.AECreateDesc('type', x.want) ! if hasattr(x, '__aepack__'): ! return x.__aepack__() ! if hasattr(x, 'which'): ! return AE.AECreateDesc('TEXT', x.which) ! if hasattr(x, 'want'): ! return AE.AECreateDesc('TEXT', x.want) ! return AE.AECreateDesc('TEXT', repr(x)) # Copout def unpack(desc, formodulename=""): ! """Unpack an AE descriptor to a python object""" ! t = desc.type ! ! if unpacker_coercions.has_key(t): ! desc = desc.AECoerceDesc(unpacker_coercions[t]) ! t = desc.type # This is a guess by Jack.... ! ! if t == typeAEList: ! l = [] ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! l.append(unpack(item, formodulename)) ! return l ! if t == typeAERecord: ! d = {} ! for i in range(desc.AECountItems()): ! keyword, item = desc.AEGetNthDesc(i+1, '****') ! d[keyword] = unpack(item, formodulename) ! return d ! if t == typeAEText: ! record = desc.AECoerceDesc('reco') ! return mkaetext(unpack(record, formodulename)) ! if t == typeAlias: ! return Carbon.File.Alias(rawdata=desc.data) ! # typeAppleEvent returned as unknown ! if t == typeBoolean: ! return struct.unpack('b', desc.data)[0] ! if t == typeChar: ! return desc.data ! if t == typeUnicodeText: ! return unicode(desc.data, 'utf16') ! # typeColorTable coerced to typeAEList ! # typeComp coerced to extended ! # typeData returned as unknown ! # typeDrawingArea coerced to typeAERecord ! if t == typeEnumeration: ! return mkenum(desc.data) ! # typeEPS returned as unknown ! if t == typeFalse: ! return 0 ! if t == typeFloat: ! data = desc.data ! return struct.unpack('d', data)[0] ! if t == typeFSS: ! return Carbon.File.FSSpec(rawdata=desc.data) ! if t == typeFSRef: ! return Carbon.File.FSRef(rawdata=desc.data) ! if t == typeInsertionLoc: ! record = desc.AECoerceDesc('reco') ! return mkinsertionloc(unpack(record, formodulename)) ! # typeInteger equal to typeLongInteger ! if t == typeIntlText: ! script, language = struct.unpack('hh', desc.data[:4]) ! return aetypes.IntlText(script, language, desc.data[4:]) ! if t == typeIntlWritingCode: ! script, language = struct.unpack('hh', desc.data) ! return aetypes.IntlWritingCode(script, language) ! if t == typeKeyword: ! return mkkeyword(desc.data) ! if t == typeLongInteger: ! return struct.unpack('l', desc.data)[0] ! if t == typeLongDateTime: ! a, b = struct.unpack('lL', desc.data) ! return (long(a) << 32) + b ! if t == typeNull: ! return None ! if t == typeMagnitude: ! v = struct.unpack('l', desc.data) ! if v < 0: ! v = 0x100000000L + v ! return v ! if t == typeObjectSpecifier: ! record = desc.AECoerceDesc('reco') ! # If we have been told the name of the module we are unpacking aedescs for, ! # we can attempt to create the right type of python object from that module. ! if formodulename: ! return mkobjectfrommodule(unpack(record, formodulename), formodulename) ! return mkobject(unpack(record, formodulename)) ! # typePict returned as unknown ! # typePixelMap coerced to typeAERecord ! # typePixelMapMinus returned as unknown ! # typeProcessSerialNumber returned as unknown ! if t == typeQDPoint: ! v, h = struct.unpack('hh', desc.data) ! return aetypes.QDPoint(v, h) ! if t == typeQDRectangle: ! v0, h0, v1, h1 = struct.unpack('hhhh', desc.data) ! return aetypes.QDRectangle(v0, h0, v1, h1) ! if t == typeRGBColor: ! r, g, b = struct.unpack('hhh', desc.data) ! return aetypes.RGBColor(r, g, b) ! # typeRotation coerced to typeAERecord ! # typeScrapStyles returned as unknown ! # typeSessionID returned as unknown ! if t == typeShortFloat: ! return struct.unpack('f', desc.data)[0] ! if t == typeShortInteger: ! return struct.unpack('h', desc.data)[0] ! # typeSMFloat identical to typeShortFloat ! # typeSMInt indetical to typeShortInt ! # typeStyledText coerced to typeAERecord ! if t == typeTargetID: ! return mktargetid(desc.data) ! # typeTextStyles coerced to typeAERecord ! # typeTIFF returned as unknown ! if t == typeTrue: ! return 1 ! if t == typeType: ! return mktype(desc.data, formodulename) ! # ! # The following are special ! # ! if t == 'rang': ! record = desc.AECoerceDesc('reco') ! return mkrange(unpack(record, formodulename)) ! if t == 'cmpd': ! record = desc.AECoerceDesc('reco') ! return mkcomparison(unpack(record, formodulename)) ! if t == 'logi': ! record = desc.AECoerceDesc('reco') ! return mklogical(unpack(record, formodulename)) ! return mkunknown(desc.type, desc.data) ! def coerce(data, egdata): ! """Coerce a python object to another type using the AE coercers""" ! pdata = pack(data) ! pegdata = pack(egdata) ! pdata = pdata.AECoerceDesc(pegdata.type) ! return unpack(pdata) # *************** *** 261,340 **** # def mktargetid(data): ! sessionID = getlong(data[:4]) ! name = mkppcportrec(data[4:4+72]) ! location = mklocationnamerec(data[76:76+36]) ! rcvrName = mkppcportrec(data[112:112+72]) ! return sessionID, name, location, rcvrName def mkppcportrec(rec): ! namescript = getword(rec[:2]) ! name = getpstr(rec[2:2+33]) ! portkind = getword(rec[36:38]) ! if portkind == 1: ! ctor = rec[38:42] ! type = rec[42:46] ! identity = (ctor, type) ! else: ! identity = getpstr(rec[38:38+33]) ! return namescript, name, portkind, identity def mklocationnamerec(rec): ! kind = getword(rec[:2]) ! stuff = rec[2:] ! if kind == 0: stuff = None ! if kind == 2: stuff = getpstr(stuff) ! return kind, stuff def mkunknown(type, data): ! return aetypes.Unknown(type, data) def getpstr(s): ! return s[1:1+ord(s[0])] def getlong(s): ! return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) def getword(s): ! return (ord(s[0])<<8) | (ord(s[1])<<0) def mkkeyword(keyword): ! return aetypes.Keyword(keyword) def mkrange(dict): ! return aetypes.Range(dict['star'], dict['stop']) def mkcomparison(dict): ! return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) def mklogical(dict): ! return aetypes.Logical(dict['logc'], dict['term']) def mkstyledtext(dict): ! return aetypes.StyledText(dict['ksty'], dict['ktxt']) ! def mkaetext(dict): ! return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) ! def mkinsertionloc(dict): ! return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) def mkobject(dict): ! want = dict['want'].type ! form = dict['form'].enum ! seld = dict['seld'] ! fr = dict['from'] ! if form in ('name', 'indx', 'rang', 'test'): ! if want == 'text': return aetypes.Text(seld, fr) ! if want == 'cha ': return aetypes.Character(seld, fr) ! if want == 'cwor': return aetypes.Word(seld, fr) ! if want == 'clin': return aetypes.Line(seld, fr) ! if want == 'cpar': return aetypes.Paragraph(seld, fr) ! if want == 'cwin': return aetypes.Window(seld, fr) ! if want == 'docu': return aetypes.Document(seld, fr) ! if want == 'file': return aetypes.File(seld, fr) ! if want == 'cins': return aetypes.InsertionPoint(seld, fr) ! if want == 'prop' and form == 'prop' and aetypes.IsType(seld): ! return aetypes.Property(seld.type, fr) ! return aetypes.ObjectSpecifier(want, form, seld, fr) # Note by Jack: I'm not 100% sure of the following code. This was --- 261,340 ---- # def mktargetid(data): ! sessionID = getlong(data[:4]) ! name = mkppcportrec(data[4:4+72]) ! location = mklocationnamerec(data[76:76+36]) ! rcvrName = mkppcportrec(data[112:112+72]) ! return sessionID, name, location, rcvrName def mkppcportrec(rec): ! namescript = getword(rec[:2]) ! name = getpstr(rec[2:2+33]) ! portkind = getword(rec[36:38]) ! if portkind == 1: ! ctor = rec[38:42] ! type = rec[42:46] ! identity = (ctor, type) ! else: ! identity = getpstr(rec[38:38+33]) ! return namescript, name, portkind, identity def mklocationnamerec(rec): ! kind = getword(rec[:2]) ! stuff = rec[2:] ! if kind == 0: stuff = None ! if kind == 2: stuff = getpstr(stuff) ! return kind, stuff def mkunknown(type, data): ! return aetypes.Unknown(type, data) def getpstr(s): ! return s[1:1+ord(s[0])] def getlong(s): ! return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3]) def getword(s): ! return (ord(s[0])<<8) | (ord(s[1])<<0) def mkkeyword(keyword): ! return aetypes.Keyword(keyword) def mkrange(dict): ! return aetypes.Range(dict['star'], dict['stop']) def mkcomparison(dict): ! return aetypes.Comparison(dict['obj1'], dict['relo'].enum, dict['obj2']) def mklogical(dict): ! return aetypes.Logical(dict['logc'], dict['term']) def mkstyledtext(dict): ! return aetypes.StyledText(dict['ksty'], dict['ktxt']) ! def mkaetext(dict): ! return aetypes.AEText(dict[keyAEScriptTag], dict[keyAEStyles], dict[keyAEText]) ! def mkinsertionloc(dict): ! return aetypes.InsertionLoc(dict[keyAEObject], dict[keyAEPosition]) def mkobject(dict): ! want = dict['want'].type ! form = dict['form'].enum ! seld = dict['seld'] ! fr = dict['from'] ! if form in ('name', 'indx', 'rang', 'test'): ! if want == 'text': return aetypes.Text(seld, fr) ! if want == 'cha ': return aetypes.Character(seld, fr) ! if want == 'cwor': return aetypes.Word(seld, fr) ! if want == 'clin': return aetypes.Line(seld, fr) ! if want == 'cpar': return aetypes.Paragraph(seld, fr) ! if want == 'cwin': return aetypes.Window(seld, fr) ! if want == 'docu': return aetypes.Document(seld, fr) ! if want == 'file': return aetypes.File(seld, fr) ! if want == 'cins': return aetypes.InsertionPoint(seld, fr) ! if want == 'prop' and form == 'prop' and aetypes.IsType(seld): ! return aetypes.Property(seld.type, fr) ! return aetypes.ObjectSpecifier(want, form, seld, fr) # Note by Jack: I'm not 100% sure of the following code. This was *************** *** 343,366 **** # initializer for the classes in the suites? def mkobjectfrommodule(dict, modulename): ! if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): ! # The type has already been converted to Python. Convert back:-( ! classtype = dict['want'] ! dict['want'] = aetypes.mktype(classtype.want) ! want = dict['want'].type ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(want, None) ! newobj = mkobject(dict) ! if classtype: ! assert issubclass(classtype, ObjectSpecifier) ! newobj.__class__ = classtype ! return newobj ! def mktype(typecode, modulename=None): ! if modulename: ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(typecode, None) ! if classtype: ! return classtype ! return aetypes.mktype(typecode) --- 343,366 ---- # initializer for the classes in the suites? def mkobjectfrommodule(dict, modulename): ! if type(dict['want']) == types.ClassType and issubclass(dict['want'], ObjectSpecifier): ! # The type has already been converted to Python. Convert back:-( ! classtype = dict['want'] ! dict['want'] = aetypes.mktype(classtype.want) ! want = dict['want'].type ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(want, None) ! newobj = mkobject(dict) ! if classtype: ! assert issubclass(classtype, ObjectSpecifier) ! newobj.__class__ = classtype ! return newobj ! def mktype(typecode, modulename=None): ! if modulename: ! module = __import__(modulename) ! codenamemapper = module._classdeclarations ! classtype = codenamemapper.get(typecode, None) ! if classtype: ! return classtype ! return aetypes.mktype(typecode) Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** aetools.py 1 Apr 2003 22:27:18 -0000 1.6 --- aetools.py 9 Apr 2003 13:25:42 -0000 1.7 *************** *** 10,18 **** ranges, conditionals, logicals, etc., so you can write, e.g.: ! x = Character(1, Document("foobar")) and pack(x) will create an AE object reference equivalent to AppleScript's ! character 1 of document "foobar" Some of the stuff that appears to be exported from this module comes from other --- 10,18 ---- ranges, conditionals, logicals, etc., so you can write, e.g.: ! x = Character(1, Document("foobar")) and pack(x) will create an AE object reference equivalent to AppleScript's ! character 1 of document "foobar" Some of the stuff that appears to be exported from this module comes from other *************** *** 42,102 **** aekeywords = [ ! 'tran', ! 'rtid', ! 'evcl', ! 'evid', ! 'addr', ! 'optk', ! 'timo', ! 'inte', # this attribute is read only - will be set in AESend ! 'esrc', # this attribute is read only ! 'miss', # this attribute is read only ! 'from' # new in 1.0.1 ] def missed(ae): ! try: ! desc = ae.AEGetAttributeDesc('miss', 'keyw') ! except AE.Error, msg: ! return None ! return desc.data def unpackevent(ae, formodulename=""): ! parameters = {} ! try: ! dirobj = ae.AEGetParamDesc('----', '****') ! except AE.Error: ! pass ! else: ! parameters['----'] = unpack(dirobj, formodulename) ! del dirobj ! # Workaround for what I feel is a bug in OSX 10.2: 'errn' won't show up in missed... ! try: ! dirobj = ae.AEGetParamDesc('errn', '****') ! except AE.Error: ! pass ! else: ! parameters['errn'] = unpack(dirobj, formodulename) ! del dirobj ! while 1: ! key = missed(ae) ! if not key: break ! parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename) ! attributes = {} ! for key in aekeywords: ! try: ! desc = ae.AEGetAttributeDesc(key, '****') ! except (AE.Error, MacOS.Error), msg: ! if msg[0] != -1701 and msg[0] != -1704: ! raise ! continue ! attributes[key] = unpack(desc, formodulename) ! return parameters, attributes def packevent(ae, parameters = {}, attributes = {}): ! for key, value in parameters.items(): ! packkey(ae, key, value) ! for key, value in attributes.items(): ! ae.AEPutAttributeDesc(key, pack(value)) # --- 42,102 ---- aekeywords = [ ! 'tran', ! 'rtid', ! 'evcl', ! 'evid', ! 'addr', ! 'optk', ! 'timo', ! 'inte', # this attribute is read only - will be set in AESend ! 'esrc', # this attribute is read only ! 'miss', # this attribute is read only ! 'from' # new in 1.0.1 ] def missed(ae): ! try: ! desc = ae.AEGetAttributeDesc('miss', 'keyw') ! except AE.Error, msg: ! return None ! return desc.data def unpackevent(ae, formodulename=""): ! parameters = {} ! try: ! dirobj = ae.AEGetParamDesc('----', '****') ! except AE.Error: ! pass ! else: ! parameters['----'] = unpack(dirobj, formodulename) ! del dirobj ! # Workaround for what I feel is a bug in OSX 10.2: 'errn' won't show up in missed... ! try: ! dirobj = ae.AEGetParamDesc('errn', '****') ! except AE.Error: ! pass ! else: ! parameters['errn'] = unpack(dirobj, formodulename) ! del dirobj ! while 1: ! key = missed(ae) ! if not key: break ! parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename) ! attributes = {} ! for key in aekeywords: ! try: ! desc = ae.AEGetAttributeDesc(key, '****') ! except (AE.Error, MacOS.Error), msg: ! if msg[0] != -1701 and msg[0] != -1704: ! raise ! continue ! attributes[key] = unpack(desc, formodulename) ! return parameters, attributes def packevent(ae, parameters = {}, attributes = {}): ! for key, value in parameters.items(): ! packkey(ae, key, value) ! for key, value in attributes.items(): ! ae.AEPutAttributeDesc(key, pack(value)) # *************** *** 105,346 **** # def keysubst(arguments, keydict): ! """Replace long name keys by their 4-char counterparts, and check""" ! ok = keydict.values() ! for k in arguments.keys(): ! if keydict.has_key(k): ! v = arguments[k] ! del arguments[k] ! arguments[keydict[k]] = v ! elif k != '----' and k not in ok: ! raise TypeError, 'Unknown keyword argument: %s'%k ! def enumsubst(arguments, key, edict): ! """Substitute a single enum keyword argument, if it occurs""" ! if not arguments.has_key(key) or edict is None: ! return ! v = arguments[key] ! ok = edict.values() ! if edict.has_key(v): ! arguments[key] = Enum(edict[v]) ! elif not v in ok: ! raise TypeError, 'Unknown enumerator: %s'%v ! def decodeerror(arguments): ! """Create the 'best' argument for a raise MacOS.Error""" ! errn = arguments['errn'] ! err_a1 = errn ! if arguments.has_key('errs'): ! err_a2 = arguments['errs'] ! else: ! err_a2 = MacOS.GetErrorString(errn) ! if arguments.has_key('erob'): ! err_a3 = arguments['erob'] ! else: ! err_a3 = None ! ! return (err_a1, err_a2, err_a3) class TalkTo: ! """An AE connection to an application""" ! _signature = None # Can be overridden by subclasses ! _moduleName = None # Can be overridden by subclasses ! ! __eventloop_initialized = 0 ! def __ensure_WMAvailable(klass): ! if klass.__eventloop_initialized: return 1 ! if not MacOS.WMAvailable(): return 0 ! # Workaround for a but in MacOSX 10.2: we must have an event ! # loop before we can call AESend. ! Evt.WaitNextEvent(0,0) ! return 1 ! __ensure_WMAvailable = classmethod(__ensure_WMAvailable) ! def __init__(self, signature=None, start=0, timeout=0): ! """Create a communication channel with a particular application. ! ! Addressing the application is done by specifying either a ! 4-byte signature, an AEDesc or an object that will __aepack__ ! to an AEDesc. ! """ ! self.target_signature = None ! if signature is None: ! signature = self._signature ! if type(signature) == AEDescType: ! self.target = signature ! elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): ! self.target = signature.__aepack__() ! elif type(signature) == StringType and len(signature) == 4: ! self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) ! self.target_signature = signature ! else: ! raise TypeError, "signature should be 4-char string or AEDesc" ! self.send_flags = AppleEvents.kAEWaitReply ! self.send_priority = AppleEvents.kAENormalPriority ! if timeout: ! self.send_timeout = timeout ! else: ! self.send_timeout = AppleEvents.kAEDefaultTimeout ! if start: ! self._start() ! ! def _start(self): ! """Start the application, if it is not running yet""" ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! _launch(self.target_signature) ! for i in range(LAUNCH_MAX_WAIT_TIME): ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! pass ! else: ! break ! time.sleep(1) ! ! def start(self): ! """Deprecated, used _start()""" ! self._start() ! ! def newevent(self, code, subcode, parameters = {}, attributes = {}): ! """Create a complete structure for an apple event""" ! ! event = AE.AECreateAppleEvent(code, subcode, self.target, ! AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) ! packevent(event, parameters, attributes) ! return event ! ! def sendevent(self, event): ! """Send a pre-created appleevent, await the reply and unpack it""" ! if not self.__ensure_WMAvailable(): ! raise RuntimeError, "No window manager access, cannot send AppleEvent" ! reply = event.AESend(self.send_flags, self.send_priority, ! self.send_timeout) ! parameters, attributes = unpackevent(reply, self._moduleName) ! return reply, parameters, attributes ! ! def send(self, code, subcode, parameters = {}, attributes = {}): ! """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" ! return self.sendevent(self.newevent(code, subcode, parameters, attributes)) ! ! # ! # The following events are somehow "standard" and don't seem to appear in any ! # suite... ! # ! def activate(self): ! """Send 'activate' command""" ! self.send('misc', 'actv') ! def _get(self, _object, as=None, _attributes={}): ! """_get: get data from an object ! Required argument: the object ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the data ! """ ! _code = 'core' ! _subcode = 'getd' ! _arguments = {'----':_object} ! if as: ! _arguments['rtyp'] = mktype(as) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! if _arguments.has_key('----'): ! return _arguments['----'] ! if as: ! item.__class__ = as ! return item ! ! get = _get ! ! _argmap_set = { ! 'to' : 'data', ! } ! def _set(self, _object, _attributes={}, **_arguments): ! """set: Set an object's data. ! Required argument: the object for the command ! Keyword argument to: The new value. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! set = _set # Tiny Finder class, for local use only class _miniFinder(TalkTo): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] #pass ! _finder = _miniFinder('MACS') def _launch(appfile): ! """Open a file thru the finder. Specify file by name or fsspec""" ! _finder.open(_application_file(('ID ', appfile))) class _application_file(ComponentItem): ! """application file - An application's file on disk""" ! want = 'appf' ! _application_file._propdict = { } _application_file._elemdict = { } ! # Test program # XXXX Should test more, really... def test(): ! target = AE.AECreateDesc('sign', 'quil') ! ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) ! print unpackevent(ae) ! raw_input(":") ! ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) ! obj = Character(2, Word(1, Document(1))) ! print obj ! print repr(obj) ! packevent(ae, {'----': obj}) ! params, attrs = unpackevent(ae) ! print params['----'] ! raw_input(":") if __name__ == '__main__': ! test() ! sys.exit(1) --- 105,346 ---- # def keysubst(arguments, keydict): ! """Replace long name keys by their 4-char counterparts, and check""" ! ok = keydict.values() ! for k in arguments.keys(): ! if keydict.has_key(k): ! v = arguments[k] ! del arguments[k] ! arguments[keydict[k]] = v ! elif k != '----' and k not in ok: ! raise TypeError, 'Unknown keyword argument: %s'%k ! def enumsubst(arguments, key, edict): ! """Substitute a single enum keyword argument, if it occurs""" ! if not arguments.has_key(key) or edict is None: ! return ! v = arguments[key] ! ok = edict.values() ! if edict.has_key(v): ! arguments[key] = Enum(edict[v]) ! elif not v in ok: ! raise TypeError, 'Unknown enumerator: %s'%v ! def decodeerror(arguments): ! """Create the 'best' argument for a raise MacOS.Error""" ! errn = arguments['errn'] ! err_a1 = errn ! if arguments.has_key('errs'): ! err_a2 = arguments['errs'] ! else: ! err_a2 = MacOS.GetErrorString(errn) ! if arguments.has_key('erob'): ! err_a3 = arguments['erob'] ! else: ! err_a3 = None ! ! return (err_a1, err_a2, err_a3) class TalkTo: ! """An AE connection to an application""" ! _signature = None # Can be overridden by subclasses ! _moduleName = None # Can be overridden by subclasses ! ! __eventloop_initialized = 0 ! def __ensure_WMAvailable(klass): ! if klass.__eventloop_initialized: return 1 ! if not MacOS.WMAvailable(): return 0 ! # Workaround for a but in MacOSX 10.2: we must have an event ! # loop before we can call AESend. ! Evt.WaitNextEvent(0,0) ! return 1 ! __ensure_WMAvailable = classmethod(__ensure_WMAvailable) ! def __init__(self, signature=None, start=0, timeout=0): ! """Create a communication channel with a particular application. ! ! Addressing the application is done by specifying either a ! 4-byte signature, an AEDesc or an object that will __aepack__ ! to an AEDesc. ! """ ! self.target_signature = None ! if signature is None: ! signature = self._signature ! if type(signature) == AEDescType: ! self.target = signature ! elif type(signature) == InstanceType and hasattr(signature, '__aepack__'): ! self.target = signature.__aepack__() ! elif type(signature) == StringType and len(signature) == 4: ! self.target = AE.AECreateDesc(AppleEvents.typeApplSignature, signature) ! self.target_signature = signature ! else: ! raise TypeError, "signature should be 4-char string or AEDesc" ! self.send_flags = AppleEvents.kAEWaitReply ! self.send_priority = AppleEvents.kAENormalPriority ! if timeout: ! self.send_timeout = timeout ! else: ! self.send_timeout = AppleEvents.kAEDefaultTimeout ! if start: ! self._start() ! ! def _start(self): ! """Start the application, if it is not running yet""" ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! _launch(self.target_signature) ! for i in range(LAUNCH_MAX_WAIT_TIME): ! try: ! self.send('ascr', 'noop') ! except AE.Error: ! pass ! else: ! break ! time.sleep(1) ! ! def start(self): ! """Deprecated, used _start()""" ! self._start() ! ! def newevent(self, code, subcode, parameters = {}, attributes = {}): ! """Create a complete structure for an apple event""" ! ! event = AE.AECreateAppleEvent(code, subcode, self.target, ! AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID) ! packevent(event, parameters, attributes) ! return event ! ! def sendevent(self, event): ! """Send a pre-created appleevent, await the reply and unpack it""" ! if not self.__ensure_WMAvailable(): ! raise RuntimeError, "No window manager access, cannot send AppleEvent" ! reply = event.AESend(self.send_flags, self.send_priority, ! self.send_timeout) ! parameters, attributes = unpackevent(reply, self._moduleName) ! return reply, parameters, attributes ! ! def send(self, code, subcode, parameters = {}, attributes = {}): ! """Send an appleevent given code/subcode/pars/attrs and unpack the reply""" ! return self.sendevent(self.newevent(code, subcode, parameters, attributes)) ! ! # ! # The following events are somehow "standard" and don't seem to appear in any ! # suite... ! # ! def activate(self): ! """Send 'activate' command""" ! self.send('misc', 'actv') ! def _get(self, _object, as=None, _attributes={}): ! """_get: get data from an object ! Required argument: the object ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: the data ! """ ! _code = 'core' ! _subcode = 'getd' ! _arguments = {'----':_object} ! if as: ! _arguments['rtyp'] = mktype(as) ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! if _arguments.has_key('----'): ! return _arguments['----'] ! if as: ! item.__class__ = as ! return item ! ! get = _get ! ! _argmap_set = { ! 'to' : 'data', ! } ! def _set(self, _object, _attributes={}, **_arguments): ! """set: Set an object's data. ! Required argument: the object for the command ! Keyword argument to: The new value. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'core' ! _subcode = 'setd' ! keysubst(_arguments, self._argmap_set) ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! set = _set # Tiny Finder class, for local use only class _miniFinder(TalkTo): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open the specified object(s) ! Required argument: list of objects to open ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'aevt' ! _subcode = 'odoc' ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise Error, decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] #pass ! _finder = _miniFinder('MACS') def _launch(appfile): ! """Open a file thru the finder. Specify file by name or fsspec""" ! _finder.open(_application_file(('ID ', appfile))) class _application_file(ComponentItem): ! """application file - An application's file on disk""" ! want = 'appf' ! _application_file._propdict = { } _application_file._elemdict = { } ! # Test program # XXXX Should test more, really... def test(): ! target = AE.AECreateDesc('sign', 'quil') ! ae = AE.AECreateAppleEvent('aevt', 'oapp', target, -1, 0) ! print unpackevent(ae) ! raw_input(":") ! ae = AE.AECreateAppleEvent('core', 'getd', target, -1, 0) ! obj = Character(2, Word(1, Document(1))) ! print obj ! print repr(obj) ! packevent(ae, {'----': obj}) ! params, attrs = unpackevent(ae) ! print params['----'] ! raw_input(":") if __name__ == '__main__': ! test() ! sys.exit(1) Index: aetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetypes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** aetypes.py 21 Mar 2003 12:04:18 -0000 1.4 --- aetypes.py 9 Apr 2003 13:25:42 -0000 1.5 *************** *** 11,433 **** # def pack(*args, **kwargs): ! from aepack import pack ! return pack( *args, **kwargs) ! def nice(s): ! """'nice' representation of an object""" ! if type(s) is StringType: return repr(s) ! else: return str(s) [...1066 lines suppressed...] ! cls = self._propdict[name] ! return cls(self) ! raise AttributeError, name ! ! class DelayedComponentItem: ! def __init__(self, compclass, fr): ! self.compclass = compclass ! self.fr = fr ! ! def __call__(self, which): ! return self.compclass(which, self.fr) ! ! def __repr__(self): ! return "%s(???, %s)" % (self.__class__.__name__, `self.fr`) ! ! def __str__(self): ! return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) template = """ Index: applesingle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/applesingle.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** applesingle.py 30 Dec 2002 22:04:20 -0000 1.1 --- applesingle.py 9 Apr 2003 13:25:42 -0000 1.2 *************** *** 25,100 **** def decode(input, output, resonly=0): ! if type(input) == type(''): ! input = open(input, 'rb') ! # Should we also test for FSSpecs or FSRefs? ! header = input.read(AS_HEADER_LENGTH) ! try: ! magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) ! except ValueError, arg: ! raise Error, "Unpack header error: %s"%arg ! if verbose: ! print 'Magic: 0x%8.8x'%magic ! print 'Version: 0x%8.8x'%version ! print 'Entries: %d'%nentry ! if magic != AS_MAGIC: ! raise Error, 'Unknown AppleSingle magic number 0x%8.8x'%magic ! if version != AS_VERSION: ! raise Error, 'Unknown AppleSingle version number 0x%8.8x'%version ! if nentry <= 0: ! raise Error, "AppleSingle file contains no forks" ! headers = [input.read(AS_ENTRY_LENGTH) for i in range(nentry)] ! didwork = 0 ! for hdr in headers: ! try: ! id, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr) ! except ValueError, arg: ! raise Error, "Unpack entry error: %s"%arg ! if verbose: ! print 'Fork %d, offset %d, length %d'%(id, offset, length) ! input.seek(offset) ! if length == 0: ! data = '' ! else: ! data = input.read(length) ! if len(data) != length: ! raise Error, 'Short read: expected %d bytes got %d'%(length, len(data)) ! if id == AS_DATAFORK: ! if verbose: ! print ' (data fork)' ! if not resonly: ! didwork = 1 ! fp = open(output, 'wb') ! fp.write(data) ! fp.close() ! elif id == AS_RESOURCEFORK: ! didwork = 1 ! if verbose: ! print ' (resource fork)' ! if resonly: ! fp = open(output, 'wb') ! else: ! fp = MacOS.openrf(output, 'wb') ! fp.write(data) ! fp.close() ! elif id in AS_IGNORE: ! if verbose: ! print ' (ignored)' ! else: ! raise Error, 'Unknown fork type %d'%id ! if not didwork: ! raise Error, 'No useful forks found' def _test(): ! if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: ! print 'Usage: applesingle.py [-r] applesinglefile decodedfile' ! sys.exit(1) ! if sys.argv[1] == '-r': ! resonly = 1 ! del sys.argv[1] ! else: ! resonly = 0 ! decode(sys.argv[1], sys.argv[2], resonly=resonly) ! if __name__ == '__main__': ! _test() ! \ No newline at end of file --- 25,100 ---- def decode(input, output, resonly=0): ! if type(input) == type(''): ! input = open(input, 'rb') ! # Should we also test for FSSpecs or FSRefs? ! header = input.read(AS_HEADER_LENGTH) ! try: ! magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) ! except ValueError, arg: ! raise Error, "Unpack header error: %s"%arg ! if verbose: ! print 'Magic: 0x%8.8x'%magic ! print 'Version: 0x%8.8x'%version ! print 'Entries: %d'%nentry ! if magic != AS_MAGIC: ! raise Error, 'Unknown AppleSingle magic number 0x%8.8x'%magic ! if version != AS_VERSION: ! raise Error, 'Unknown AppleSingle version number 0x%8.8x'%version ! if nentry <= 0: ! raise Error, "AppleSingle file contains no forks" ! headers = [input.read(AS_ENTRY_LENGTH) for i in range(nentry)] ! didwork = 0 ! for hdr in headers: ! try: ! id, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr) ! except ValueError, arg: ! raise Error, "Unpack entry error: %s"%arg ! if verbose: ! print 'Fork %d, offset %d, length %d'%(id, offset, length) ! input.seek(offset) ! if length == 0: ! data = '' ! else: ! data = input.read(length) ! if len(data) != length: ! raise Error, 'Short read: expected %d bytes got %d'%(length, len(data)) ! if id == AS_DATAFORK: ! if verbose: ! print ' (data fork)' ! if not resonly: ! didwork = 1 ! fp = open(output, 'wb') ! fp.write(data) ! fp.close() ! elif id == AS_RESOURCEFORK: ! didwork = 1 ! if verbose: ! print ' (resource fork)' ! if resonly: ! fp = open(output, 'wb') ! else: ! fp = MacOS.openrf(output, 'wb') ! fp.write(data) ! fp.close() ! elif id in AS_IGNORE: ! if verbose: ! print ' (ignored)' ! else: ! raise Error, 'Unknown fork type %d'%id ! if not didwork: ! raise Error, 'No useful forks found' def _test(): ! if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: ! print 'Usage: applesingle.py [-r] applesinglefile decodedfile' ! sys.exit(1) ! if sys.argv[1] == '-r': ! resonly = 1 ! del sys.argv[1] ! else: ! resonly = 0 ! decode(sys.argv[1], sys.argv[2], resonly=resonly) ! if __name__ == '__main__': ! _test() ! \ No newline at end of file Index: appletrawmain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/appletrawmain.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** appletrawmain.py 30 Dec 2002 22:04:20 -0000 1.1 --- appletrawmain.py 9 Apr 2003 13:25:42 -0000 1.2 *************** *** 15,25 **** # if not sys.argv or sys.argv[0][:1] == '-': ! # Insert our (guessed) name. ! _dir = os.path.split(sys.executable)[0] # removes "python" ! _dir = os.path.split(_dir)[0] # Removes "MacOS" ! _dir = os.path.join(_dir, 'Resources') ! sys.argv.insert(0, '__rawmain__') else: ! _dir = os.path.split(sys.argv[0])[0] # # Add the Resources directory to the path. This is where files installed --- 15,25 ---- # if not sys.argv or sys.argv[0][:1] == '-': ! # Insert our (guessed) name. ! _dir = os.path.split(sys.executable)[0] # removes "python" ! _dir = os.path.split(_dir)[0] # Removes "MacOS" ! _dir = os.path.join(_dir, 'Resources') ! sys.argv.insert(0, '__rawmain__') else: ! _dir = os.path.split(sys.argv[0])[0] # # Add the Resources directory to the path. This is where files installed *************** *** 37,63 **** __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): ! # ! # Setup something resembling a normal environment and go. ! # ! sys.argv[0] = __file__ ! del argvemulator, os, sys, _dir ! execfile(__file__) else: ! __file__ = os.path.join(_dir, '__main__.pyc') ! if os.path.exists(__file__): ! # ! # If we have only a .pyc file we read the code object from that ! # ! sys.argv[0] = __file__ ! _fp = open(__file__, 'rb') ! _fp.read(8) ! __code__ = marshal.load(_fp) ! # ! # Again, we create an almost-normal environment (only __code__ is ! # funny) and go. ! # ! del argvemulator, os, sys, marshal, _dir, _fp ! exec __code__ ! else: ! sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0]) ! sys.exit(1) --- 37,63 ---- __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): ! # ! # Setup something resembling a normal environment and go. ! # ! sys.argv[0] = __file__ ! del argvemulator, os, sys, _dir ! execfile(__file__) else: ! __file__ = os.path.join(_dir, '__main__.pyc') ! if os.path.exists(__file__): ! # ! # If we have only a .pyc file we read the code object from that ! # ! sys.argv[0] = __file__ ! _fp = open(__file__, 'rb') ! _fp.read(8) ! __code__ = marshal.load(_fp) ! # ! # Again, we create an almost-normal environment (only __code__ is ! # funny) and go. ! # ! del argvemulator, os, sys, marshal, _dir, _fp ! exec __code__ ! else: ! sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0]) ! sys.exit(1) Index: appletrunner.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/appletrunner.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** appletrunner.py 30 Dec 2002 22:04:20 -0000 1.1 --- appletrunner.py 9 Apr 2003 13:25:42 -0000 1.2 *************** *** 7,17 **** import sys for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]: ! realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), ! "Resources", name) ! if os.path.exists(realmain): ! break else: ! sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0]) ! sys.exit(1) sys.argv.insert(1, realmain) os.execve(sys.executable, sys.argv, os.environ) --- 7,17 ---- import sys for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]: ! realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), ! "Resources", name) ! if os.path.exists(realmain): ! break else: ! sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0]) ! sys.exit(1) sys.argv.insert(1, realmain) os.execve(sys.executable, sys.argv, os.environ) Index: bgenlocations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bgenlocations.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bgenlocations.py 12 Feb 2003 15:37:26 -0000 1.3 --- bgenlocations.py 9 Apr 2003 13:25:42 -0000 1.4 *************** *** 13,22 **** # the source tree here. if sys.platform == 'mac': ! # For MacPython we know where it is ! def _pardir(p): return os.path.split(p)[0] ! BGENDIR=os.path.join(sys.prefix, "Tools", "bgen", "bgen") else: ! # for unix-Python we don't know, please set it yourself. ! BGENDIR="/Users/jack/src/python/Tools/bgen/bgen" # --- 13,22 ---- # the source tree here. if sys.platform == 'mac': ! # For MacPython we know where it is ! def _pardir(p): return os.path.split(p)[0] ! BGENDIR=os.path.join(sys.prefix, "Tools", "bgen", "bgen") else: ! # for unix-Python we don't know, please set it yourself. ! BGENDIR="/Users/jack/src/python/Tools/bgen/bgen" # *************** *** 27,33 **** # if sys.platform == 'mac': ! _MWERKSDIR="Sap:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") --- 27,33 ---- # if sys.platform == 'mac': ! _MWERKSDIR="Sap:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") *************** *** 38,44 **** # if sys.platform == 'mac': ! TOOLBOXDIR=os.path.join(sys.prefix, "Lib", "plat-mac", "Carbon") else: ! TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" # Creator for C files: --- 38,44 ---- # if sys.platform == 'mac': ! TOOLBOXDIR=os.path.join(sys.prefix, "Lib", "plat-mac", "Carbon") else: ! TOOLBOXDIR="/Users/jack/src/python/Lib/plat-mac/Carbon" # Creator for C files: *************** *** 46,61 **** if not os.path.exists(BGENDIR): ! raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR if not os.path.exists(INCLUDEDIR): ! raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR if not os.path.exists(TOOLBOXDIR): ! raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR ! # Sigh, due to the way these are used make sure they end with : or /. if BGENDIR[-1] != os.sep: ! BGENDIR = BGENDIR + os.sep if INCLUDEDIR[-1] != os.sep: ! INCLUDEDIR = INCLUDEDIR + os.sep if TOOLBOXDIR[-1] != os.sep: ! TOOLBOXDIR = TOOLBOXDIR + os.sep ! --- 46,61 ---- if not os.path.exists(BGENDIR): ! raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR if not os.path.exists(INCLUDEDIR): ! raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR if not os.path.exists(TOOLBOXDIR): ! raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR ! # Sigh, due to the way these are used make sure they end with : or /. if BGENDIR[-1] != os.sep: ! BGENDIR = BGENDIR + os.sep if INCLUDEDIR[-1] != os.sep: ! INCLUDEDIR = INCLUDEDIR + os.sep if TOOLBOXDIR[-1] != os.sep: ! TOOLBOXDIR = TOOLBOXDIR + os.sep ! Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/buildtools.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** buildtools.py 25 Feb 2003 23:02:03 -0000 1.8 --- buildtools.py 9 Apr 2003 13:25:42 -0000 1.9 *************** *** 43,325 **** def findtemplate(template=None): ! """Locate the applet template along sys.path""" ! if MacOS.runtimemodel == 'macho': ! return None ! if not template: ! template=TEMPLATE ! for p in sys.path: ! file = os.path.join(p, template) ! try: ! file, d1, d2 = Carbon.File.FSResolveAliasFile(file, 1) ! break ! except (Carbon.File.Error, ValueError): ! continue ! else: ! raise BuildError, "Template %s not found on sys.path" % `template` ! file = file.as_pathname() ! return file ! def process(template, filename, destname, copy_codefragment=0, ! rsrcname=None, others=[], raw=0, progress="default"): ! ! if progress == "default": ! progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) ! progress.label("Compiling...") ! progress.inc(0) ! # check for the script name being longer than 32 chars. This may trigger a bug ! # on OSX that can destroy your sourcefile. ! if '#' in os.path.split(filename)[1]: ! raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename ! # Read the source and compile it ! # (there's no point overwriting the destination if it has a syntax error) ! ! fp = open(filename, 'rU') ! text = fp.read() ! fp.close() ! try: ! code = compile(text + '\n', filename, "exec") ! except SyntaxError, arg: ! raise BuildError, "Syntax error in script %s: %s" % (filename, arg) ! except EOFError: ! raise BuildError, "End-of-file in script %s" % (filename,) ! ! # Set the destination file name. Note that basename ! # does contain the whole filepath, only a .py is stripped. ! ! if string.lower(filename[-3:]) == ".py": ! basename = filename[:-3] ! if MacOS.runtimemodel != 'macho' and not destname: ! destname = basename ! else: ! basename = filename ! ! if not destname: ! if MacOS.runtimemodel == 'macho': ! destname = basename + '.app' ! else: ! destname = basename + '.applet' ! if not rsrcname: ! rsrcname = basename + '.rsrc' ! ! # Try removing the output file. This fails in MachO, but it should ! # do any harm. ! try: ! os.remove(destname) ! except os.error: ! pass ! process_common(template, progress, code, rsrcname, destname, 0, ! copy_codefragment, raw, others, filename) ! def update(template, filename, output): ! if MacOS.runtimemodel == 'macho': ! raise BuildError, "No updating yet for MachO applets" ! if progress: ! progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120) ! else: ! progress = None ! if not output: ! output = filename + ' (updated)' ! ! # Try removing the output file ! try: ! os.remove(output) ! except os.error: ! pass ! process_common(template, progress, None, filename, output, 1, 1) def process_common(template, progress, code, rsrcname, destname, is_update, ! copy_codefragment, raw=0, others=[], filename=None): ! if MacOS.runtimemodel == 'macho': ! return process_common_macho(template, progress, code, rsrcname, destname, ! is_update, raw, others, filename) ! if others: ! raise BuildError, "Extra files only allowed for MachoPython applets" ! # Create FSSpecs for the various files ! template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) ! template = template_fsr.as_pathname() ! ! # Copy data (not resources, yet) from the template ! if progress: ! progress.label("Copy data fork...") ! progress.set(10) ! ! if copy_codefragment: ! tmpl = open(template, "rb") ! dest = open(destname, "wb") ! data = tmpl.read() ! if data: ! dest.write(data) ! dest.close() ! tmpl.close() ! del dest ! del tmpl ! ! # Open the output resource fork ! ! if progress: ! progress.label("Copy resources...") ! progress.set(20) ! try: ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! except MacOS.Error: ! destdir, destfile = os.path.split(destname) ! Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! ! # Copy the resources from the target specific resource template, if any ! typesfound, ownertype = [], None ! try: ! input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) ! except (MacOS.Error, ValueError): ! pass ! if progress: ! progress.inc(50) ! else: ! if is_update: ! skip_oldfile = ['cfrg'] ! else: ! skip_oldfile = [] ! typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) ! Res.CloseResFile(input) ! ! # Check which resource-types we should not copy from the template ! skiptypes = [] ! if 'vers' in typesfound: skiptypes.append('vers') ! if 'SIZE' in typesfound: skiptypes.append('SIZE') ! if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', ! 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] ! if not copy_codefragment: ! skiptypes.append('cfrg') ! ## skipowner = (ownertype <> None) ! ! # Copy the resources from the template ! ! input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) ! dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) ! ! Res.CloseResFile(input) ! ## if ownertype == None: ! ## raise BuildError, "No owner resource found in either resource file or template" ! # Make sure we're manipulating the output resource file now ! ! Res.UseResFile(output) ! if ownertype == None: ! # No owner resource in the template. We have skipped the ! # Python owner resource, so we have to add our own. The relevant ! # bundle stuff is already included in the interpret/applet template. ! newres = Res.Resource('\0') ! newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") ! ownertype = DEFAULT_APPLET_CREATOR ! ! if code: ! # Delete any existing 'PYC ' resource named __main__ ! ! try: ! res = Res.Get1NamedResource(RESTYPE, RESNAME) ! res.RemoveResource() ! except Res.Error: ! pass ! ! # Create the raw data for the resource from the code object ! if progress: ! progress.label("Write PYC resource...") ! progress.set(120) ! ! data = marshal.dumps(code) ! del code ! data = (MAGIC + '\0\0\0\0') + data ! ! # Create the resource and write it ! ! id = 0 ! while id < 128: ! id = Res.Unique1ID(RESTYPE) ! res = Res.Resource(data) ! res.AddResource(RESTYPE, id, RESNAME) ! attrs = res.GetResAttrs() ! attrs = attrs | 0x04 # set preload ! res.SetResAttrs(attrs) ! res.WriteResource() ! res.ReleaseResource() ! ! # Close the output file ! ! Res.CloseResFile(output) ! ! # Now set the creator, type and bundle bit of the destination. ! # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) ! dest_fss = Carbon.File.FSSpec(destname) ! dest_finfo = dest_fss.FSpGetFInfo() ! dest_finfo.Creator = ownertype ! dest_finfo.Type = 'APPL' ! dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared ! dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited ! dest_fss.FSpSetFInfo(dest_finfo) ! ! macostools.touched(destname) ! if progress: ! progress.label("Done.") ! progress.inc(0) def process_common_macho(template, progress, code, rsrcname, destname, is_update, ! raw=0, others=[], filename=None): ! # Check that we have a filename ! if filename is None: ! raise BuildError, "Need source filename on MacOSX" ! # First make sure the name ends in ".app" ! if destname[-4:] != '.app': ! destname = destname + '.app' ! # Now deduce the short name ! destdir, shortname = os.path.split(destname) ! if shortname[-4:] == '.app': ! # Strip the .app suffix ! shortname = shortname[:-4] ! # And deduce the .plist and .icns names ! plistname = None ! icnsname = None ! if rsrcname and rsrcname[-5:] == '.rsrc': ! tmp = rsrcname[:-5] ! plistname = tmp + '.plist' ! if os.path.exists(plistname): ! icnsname = tmp + '.icns' ! if not os.path.exists(icnsname): ! icnsname = None ! else: ! plistname = None ! if not os.path.exists(rsrcname): ! rsrcname = None ! if progress: ! progress.label('Creating bundle...') ! import bundlebuilder ! builder = bundlebuilder.AppBuilder(verbosity=0) ! builder.mainprogram = filename ! builder.builddir = destdir ! builder.name = shortname ! if rsrcname: ! realrsrcname = macresource.resource_pathname(rsrcname) ! builder.files.append((realrsrcname, ! os.path.join('Contents/Resources', os.path.basename(rsrcname)))) ! for o in others: ! if type(o) == str: ! builder.resources.append(o) ! else: ! builder.files.append(o) ! if plistname: ! import plistlib ! builder.plist = plistlib.Plist.fromFile(plistname) ! if icnsname: ! builder.iconfile = icnsname ! if not raw: ! builder.argv_emulation = 1 ! builder.setup() ! builder.build() ! if progress: ! progress.label('Done.') ! progress.inc(0) ! ! ## macostools.touched(dest_fss) # Copy resources between two resource file descriptors. --- 43,325 ---- def findtemplate(template=None): ! """Locate the applet template along sys.path""" ! if MacOS.runtimemodel == 'macho': ! return None ! if not template: ! template=TEMPLATE ! for p in sys.path: ! file = os.path.join(p, template) ! try: ! file, d1, d2 = Carbon.File.FSResolveAliasFile(file, 1) ! break ! except (Carbon.File.Error, ValueError): ! continue ! else: ! raise BuildError, "Template %s not found on sys.path" % `template` ! file = file.as_pathname() ! return file ! def process(template, filename, destname, copy_codefragment=0, ! rsrcname=None, others=[], raw=0, progress="default"): ! ! if progress == "default": ! progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120) ! progress.label("Compiling...") ! progress.inc(0) ! # check for the script name being longer than 32 chars. This may trigger a bug ! # on OSX that can destroy your sourcefile. ! if '#' in os.path.split(filename)[1]: ! raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename ! # Read the source and compile it ! # (there's no point overwriting the destination if it has a syntax error) ! ! fp = open(filename, 'rU') ! text = fp.read() ! fp.close() ! try: ! code = compile(text + '\n', filename, "exec") ! except SyntaxError, arg: ! raise BuildError, "Syntax error in script %s: %s" % (filename, arg) ! except EOFError: ! raise BuildError, "End-of-file in script %s" % (filename,) ! ! # Set the destination file name. Note that basename ! # does contain the whole filepath, only a .py is stripped. ! ! if string.lower(filename[-3:]) == ".py": ! basename = filename[:-3] ! if MacOS.runtimemodel != 'macho' and not destname: ! destname = basename ! else: ! basename = filename ! ! if not destname: ! if MacOS.runtimemodel == 'macho': ! destname = basename + '.app' ! else: ! destname = basename + '.applet' ! if not rsrcname: ! rsrcname = basename + '.rsrc' ! ! # Try removing the output file. This fails in MachO, but it should ! # do any harm. ! try: ! os.remove(destname) ! except os.error: ! pass ! process_common(template, progress, code, rsrcname, destname, 0, ! copy_codefragment, raw, others, filename) ! def update(template, filename, output): ! if MacOS.runtimemodel == 'macho': ! raise BuildError, "No updating yet for MachO applets" ! if progress: ! progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120) ! else: ! progress = None ! if not output: ! output = filename + ' (updated)' ! ! # Try removing the output file ! try: ! os.remove(output) ! except os.error: ! pass ! process_common(template, progress, None, filename, output, 1, 1) def process_common(template, progress, code, rsrcname, destname, is_update, ! copy_codefragment, raw=0, others=[], filename=None): ! if MacOS.runtimemodel == 'macho': ! return process_common_macho(template, progress, code, rsrcname, destname, ! is_update, raw, others, filename) ! if others: ! raise BuildError, "Extra files only allowed for MachoPython applets" ! # Create FSSpecs for the various files ! template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) ! template = template_fsr.as_pathname() ! ! # Copy data (not resources, yet) from the template ! if progress: ! progress.label("Copy data fork...") ! progress.set(10) ! ! if copy_codefragment: ! tmpl = open(template, "rb") ! dest = open(destname, "wb") ! data = tmpl.read() ! if data: ! dest.write(data) ! dest.close() ! tmpl.close() ! del dest ! del tmpl ! ! # Open the output resource fork ! ! if progress: ! progress.label("Copy resources...") ! progress.set(20) ! try: ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! except MacOS.Error: ! destdir, destfile = os.path.split(destname) ! Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) ! output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) ! ! # Copy the resources from the target specific resource template, if any ! typesfound, ownertype = [], None ! try: ! input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) ! except (MacOS.Error, ValueError): ! pass ! if progress: ! progress.inc(50) ! else: ! if is_update: ! skip_oldfile = ['cfrg'] ! else: ! skip_oldfile = [] ! typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) ! Res.CloseResFile(input) ! ! # Check which resource-types we should not copy from the template ! skiptypes = [] ! if 'vers' in typesfound: skiptypes.append('vers') ! if 'SIZE' in typesfound: skiptypes.append('SIZE') ! if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', ! 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] ! if not copy_codefragment: ! skiptypes.append('cfrg') ! ## skipowner = (ownertype <> None) ! ! # Copy the resources from the template ! ! input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) ! dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) ! ! Res.CloseResFile(input) ! ## if ownertype == None: ! ## raise BuildError, "No owner resource found in either resource file or template" ! # Make sure we're manipulating the output resource file now ! ! Res.UseResFile(output) ! if ownertype == None: ! # No owner resource in the template. We have skipped the ! # Python owner resource, so we have to add our own. The relevant ! # bundle stuff is already included in the interpret/applet template. ! newres = Res.Resource('\0') ! newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") ! ownertype = DEFAULT_APPLET_CREATOR ! ! if code: ! # Delete any existing 'PYC ' resource named __main__ ! ! try: ! res = Res.Get1NamedResource(RESTYPE, RESNAME) ! res.RemoveResource() ! except Res.Error: ! pass ! ! # Create the raw data for the resource from the code object ! if progress: ! progress.label("Write PYC resource...") ! progress.set(120) ! ! data = marshal.dumps(code) ! del code ! data = (MAGIC + '\0\0\0\0') + data ! ! # Create the resource and write it ! ! id = 0 ! while id < 128: ! id = Res.Unique1ID(RESTYPE) ! res = Res.Resource(data) ! res.AddResource(RESTYPE, id, RESNAME) ! attrs = res.GetResAttrs() ! attrs = attrs | 0x04 # set preload ! res.SetResAttrs(attrs) ! res.WriteResource() ! res.ReleaseResource() ! ! # Close the output file ! ! Res.CloseResFile(output) ! ! # Now set the creator, type and bundle bit of the destination. ! # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) ! dest_fss = Carbon.File.FSSpec(destname) ! dest_finfo = dest_fss.FSpGetFInfo() ! dest_finfo.Creator = ownertype ! dest_finfo.Type = 'APPL' ! dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared ! dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited ! dest_fss.FSpSetFInfo(dest_finfo) ! ! macostools.touched(destname) ! if progress: ! progress.label("Done.") ! progress.inc(0) def process_common_macho(template, progress, code, rsrcname, destname, is_update, ! raw=0, others=[], filename=None): ! # Check that we have a filename ! if filename is None: ! raise BuildError, "Need source filename on MacOSX" ! # First make sure the name ends in ".app" ! if destname[-4:] != '.app': ! destname = destname + '.app' ! # Now deduce the short name ! destdir, shortname = os.path.split(destname) ! if shortname[-4:] == '.app': ! # Strip the .app suffix ! shortname = shortname[:-4] ! # And deduce the .plist and .icns names ! plistname = None ! icnsname = None ! if rsrcname and rsrcname[-5:] == '.rsrc': ! tmp = rsrcname[:-5] ! plistname = tmp + '.plist' ! if os.path.exists(plistname): ! icnsname = tmp + '.icns' ! if not os.path.exists(icnsname): ! icnsname = None ! else: ! plistname = None ! if not os.path.exists(rsrcname): ! rsrcname = None ! if progress: ! progress.label('Creating bundle...') ! import bundlebuilder ! builder = bundlebuilder.AppBuilder(verbosity=0) ! builder.mainprogram = filename ! builder.builddir = destdir ! builder.name = shortname ! if rsrcname: ! realrsrcname = macresource.resource_pathname(rsrcname) ! builder.files.append((realrsrcname, ! os.path.join('Contents/Resources', os.path.basename(rsrcname)))) ! for o in others: ! if type(o) == str: ! builder.resources.append(o) ! else: ! builder.files.append(o) ! if plistname: ! import plistlib ! builder.plist = plistlib.Plist.fromFile(plistname) ! if icnsname: ! builder.iconfile = icnsname ! if not raw: ! builder.argv_emulation = 1 ! builder.setup() ! builder.build() ! if progress: ! progress.label('Done.') ! progress.inc(0) ! ! ## macostools.touched(dest_fss) # Copy resources between two resource file descriptors. *************** *** 328,416 **** # def copyres(input, output, skiptypes, skipowner, progress=None): ! ctor = None ! alltypes = [] ! Res.UseResFile(input) ! ntypes = Res.Count1Types() ! progress_type_inc = 50/ntypes ! for itype in range(1, 1+ntypes): ! type = Res.Get1IndType(itype) ! if type in skiptypes: ! continue ! alltypes.append(type) ! nresources = Res.Count1Resources(type) ! progress_cur_inc = progress_type_inc/nresources ! for ires in range(1, 1+nresources): ! res = Res.Get1IndResource(type, ires) ! id, type, name = res.GetResInfo() ! lcname = string.lower(name) ! if lcname == OWNERNAME and id == 0: ! if skipowner: ! continue # Skip this one ! else: ! ctor = type ! size = res.size ! attrs = res.GetResAttrs() ! if progress: ! progress.label("Copy %s %d %s"%(type, id, name)) ! progress.inc(progress_cur_inc) ! res.LoadResource() ! res.DetachResource() ! Res.UseResFile(output) ! try: ! res2 = Res.Get1Resource(type, id) ! except MacOS.Error: ! res2 = None ! if res2: ! if progress: ! progress.label("Overwrite %s %d %s"%(type, id, name)) ! progress.inc(0) ! res2.RemoveResource() ! res.AddResource(type, id, name) ! res.WriteResource() ! attrs = attrs | res.GetResAttrs() ! res.SetResAttrs(attrs) ! Res.UseResFile(input) ! return alltypes, ctor def copyapptree(srctree, dsttree, exceptlist=[], progress=None): ! names = [] ! if os.path.exists(dsttree): ! shutil.rmtree(dsttree) ! os.mkdir(dsttree) ! todo = os.listdir(srctree) ! while todo: ! this, todo = todo[0], todo[1:] ! if this in exceptlist: ! continue ! thispath = os.path.join(srctree, this) ! if os.path.isdir(thispath): ! thiscontent = os.listdir(thispath) ! for t in thiscontent: ! todo.append(os.path.join(this, t)) ! names.append(this) ! for this in names: ! srcpath = os.path.join(srctree, this) ! dstpath = os.path.join(dsttree, this) ! if os.path.isdir(srcpath): ! os.mkdir(dstpath) ! elif os.path.islink(srcpath): ! endpoint = os.readlink(srcpath) ! os.symlink(endpoint, dstpath) ! else: ! if progress: ! progress.label('Copy '+this) ! progress.inc(0) ! shutil.copy2(srcpath, dstpath) ! def writepycfile(codeobject, cfile): ! import marshal ! fc = open(cfile, 'wb') ! fc.write('\0\0\0\0') # MAGIC placeholder, written later ! fc.write('\0\0\0\0') # Timestap placeholder, not needed ! marshal.dump(codeobject, fc) ! fc.flush() ! fc.seek(0, 0) ! fc.write(MAGIC) ! fc.close() --- 328,416 ---- # def copyres(input, output, skiptypes, skipowner, progress=None): ! ctor = None ! alltypes = [] ! Res.UseResFile(input) ! ntypes = Res.Count1Types() ! progress_type_inc = 50/ntypes ! for itype in range(1, 1+ntypes): ! type = Res.Get1IndType(itype) ! if type in skiptypes: ! continue ! alltypes.append(type) ! nresources = Res.Count1Resources(type) ! progress_cur_inc = progress_type_inc/nresources ! for ires in range(1, 1+nresources): ! res = Res.Get1IndResource(type, ires) ! id, type, name = res.GetResInfo() ! lcname = string.lower(name) ! if lcname == OWNERNAME and id == 0: ! if skipowner: ! continue # Skip this one ! else: ! ctor = type ! size = res.size ! attrs = res.GetResAttrs() ! if progress: ! progress.label("Copy %s %d %s"%(type, id, name)) ! progress.inc(progress_cur_inc) ! res.LoadResource() ! res.DetachResource() ! Res.UseResFile(output) ! try: ! res2 = Res.Get1Resource(type, id) ! except MacOS.Error: ! res2 = None ! if res2: ! if progress: ! progress.label("Overwrite %s %d %s"%(type, id, name)) ! progress.inc(0) ! res2.RemoveResource() ! res.AddResource(type, id, name) ! res.WriteResource() ! attrs = attrs | res.GetResAttrs() ! res.SetResAttrs(attrs) ! Res.UseResFile(input) ! return alltypes, ctor def copyapptree(srctree, dsttree, exceptlist=[], progress=None): ! names = [] ! if os.path.exists(dsttree): ! shutil.rmtree(dsttree) ! os.mkdir(dsttree) ! todo = os.listdir(srctree) ! while todo: ! this, todo = todo[0], todo[1:] ! if this in exceptlist: ! continue ! thispath = os.path.join(srctree, this) ! if os.path.isdir(thispath): ! thiscontent = os.listdir(thispath) ! for t in thiscontent: ! todo.append(os.path.join(this, t)) ! names.append(this) ! for this in names: ! srcpath = os.path.join(srctree, this) ! dstpath = os.path.join(dsttree, this) ! if os.path.isdir(srcpath): ! os.mkdir(dstpath) ! elif os.path.islink(srcpath): ! endpoint = os.readlink(srcpath) ! os.symlink(endpoint, dstpath) ! else: ! if progress: ! progress.label('Copy '+this) ! progress.inc(0) ! shutil.copy2(srcpath, dstpath) ! def writepycfile(codeobject, cfile): ! import marshal ! fc = open(cfile, 'wb') ! fc.write('\0\0\0\0') # MAGIC placeholder, written later ! fc.write('\0\0\0\0') # Timestap placeholder, not needed ! marshal.dump(codeobject, fc) ! fc.flush() ! fc.seek(0, 0) ! fc.write(MAGIC) ! fc.close() Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** bundlebuilder.py 21 Mar 2003 22:22:19 -0000 1.24 --- bundlebuilder.py 9 Apr 2003 13:25:42 -0000 1.25 *************** *** 43,213 **** class Defaults: ! """Class attributes that don't start with an underscore and are ! not functions or classmethods are (deep)copied to self.__dict__. ! This allows for mutable default values. ! """ ! def __init__(self, **kwargs): ! defaults = self._getDefaults() ! defaults.update(kwargs) [...1344 lines suppressed...] ! if command == "build": ! builder.setup() ! builder.build() ! elif command == "report": ! builder.setup() ! builder.report() ! elif command == "help": ! usage() ! else: ! usage("Unknown command '%s'" % command) def buildapp(**kwargs): ! builder = AppBuilder(**kwargs) ! main(builder) if __name__ == "__main__": ! main() Index: cfmfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/cfmfile.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cfmfile.py 5 Feb 2003 15:44:03 -0000 1.2 --- cfmfile.py 9 Apr 2003 13:25:42 -0000 1.3 *************** *** 19,184 **** def mergecfmfiles(srclist, dst, architecture = 'fat'): ! """Merge all files in srclist into a new file dst. ! ! If architecture is given, only code fragments of that type will be used: ! "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" ! 68k code, since it does not use code fragments to begin with. ! If architecture is None, all fragments will be used, enabling FAT binaries. ! """ ! ! srclist = list(srclist) ! for i in range(len(srclist)): ! srclist[i] = Carbon.File.pathname(srclist[i]) ! dst = Carbon.File.pathname(dst) ! ! dstfile = open(dst, "wb") ! rf = Res.FSpOpenResFile(dst, 3) ! try: ! dstcfrg = CfrgResource() ! for src in srclist: ! srccfrg = CfrgResource(src) ! for frag in srccfrg.fragments: ! if frag.architecture == 'pwpc' and architecture == 'm68k': ! continue ! if frag.architecture == 'm68k' and architecture == 'pwpc': ! continue ! dstcfrg.append(frag) ! ! frag.copydata(dstfile) ! ! cfrgres = Res.Resource(dstcfrg.build()) ! Res.UseResFile(rf) ! cfrgres.AddResource('cfrg', 0, "") ! finally: ! dstfile.close() ! rf = Res.CloseResFile(rf) class CfrgResource: ! ! def __init__(self, path = None): ! self.version = 1 ! self.fragments = [] ! self.path = path ! if path is not None and os.path.exists(path): ! currentresref = Res.CurResFile() ! resref = Res.FSpOpenResFile(path, 1) ! Res.UseResFile(resref) ! try: ! try: ! data = Res.Get1Resource('cfrg', 0).data ! except Res.Error: ! raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback ! finally: ! Res.CloseResFile(resref) ! Res.UseResFile(currentresref) ! self.parse(data) ! if self.version <> 1: ! raise error, "unknown 'cfrg' resource format" ! ! def parse(self, data): ! (res1, res2, self.version, ! res3, res4, res5, res6, ! self.memberCount) = struct.unpack("8l", data[:32]) ! data = data[32:] ! while data: ! frag = FragmentDescriptor(self.path, data) ! data = data[frag.memberSize:] ! self.fragments.append(frag) ! ! def build(self): ! self.memberCount = len(self.fragments) ! data = struct.pack("8l", 0, 0, self.version, 0, 0, 0, 0, self.memberCount) ! for frag in self.fragments: ! data = data + frag.build() ! return data ! ! def append(self, frag): ! self.fragments.append(frag) class FragmentDescriptor: ! ! def __init__(self, path, data = None): ! self.path = path ! if data is not None: ! self.parse(data) ! ! def parse(self, data): ! self.architecture = data[:4] ! ( self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2, ! self.memberSize,) = struct.unpack("4lhBB4lh", data[4:42]) ! pname = data[42:self.memberSize] ! self.name = pname[1:1+ord(pname[0])] ! ! def build(self): ! data = self.architecture ! data = data + struct.pack("4lhBB4l", ! self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2) ! self.memberSize = len(data) + 2 + 1 + len(self.name) ! # pad to 4 byte boundaries ! if self.memberSize % 4: ! self.memberSize = self.memberSize + 4 - (self.memberSize % 4) ! data = data + struct.pack("hb", self.memberSize, len(self.name)) ! data = data + self.name ! data = data + '\000' * (self.memberSize - len(data)) ! return data ! ! def getfragment(self): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! f = open(self.path, "rb") ! f.seek(self.offset) ! if self.length: ! frag = f.read(self.length) ! else: ! frag = f.read() ! f.close() ! return frag ! ! def copydata(self, outfile): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! infile = open(self.path, "rb") ! if self.length == 0: ! infile.seek(0, 2) ! self.length = infile.tell() ! ! # Position input file and record new offset from output file ! infile.seek(self.offset) ! ! # pad to 16 byte boundaries ! offset = outfile.tell() ! if offset % 16: ! offset = offset + 16 - (offset % 16) ! outfile.seek(offset) ! self.offset = offset ! ! l = self.length ! while l: ! if l > BUFSIZE: ! outfile.write(infile.read(BUFSIZE)) ! l = l - BUFSIZE ! else: ! outfile.write(infile.read(l)) ! l = 0 ! infile.close() --- 19,184 ---- def mergecfmfiles(srclist, dst, architecture = 'fat'): ! """Merge all files in srclist into a new file dst. ! ! If architecture is given, only code fragments of that type will be used: ! "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" ! 68k code, since it does not use code fragments to begin with. ! If architecture is None, all fragments will be used, enabling FAT binaries. ! """ ! ! srclist = list(srclist) ! for i in range(len(srclist)): ! srclist[i] = Carbon.File.pathname(srclist[i]) ! dst = Carbon.File.pathname(dst) ! ! dstfile = open(dst, "wb") ! rf = Res.FSpOpenResFile(dst, 3) ! try: ! dstcfrg = CfrgResource() ! for src in srclist: ! srccfrg = CfrgResource(src) ! for frag in srccfrg.fragments: ! if frag.architecture == 'pwpc' and architecture == 'm68k': ! continue ! if frag.architecture == 'm68k' and architecture == 'pwpc': ! continue ! dstcfrg.append(frag) ! ! frag.copydata(dstfile) ! ! cfrgres = Res.Resource(dstcfrg.build()) ! Res.UseResFile(rf) ! cfrgres.AddResource('cfrg', 0, "") ! finally: ! dstfile.close() ! rf = Res.CloseResFile(rf) class CfrgResource: ! ! def __init__(self, path = None): ! self.version = 1 ! self.fragments = [] ! self.path = path ! if path is not None and os.path.exists(path): ! currentresref = Res.CurResFile() ! resref = Res.FSpOpenResFile(path, 1) ! Res.UseResFile(resref) ! try: ! try: ! data = Res.Get1Resource('cfrg', 0).data ! except Res.Error: ! raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback ! finally: ! Res.CloseResFile(resref) ! Res.UseResFile(currentresref) ! self.parse(data) ! if self.version <> 1: ! raise error, "unknown 'cfrg' resource format" ! ! def parse(self, data): ! (res1, res2, self.version, ! res3, res4, res5, res6, ! self.memberCount) = struct.unpack("8l", data[:32]) ! data = data[32:] ! while data: ! frag = FragmentDescriptor(self.path, data) ! data = data[frag.memberSize:] ! self.fragments.append(frag) ! ! def build(self): ! self.memberCount = len(self.fragments) ! data = struct.pack("8l", 0, 0, self.version, 0, 0, 0, 0, self.memberCount) ! for frag in self.fragments: ! data = data + frag.build() ! return data ! ! def append(self, frag): ! self.fragments.append(frag) class FragmentDescriptor: ! ! def __init__(self, path, data = None): ! self.path = path ! if data is not None: ! self.parse(data) ! ! def parse(self, data): ! self.architecture = data[:4] ! ( self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2, ! self.memberSize,) = struct.unpack("4lhBB4lh", data[4:42]) ! pname = data[42:self.memberSize] ! self.name = pname[1:1+ord(pname[0])] ! ! def build(self): ! data = self.architecture ! data = data + struct.pack("4lhBB4l", ! self.updatelevel, ! self.currentVersion, ! self.oldDefVersion, ! self.stacksize, ! self.applibdir, ! self.fragtype, ! self.where, ! self.offset, ! self.length, ! self.res1, self.res2) ! self.memberSize = len(data) + 2 + 1 + len(self.name) ! # pad to 4 byte boundaries ! if self.memberSize % 4: ! self.memberSize = self.memberSize + 4 - (self.memberSize % 4) ! data = data + struct.pack("hb", self.memberSize, len(self.name)) ! data = data + self.name ! data = data + '\000' * (self.memberSize - len(data)) ! return data ! ! def getfragment(self): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! f = open(self.path, "rb") ! f.seek(self.offset) ! if self.length: ! frag = f.read(self.length) ! else: ! frag = f.read() ! f.close() ! return frag ! ! def copydata(self, outfile): ! if self.where <> 1: ! raise error, "can't read fragment, unsupported location" ! infile = open(self.path, "rb") ! if self.length == 0: ! infile.seek(0, 2) ! self.length = infile.tell() ! ! # Position input file and record new offset from output file ! infile.seek(self.offset) ! ! # pad to 16 byte boundaries ! offset = outfile.tell() ! if offset % 16: ! offset = offset + 16 - (offset % 16) ! outfile.seek(offset) ! self.offset = offset ! ! l = self.length ! while l: ! if l > BUFSIZE: ! outfile.write(infile.read(BUFSIZE)) ! l = l - BUFSIZE ! else: ! outfile.write(infile.read(l)) ! l = 0 ! infile.close() Index: findertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/findertools.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** findertools.py 21 Feb 2003 23:14:30 -0000 1.3 --- findertools.py 9 Apr 2003 13:25:42 -0000 1.4 *************** *** 31,832 **** def _getfinder(): ! """returns basic (recyclable) Finder AE interface object""" ! global _finder_talker ! if not _finder_talker: ! _finder_talker = Finder.Finder() ! _finder_talker.send_flags = ( _finder_talker.send_flags | ! AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer) ! return _finder_talker ! [...1575 lines suppressed...] ! print 'Return a list of current active processes:' ! for p in pr: ! print '\t', p ! ! # get attributes of the first process in the list ! print 'Attributes of the first process in the list:' ! pinfo = processinfo(pr[0][0]) ! print '\t', pr[0][0] ! print '\t\tmemory partition', pinfo.partition # the memory allocated to this process ! print '\t\tmemory used', pinfo.used # the memory actuall used by this process ! print '\t\tis visible', pinfo.visible # is the process visible to the user ! print '\t\tis frontmost', pinfo.frontmost # is the process the front most one? ! print '\t\thas scripting', pinfo.hasscripting # is the process scriptable? ! print '\t\taccepts high level events', pinfo.accepthighlevel # does the process accept high level appleevents? if __name__ == '__main__': ! _test() ! _test2() ! _test3() ! Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gensuitemodule.py 1 Apr 2003 22:01:58 -0000 1.5 --- gensuitemodule.py 9 Apr 2003 13:25:42 -0000 1.6 *************** *** 30,35 **** def usage(): ! sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) ! sys.stderr.write("""Options: --output pkgdir Pathname of the output package (short: -o) --resource Parse resource file in stead of launching application (-r) --- 30,35 ---- def usage(): ! sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) [...2296 lines suppressed...] ! rv = '' ! ok = string.ascii_letters + '_' ! ok2 = ok + string.digits ! for c in str: ! if c in ok: ! rv = rv + c ! elif c == ' ': ! rv = rv + '_' ! else: ! rv = rv + '_%02.2x_'%ord(c) ! ok = ok2 ! if keyword.iskeyword(rv): ! rv = rv + '_' ! return rv # Call the main program if __name__ == '__main__': ! main() ! sys.exit(1) Index: ic.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/ic.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ic.py 25 Feb 2003 13:34:22 -0000 1.4 --- ic.py 9 Apr 2003 13:25:43 -0000 1.5 *************** *** 12,25 **** # From ictypes.h: ! icPrefNotFoundErr = -666 # preference not found (duh!) ! icPermErr = -667 # cannot set preference ! icPrefDataErr = -668 # problem with preference data ! icInternalErr = -669 # hmm, this is not good ! icTruncatedErr = -670 # more data was present than was returned ! icNoMoreWritersErr = -671 # you cannot begin a write session because someone else is already doing it */ ! icNothingToOverrideErr = -672 # no component for the override component to capture ! icNoURLErr = -673 # no URL found ! icConfigNotFoundErr = -674 # no configuration was found ! icConfigInappropriateErr = -675 # incorrect manufacturer code ICattr_no_change = -1 --- 12,25 ---- # From ictypes.h: ! icPrefNotFoundErr = -666 # preference not found (duh!) ! icPermErr = -667 # cannot set preference ! icPrefDataErr = -668 # problem with preference data ! icInternalErr = -669 # hmm, this is not good ! icTruncatedErr = -670 # more data was present than was returned ! icNoMoreWritersErr = -671 # you cannot begin a write session because someone else is already doing it */ ! icNothingToOverrideErr = -672 # no component for the override component to capture ! icNoURLErr = -673 # no URL found ! icConfigNotFoundErr = -674 # no configuration was found ! icConfigInappropriateErr = -675 # incorrect manufacturer code ICattr_no_change = -1 *************** *** 31,269 **** class ICOpaqueData: ! """An unparseable IC entry""" ! def __init__(self, data): ! self.data = data ! def __repr__(self): ! return "ICOpaqueData(%s)"%`self.data` _ICOpaqueDataType=type(ICOpaqueData('')) ! def _decode_default(data, key): ! if len(data) == 0: ! return data ! if ord(data[0]) == len(data)-1: ! # Assume Pstring ! return data[1:] ! return ICOpaqueData(data) ! ! def _decode_multistr(data, key): ! numstr = ord(data[0]) << 8 | ord(data[1]) ! rv = [] ! ptr = 2 ! for i in range(numstr): ! strlen = ord(data[ptr]) ! str = data[ptr+1:ptr+strlen+1] ! rv.append(str) ! ptr = ptr + strlen + 1 ! return rv ! def _decode_fontrecord(data, key): ! size = ord(data[0]) << 8 | ord(data[1]) ! face = ord(data[2]) ! namelen = ord(data[4]) ! return size, face, data[5:5+namelen] ! def _decode_boolean(data, key): ! return ord(data[0]) ! def _decode_text(data, key): ! return data ! def _decode_charset(data, key): ! return data[:256], data[256:] ! def _decode_appspec(data, key): ! namelen = ord(data[4]) ! return data[0:4], data[5:5+namelen] def _code_default(data, key): ! return chr(len(data)) + data ! def _code_multistr(data, key): ! numstr = len(data) ! rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff) ! for i in data: ! rv = rv + _code_default(i) ! return rv ! def _code_fontrecord(data, key): ! size, face, name = data ! return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \ ! chr(0) + _code_default(name) ! def _code_boolean(data, key): ! print 'XXXX boolean:', `data` ! return chr(data) ! def _code_text(data, key): ! return data ! def _code_charset(data, key): ! return data[0] + data[1] ! def _code_appspec(data, key): ! return data[0] + _code_default(data[1]) ! _decoder_table = { ! "ArchieAll" : (_decode_multistr , _code_multistr), ! "UMichAll" : (_decode_multistr , _code_multistr), ! "InfoMacAll" : (_decode_multistr , _code_multistr), ! "ListFont" : (_decode_fontrecord , _code_fontrecord), ! "ScreenFont" : (_decode_fontrecord , _code_fontrecord), ! "PrinterFont" : (_decode_fontrecord , _code_fontrecord), ! # "DownloadFolder" : (_decode_filespec , _code_filespec), ! "Signature": (_decode_text , _code_text), ! "Plan" : (_decode_text , _code_text), ! "MailHeaders" : (_decode_text , _code_text), ! "NewsHeaders" : (_decode_text , _code_text), ! # "Mapping" ! "CharacterSet" : (_decode_charset , _code_charset), ! "Helper\245" : (_decode_appspec , _code_appspec), ! # "Services" : (_decode_services, ????), ! "NewMailFlashIcon" : (_decode_boolean , _code_boolean), ! "NewMailDialog" : (_decode_boolean , _code_boolean), ! "NewMailPlaySound" : (_decode_boolean , _code_boolean), ! # "WebBackgroundColor" : _decode_color, ! "NoProxyDomains" : (_decode_multistr , _code_multistr), ! "UseHTTPProxy" : (_decode_boolean , _code_boolean), ! "UseGopherProxy": (_decode_boolean , _code_boolean), ! "UseFTPProxy" : (_decode_boolean , _code_boolean), ! "UsePassiveFTP" : (_decode_boolean , _code_boolean), } def _decode(data, key): ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! decoder = _decoder_table[key2][0] ! else: ! decoder = _decode_default ! return decoder(data, key) def _code(data, key): ! if type(data) == _ICOpaqueDataType: ! return data.data ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! coder = _decoder_table[key2][1] ! else: ! coder = _code_default ! return coder(data, key) ! class IC: ! def __init__(self, signature='Pyth', ic=None): ! if ic: ! self.ic = ic ! else: ! self.ic = icglue.ICStart(signature) ! if hasattr(self.ic, 'ICFindConfigFile'): ! self.ic.ICFindConfigFile() ! self.h = Res.Resource('') ! ! def keys(self): ! rv = [] ! self.ic.ICBegin(icReadOnlyPerm) ! num = self.ic.ICCountPref() ! for i in range(num): ! rv.append(self.ic.ICGetIndPref(i+1)) ! self.ic.ICEnd() ! return rv ! ! def has_key(self, key): ! return self.__contains__(key) ! ! def __contains__(self, key): ! try: ! dummy = self.ic.ICFindPrefHandle(key, self.h) ! except icglue.error: ! return 0 ! return 1 ! ! def __getitem__(self, key): ! attr = self.ic.ICFindPrefHandle(key, self.h) ! return _decode(self.h.data, key) ! ! def __setitem__(self, key, value): ! value = _code(value, key) ! self.ic.ICSetPref(key, ICattr_no_change, value) ! ! def launchurl(self, url, hint=""): ! # Work around a bug in ICLaunchURL: file:/foo does ! # not work but file:///foo does. ! if url[:6] == 'file:/' and url[6] != '/': ! url = 'file:///' + url[6:] ! self.ic.ICLaunchURL(hint, url, 0, len(url)) ! ! def parseurl(self, data, start=None, end=None, hint=""): ! if start == None: ! selStart = 0 ! selEnd = len(data) ! else: ! selStart = selEnd = start ! if end != None: ! selEnd = end ! selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) ! return self.h.data, selStart, selEnd ! ! def mapfile(self, file): ! if type(file) != type(''): ! file = file.as_tuple()[2] ! return self.ic.ICMapFilename(file) ! ! def maptypecreator(self, type, creator, filename=""): ! return self.ic.ICMapTypeCreator(type, creator, filename) ! ! def settypecreator(self, file): ! file = Carbon.File.pathname(file) ! record = self.mapfile(os.path.split(file)[1]) ! MacOS.SetCreatorAndType(file, record[2], record[1]) ! macostools.touched(fss) ! # Convenience routines _dft_ic = None def launchurl(url, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.launchurl(url, hint) ! def parseurl(data, start=None, end=None, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.parseurl(data, start, end, hint) ! def mapfile(filename): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.mapfile(filename) ! def maptypecreator(type, creator, filename=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.maptypecreator(type, creator, filename) ! def settypecreator(file): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.settypecreator(file) ! def _test(): ! ic = IC() ! for k in ic.keys(): ! try: ! v = ic[k] ! except error: ! v = '????' ! print k, '\t', v ! sys.exit(1) ! if __name__ == '__main__': ! _test() ! --- 31,269 ---- class ICOpaqueData: ! """An unparseable IC entry""" ! def __init__(self, data): ! self.data = data ! def __repr__(self): ! return "ICOpaqueData(%s)"%`self.data` _ICOpaqueDataType=type(ICOpaqueData('')) ! def _decode_default(data, key): ! if len(data) == 0: ! return data ! if ord(data[0]) == len(data)-1: ! # Assume Pstring ! return data[1:] ! return ICOpaqueData(data) ! ! def _decode_multistr(data, key): ! numstr = ord(data[0]) << 8 | ord(data[1]) ! rv = [] ! ptr = 2 ! for i in range(numstr): ! strlen = ord(data[ptr]) ! str = data[ptr+1:ptr+strlen+1] ! rv.append(str) ! ptr = ptr + strlen + 1 ! return rv ! def _decode_fontrecord(data, key): ! size = ord(data[0]) << 8 | ord(data[1]) ! face = ord(data[2]) ! namelen = ord(data[4]) ! return size, face, data[5:5+namelen] ! def _decode_boolean(data, key): ! return ord(data[0]) ! def _decode_text(data, key): ! return data ! def _decode_charset(data, key): ! return data[:256], data[256:] ! def _decode_appspec(data, key): ! namelen = ord(data[4]) ! return data[0:4], data[5:5+namelen] def _code_default(data, key): ! return chr(len(data)) + data ! def _code_multistr(data, key): ! numstr = len(data) ! rv = chr((numstr>>8) & 0xff) + chr(numstr & 0xff) ! for i in data: ! rv = rv + _code_default(i) ! return rv ! def _code_fontrecord(data, key): ! size, face, name = data ! return chr((size>>8) & 0xff) + chr(size & 0xff) + chr(face & 0xff) + \ ! chr(0) + _code_default(name) ! def _code_boolean(data, key): ! print 'XXXX boolean:', `data` ! return chr(data) ! def _code_text(data, key): ! return data ! def _code_charset(data, key): ! return data[0] + data[1] ! def _code_appspec(data, key): ! return data[0] + _code_default(data[1]) ! _decoder_table = { ! "ArchieAll" : (_decode_multistr , _code_multistr), ! "UMichAll" : (_decode_multistr , _code_multistr), ! "InfoMacAll" : (_decode_multistr , _code_multistr), ! "ListFont" : (_decode_fontrecord , _code_fontrecord), ! "ScreenFont" : (_decode_fontrecord , _code_fontrecord), ! "PrinterFont" : (_decode_fontrecord , _code_fontrecord), ! # "DownloadFolder" : (_decode_filespec , _code_filespec), ! "Signature": (_decode_text , _code_text), ! "Plan" : (_decode_text , _code_text), ! "MailHeaders" : (_decode_text , _code_text), ! "NewsHeaders" : (_decode_text , _code_text), ! # "Mapping" ! "CharacterSet" : (_decode_charset , _code_charset), ! "Helper\245" : (_decode_appspec , _code_appspec), ! # "Services" : (_decode_services, ????), ! "NewMailFlashIcon" : (_decode_boolean , _code_boolean), ! "NewMailDialog" : (_decode_boolean , _code_boolean), ! "NewMailPlaySound" : (_decode_boolean , _code_boolean), ! # "WebBackgroundColor" : _decode_color, ! "NoProxyDomains" : (_decode_multistr , _code_multistr), ! "UseHTTPProxy" : (_decode_boolean , _code_boolean), ! "UseGopherProxy": (_decode_boolean , _code_boolean), ! "UseFTPProxy" : (_decode_boolean , _code_boolean), ! "UsePassiveFTP" : (_decode_boolean , _code_boolean), } def _decode(data, key): ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! decoder = _decoder_table[key2][0] ! else: ! decoder = _decode_default ! return decoder(data, key) def _code(data, key): ! if type(data) == _ICOpaqueDataType: ! return data.data ! if '\245' in key: ! key2 = key[:string.index(key, '\245')+1] ! else: ! key2 = key ! if _decoder_table.has_key(key2): ! coder = _decoder_table[key2][1] ! else: ! coder = _code_default ! return coder(data, key) ! class IC: ! def __init__(self, signature='Pyth', ic=None): ! if ic: ! self.ic = ic ! else: ! self.ic = icglue.ICStart(signature) ! if hasattr(self.ic, 'ICFindConfigFile'): ! self.ic.ICFindConfigFile() ! self.h = Res.Resource('') ! ! def keys(self): ! rv = [] ! self.ic.ICBegin(icReadOnlyPerm) ! num = self.ic.ICCountPref() ! for i in range(num): ! rv.append(self.ic.ICGetIndPref(i+1)) ! self.ic.ICEnd() ! return rv ! ! def has_key(self, key): ! return self.__contains__(key) ! ! def __contains__(self, key): ! try: ! dummy = self.ic.ICFindPrefHandle(key, self.h) ! except icglue.error: ! return 0 ! return 1 ! ! def __getitem__(self, key): ! attr = self.ic.ICFindPrefHandle(key, self.h) ! return _decode(self.h.data, key) ! ! def __setitem__(self, key, value): ! value = _code(value, key) ! self.ic.ICSetPref(key, ICattr_no_change, value) ! ! def launchurl(self, url, hint=""): ! # Work around a bug in ICLaunchURL: file:/foo does ! # not work but file:///foo does. ! if url[:6] == 'file:/' and url[6] != '/': ! url = 'file:///' + url[6:] ! self.ic.ICLaunchURL(hint, url, 0, len(url)) ! ! def parseurl(self, data, start=None, end=None, hint=""): ! if start == None: ! selStart = 0 ! selEnd = len(data) ! else: ! selStart = selEnd = start ! if end != None: ! selEnd = end ! selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) ! return self.h.data, selStart, selEnd ! ! def mapfile(self, file): ! if type(file) != type(''): ! file = file.as_tuple()[2] ! return self.ic.ICMapFilename(file) ! ! def maptypecreator(self, type, creator, filename=""): ! return self.ic.ICMapTypeCreator(type, creator, filename) ! ! def settypecreator(self, file): ! file = Carbon.File.pathname(file) ! record = self.mapfile(os.path.split(file)[1]) ! MacOS.SetCreatorAndType(file, record[2], record[1]) ! macostools.touched(fss) ! # Convenience routines _dft_ic = None def launchurl(url, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.launchurl(url, hint) ! def parseurl(data, start=None, end=None, hint=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.parseurl(data, start, end, hint) ! def mapfile(filename): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.mapfile(filename) ! def maptypecreator(type, creator, filename=""): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.maptypecreator(type, creator, filename) ! def settypecreator(file): ! global _dft_ic ! if _dft_ic == None: _dft_ic = IC() ! return _dft_ic.settypecreator(file) ! def _test(): ! ic = IC() ! for k in ic.keys(): ! try: ! v = ic[k] ! except error: ! v = '????' ! print k, '\t', v ! sys.exit(1) ! if __name__ == '__main__': ! _test() ! Index: macerrors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macerrors.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** macerrors.py 30 Dec 2002 22:04:20 -0000 1.1 --- macerrors.py 9 Apr 2003 13:25:43 -0000 1.2 *************** *** 1,1852 **** ! svTempDisable = -32768 #svTempDisable ! svDisabled = -32640 #Reserve range -32640 to -32768 for Apple temp disables. ! fontNotOutlineErr = -32615 #bitmap font passed to routine that does outlines only ! kURL68kNotSupportedError = -30788 #kURL68kNotSupportedError ! kURLAccessNotAvailableError = -30787 #kURLAccessNotAvailableError ! kURLInvalidConfigurationError = -30786 #kURLInvalidConfigurationError ! kURLExtensionFailureError = -30785 #kURLExtensionFailureError ! kURLFileEmptyError = -30783 #kURLFileEmptyError ! kURLInvalidCallError = -30781 #kURLInvalidCallError ! kURLUnsettablePropertyError = -30780 #kURLUnsettablePropertyError [...3675 lines suppressed...] ! ENETRESET = 52 #Network dropped connection on reset ! ECONNABORTED = 53 #Software caused connection abort ! ECONNRESET = 54 #Connection reset by peer ! ENOBUFS = 55 #No buffer space available ! EISCONN = 56 #Socket is already connected ! ENOTCONN = 57 #Socket is not connected ! ESHUTDOWN = 58 #Can't send after socket shutdown ! ETOOMANYREFS = 59 #Too many references: can't splice ! ETIMEDOUT = 60 #Operation timed out ! ECONNREFUSED = 61 #Connection refused ! ELOOP = 62 #Too many levels of symbolic links ! ENAMETOOLONG = 63 #File name too long ! EHOSTDOWN = 64 #Host is down ! EHOSTUNREACH = 65 #No route to host ! ENOTEMPTY = 66 #Directory not empty ! ELOOK = 67 #Internal mapping for kOTLookErr, don't return to client ! ENOLCK = 77 #No locks available ! ENOSYS = 78 #Function not implemented ! EILSEQ = 88 #Wide character encoding error ! EUNKNOWN = 99 #Unknown error Index: macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macfs.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** macfs.py 27 Feb 2003 23:17:59 -0000 1.9 --- macfs.py 9 Apr 2003 13:25:43 -0000 1.10 *************** *** 29,51 **** import time if time.gmtime(0)[0] == 1970: ! _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L ! def _utc2time(utc): ! t = utc[1] + _EPOCHCONVERT ! return int(t) ! def _time2utc(t): ! t = int(t) - _EPOCHCONVERT ! if t < -0x7fffffff: ! t = t + 0x10000000L ! return (0, int(t), 0) else: ! def _utc2time(utc): ! t = utc[1] ! if t < 0: ! t = t + 0x100000000L ! return t ! def _time2utc(t): ! if t > 0x7fffffff: ! t = t - 0x100000000L ! return (0, int(t), 0) # The old name of the error object: --- 29,51 ---- import time if time.gmtime(0)[0] == 1970: ! _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L ! def _utc2time(utc): ! t = utc[1] + _EPOCHCONVERT ! return int(t) ! def _time2utc(t): ! t = int(t) - _EPOCHCONVERT ! if t < -0x7fffffff: ! t = t + 0x10000000L ! return (0, int(t), 0) else: ! def _utc2time(utc): ! t = utc[1] ! if t < 0: ! t = t + 0x100000000L ! return t ! def _time2utc(t): ! if t > 0x7fffffff: ! t = t - 0x100000000L ! return (0, int(t), 0) # The old name of the error object: *************** *** 57,114 **** # class FSSpec(Carbon.File.FSSpec): ! def as_fsref(self): ! return FSRef(self) ! ! def NewAlias(self, src=None): ! return Alias(Carbon.File.NewAlias(src, self)) ! ! def GetCreatorType(self): ! finfo = self.FSpGetFInfo() ! return finfo.Creator, finfo.Type ! ! def SetCreatorType(self, ctor, tp): ! finfo = self.FSpGetFInfo() ! finfo.Creator = ctor ! finfo.Type = tp ! self.FSpSetFInfo(finfo) ! ! def GetFInfo(self): ! return self.FSpGetFInfo() ! ! def SetFInfo(self, info): ! return self.FSpSetFInfo(info) ! ! def GetDates(self): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) ! cdate = catinfo.createDate ! mdate = catinfo.contentModDate ! bdate = catinfo.backupDate ! return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) ! ! def SetDates(self, cdate, mdate, bdate): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo = Carbon.File.FSCatalogInfo( ! createDate = _time2utc(cdate), ! contentModDate = _time2utc(mdate), ! backupDate = _time2utc(bdate)) ! FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) ! class FSRef(Carbon.File.FSRef): ! def as_fsspec(self): ! return FSSpec(self) ! class Alias(Carbon.File.Alias): ! def GetInfo(self, index): ! return self.GetAliasInfo(index) ! ! def Update(self, *args): ! pass # print "Alias.Update not yet implemented" ! ! def Resolve(self, src=None): ! fss, changed = self.ResolveAlias(src) ! return FSSpec(fss), changed ! from Carbon.File import FInfo --- 57,114 ---- # class FSSpec(Carbon.File.FSSpec): ! def as_fsref(self): ! return FSRef(self) ! ! def NewAlias(self, src=None): ! return Alias(Carbon.File.NewAlias(src, self)) ! ! def GetCreatorType(self): ! finfo = self.FSpGetFInfo() ! return finfo.Creator, finfo.Type ! ! def SetCreatorType(self, ctor, tp): ! finfo = self.FSpGetFInfo() ! finfo.Creator = ctor ! finfo.Type = tp ! self.FSpSetFInfo(finfo) ! ! def GetFInfo(self): ! return self.FSpGetFInfo() ! ! def SetFInfo(self, info): ! return self.FSpSetFInfo(info) ! ! def GetDates(self): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) ! cdate = catinfo.createDate ! mdate = catinfo.contentModDate ! bdate = catinfo.backupDate ! return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) ! ! def SetDates(self, cdate, mdate, bdate): ! catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate ! catinfo = Carbon.File.FSCatalogInfo( ! createDate = _time2utc(cdate), ! contentModDate = _time2utc(mdate), ! backupDate = _time2utc(bdate)) ! FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) ! class FSRef(Carbon.File.FSRef): ! def as_fsspec(self): ! return FSSpec(self) ! class Alias(Carbon.File.Alias): ! def GetInfo(self, index): ! return self.GetAliasInfo(index) ! ! def Update(self, *args): ! pass # print "Alias.Update not yet implemented" ! ! def Resolve(self, src=None): ! fss, changed = self.ResolveAlias(src) ! return FSSpec(fss), changed ! from Carbon.File import FInfo *************** *** 121,139 **** # Global functions: def ResolveAliasFile(fss, chain=1): ! fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) ! return FSSpec(fss), isdir, isalias ! def RawFSSpec(data): ! return FSSpec(rawdata=data) ! def RawAlias(data): ! return Alias(rawdata=data) ! def FindApplication(*args): ! raise NotImplementedError, "FindApplication no longer implemented" ! def NewAliasMinimalFromFullPath(path): ! return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) ! # Another global function: from Carbon.Folder import FindFolder --- 121,139 ---- # Global functions: def ResolveAliasFile(fss, chain=1): ! fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) ! return FSSpec(fss), isdir, isalias ! def RawFSSpec(data): ! return FSSpec(rawdata=data) ! def RawAlias(data): ! return Alias(rawdata=data) ! def FindApplication(*args): ! raise NotImplementedError, "FindApplication no longer implemented" ! def NewAliasMinimalFromFullPath(path): ! return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) ! # Another global function: from Carbon.Folder import FindFolder *************** *** 146,198 **** def StandardGetFile(*typelist): ! """Ask for an input file, optionally specifying 4-char file types that are ! allowable""" ! return PromptGetFile('', *typelist) ! def PromptGetFile(prompt, *typelist): ! """Ask for an input file giving the user a prompt message. Optionally you can ! specifying 4-char file types that are allowable""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if not typelist: ! typelist = None ! fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, ! typeList=typelist, defaultLocation=_handleSetFolder()) ! return fss, not fss is None def StandardPutFile(prompt, default=None): ! """Ask the user for an output file, with a prompt. Optionally you cn supply a ! default output filename""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, ! savedFileName=default, defaultLocation=_handleSetFolder()) ! return fss, not fss is None ! def SetFolder(folder): ! global _curfolder ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if _curfolder: ! rv = FSSpec(_curfolder) ! else: ! rv = None ! _curfolder = folder ! return rv ! def _handleSetFolder(): ! global _curfolder ! rv = _curfolder ! _curfolder = None ! return rv ! def GetDirectory(prompt=None): ! """Ask the user to select a folder. Optionally you can give a prompt.""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, ! defaultLocation=_handleSetFolder()) ! return fss, not fss is None --- 146,198 ---- def StandardGetFile(*typelist): ! """Ask for an input file, optionally specifying 4-char file types that are ! allowable""" ! return PromptGetFile('', *typelist) ! def PromptGetFile(prompt, *typelist): ! """Ask for an input file giving the user a prompt message. Optionally you can ! specifying 4-char file types that are allowable""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if not typelist: ! typelist = None ! fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, ! typeList=typelist, defaultLocation=_handleSetFolder()) ! return fss, not fss is None def StandardPutFile(prompt, default=None): ! """Ask the user for an output file, with a prompt. Optionally you cn supply a ! default output filename""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, ! savedFileName=default, defaultLocation=_handleSetFolder()) ! return fss, not fss is None ! def SetFolder(folder): ! global _curfolder ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! if _curfolder: ! rv = FSSpec(_curfolder) ! else: ! rv = None ! _curfolder = folder ! return rv ! def _handleSetFolder(): ! global _curfolder ! rv = _curfolder ! _curfolder = None ! return rv ! def GetDirectory(prompt=None): ! """Ask the user to select a folder. Optionally you can give a prompt.""" ! import EasyDialogs ! warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", DeprecationWarning, stacklevel=2) ! fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, ! defaultLocation=_handleSetFolder()) ! return fss, not fss is None Index: macresource.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macresource.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** macresource.py 25 Feb 2003 23:02:03 -0000 1.4 --- macresource.py 9 Apr 2003 13:25:43 -0000 1.5 *************** *** 11,146 **** def need(restype, resid, filename=None, modname=None): ! """Open a resource file, if needed. restype and resid ! are required parameters, and identify the resource for which to test. If it ! is available we are done. If it is not available we look for a file filename ! (default: modname with .rsrc appended) either in the same folder as ! where modname was loaded from, or otherwise across sys.path. ! ! Returns the refno of the resource file opened (or None)""" ! if modname is None and filename is None: ! raise ArgumentError, "Either filename or modname argument (or both) must be given" ! ! if type(resid) is type(1): ! try: ! h = Res.GetResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! else: ! try: ! h = Res.GetNamedResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! ! # Construct a filename if we don't have one ! if not filename: ! if '.' in modname: ! filename = modname.split('.')[-1] + '.rsrc' ! else: ! filename = modname + '.rsrc' ! ! # Now create a list of folders to search ! searchdirs = [] ! if modname == '__main__': ! # If we're main we look in the current directory ! searchdirs = [os.curdir] ! if sys.modules.has_key(modname): ! mod = sys.modules[modname] ! if hasattr(mod, '__file__'): ! searchdirs = [os.path.dirname(mod.__file__)] ! searchdirs.extend(sys.path) ! ! # And look for the file ! for dir in searchdirs: ! pathname = os.path.join(dir, filename) ! if os.path.exists(pathname): ! break ! else: ! raise ResourceFileNotFoundError, filename ! ! refno = open_pathname(pathname) ! ! # And check that the resource exists now ! if type(resid) is type(1): ! h = Res.GetResource(restype, resid) ! else: ! h = Res.GetNamedResource(restype, resid) ! return refno ! def open_pathname(pathname, verbose=0): ! """Open a resource file given by pathname, possibly decoding an ! AppleSingle file""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! else: ! raise ! return refno ! def resource_pathname(pathname, verbose=0): ! """Return the pathname for a resource file (either DF or RF based). ! If the pathname given already refers to such a file simply return it, ! otherwise first decode it.""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! Res.CloseResFile(refno) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! else: ! raise ! return pathname ! def open_error_resource(): ! """Open the resource file containing the error code to error message ! mapping.""" ! need('Estr', 1, filename="errors.rsrc", modname=__name__) ! def _decode(pathname, verbose=0): ! # Decode an AppleSingle resource file, return the new pathname. ! newpathname = pathname + '.df.rsrc' ! if os.path.exists(newpathname) and \ ! os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: ! return newpathname ! if hasattr(os, 'access') and not \ ! os.access(os.path.dirname(pathname), os.W_OK|os.X_OK): ! # The destination directory isn't writeable. Create the file in ! # a temporary directory ! import tempfile ! fd, newpathname = tempfile.mkstemp(".rsrc") ! if verbose: ! print 'Decoding', pathname, 'to', newpathname ! import applesingle ! applesingle.decode(pathname, newpathname, resonly=1) ! return newpathname --- 11,146 ---- def need(restype, resid, filename=None, modname=None): ! """Open a resource file, if needed. restype and resid ! are required parameters, and identify the resource for which to test. If it ! is available we are done. If it is not available we look for a file filename ! (default: modname with .rsrc appended) either in the same folder as ! where modname was loaded from, or otherwise across sys.path. ! ! Returns the refno of the resource file opened (or None)""" ! if modname is None and filename is None: ! raise ArgumentError, "Either filename or modname argument (or both) must be given" ! ! if type(resid) is type(1): ! try: ! h = Res.GetResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! else: ! try: ! h = Res.GetNamedResource(restype, resid) ! except Res.Error: ! pass ! else: ! return None ! ! # Construct a filename if we don't have one ! if not filename: ! if '.' in modname: ! filename = modname.split('.')[-1] + '.rsrc' ! else: ! filename = modname + '.rsrc' ! ! # Now create a list of folders to search ! searchdirs = [] ! if modname == '__main__': ! # If we're main we look in the current directory ! searchdirs = [os.curdir] ! if sys.modules.has_key(modname): ! mod = sys.modules[modname] ! if hasattr(mod, '__file__'): ! searchdirs = [os.path.dirname(mod.__file__)] ! searchdirs.extend(sys.path) ! ! # And look for the file ! for dir in searchdirs: ! pathname = os.path.join(dir, filename) ! if os.path.exists(pathname): ! break ! else: ! raise ResourceFileNotFoundError, filename ! ! refno = open_pathname(pathname) ! ! # And check that the resource exists now ! if type(resid) is type(1): ! h = Res.GetResource(restype, resid) ! else: ! h = Res.GetNamedResource(restype, resid) ! return refno ! def open_pathname(pathname, verbose=0): ! """Open a resource file given by pathname, possibly decoding an ! AppleSingle file""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! else: ! raise ! return refno ! def resource_pathname(pathname, verbose=0): ! """Return the pathname for a resource file (either DF or RF based). ! If the pathname given already refers to such a file simply return it, ! otherwise first decode it.""" ! try: ! refno = Res.FSpOpenResFile(pathname, 1) ! Res.CloseResFile(refno) ! except Res.Error, arg: ! if arg[0] in (-37, -39): ! # No resource fork. We may be on OSX, and this may be either ! # a data-fork based resource file or a AppleSingle file ! # from the CVS repository. ! try: ! refno = Res.FSOpenResourceFile(pathname, u'', 1) ! except Res.Error, arg: ! if arg[0] != -199: ! # -199 is "bad resource map" ! raise ! else: ! return refno ! # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) ! else: ! raise ! return pathname ! def open_error_resource(): ! """Open the resource file containing the error code to error message ! mapping.""" ! need('Estr', 1, filename="errors.rsrc", modname=__name__) ! def _decode(pathname, verbose=0): ! # Decode an AppleSingle resource file, return the new pathname. ! newpathname = pathname + '.df.rsrc' ! if os.path.exists(newpathname) and \ ! os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: ! return newpathname ! if hasattr(os, 'access') and not \ ! os.access(os.path.dirname(pathname), os.W_OK|os.X_OK): ! # The destination directory isn't writeable. Create the file in ! # a temporary directory ! import tempfile ! fd, newpathname = tempfile.mkstemp(".rsrc") ! if verbose: ! print 'Decoding', pathname, 'to', newpathname ! import applesingle ! applesingle.decode(pathname, newpathname, resonly=1) ! return newpathname Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pimp.py 17 Mar 2003 10:54:41 -0000 1.14 --- pimp.py 9 Apr 2003 13:25:43 -0000 1.15 *************** *** 44,798 **** ARCHIVE_FORMATS = [ ! (".tar.Z", "zcat \"%s\" | tar -xf -"), ! (".taz", "zcat \"%s\" | tar -xf -"), ! (".tar.gz", "zcat \"%s\" | tar -xf -"), ! (".tgz", "zcat \"%s\" | tar -xf -"), ! (".tar.bz", "bzcat \"%s\" | tar -xf -"), ! (".zip", "unzip \"%s\""), ] [...1481 lines suppressed...] ! _help() ! mode = 'list' ! if o == '-d': ! if mode: ! _help() ! mode = 'dump' ! if o == '-i': ! mode = 'install' ! if o == '-f': ! force = 1 ! if o == '-v': ! verbose = 1 ! if not mode: ! _help() ! _run(mode, verbose, force, args) ! if __name__ == '__main__': ! main() ! ! Index: plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/plistlib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plistlib.py 30 Dec 2002 22:04:20 -0000 1.1 --- plistlib.py 9 Apr 2003 13:25:43 -0000 1.2 *************** *** 34,60 **** Generate Plist example: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! pl.write(fileName) Parse Plist example: ! pl = Plist.fromFile(pathOrFile) ! print pl.aKey --- 34,60 ---- Generate Plist example: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! pl.write(fileName) Parse Plist example: ! pl = Plist.fromFile(pathOrFile) ! print pl.aKey *************** *** 72,109 **** class DumbXMLWriter: ! def __init__(self, file): ! self.file = file ! self.stack = [] ! self.indentLevel = 0 ! def beginElement(self, element): ! self.stack.append(element) ! self.writeln("<%s>" % element) ! self.indentLevel += 1 ! def endElement(self, element): ! assert self.indentLevel > 0 ! assert self.stack.pop() == element ! self.indentLevel -= 1 ! self.writeln("" % element) ! def simpleElement(self, element, value=None): ! if value: ! value = _encode(value) ! self.writeln("<%s>%s" % (element, value, element)) ! else: ! self.writeln("<%s/>" % element) ! def writeln(self, line): ! if line: ! self.file.write(self.indentLevel * INDENT + line + "\n") ! else: ! self.file.write("\n") def _encode(text): ! text = text.replace("&", "&") ! text = text.replace("<", "<") ! return text.encode("utf-8") --- 72,109 ---- class DumbXMLWriter: ! def __init__(self, file): ! self.file = file ! self.stack = [] ! self.indentLevel = 0 ! def beginElement(self, element): ! self.stack.append(element) ! self.writeln("<%s>" % element) ! self.indentLevel += 1 ! def endElement(self, element): ! assert self.indentLevel > 0 ! assert self.stack.pop() == element ! self.indentLevel -= 1 ! self.writeln("" % element) ! def simpleElement(self, element, value=None): ! if value: ! value = _encode(value) ! self.writeln("<%s>%s" % (element, value, element)) ! else: ! self.writeln("<%s/>" % element) ! def writeln(self, line): ! if line: ! self.file.write(self.indentLevel * INDENT + line + "\n") ! else: ! self.file.write("\n") def _encode(text): ! text = text.replace("&", "&") ! text = text.replace("<", "<") ! return text.encode("utf-8") *************** *** 115,375 **** class PlistWriter(DumbXMLWriter): ! def __init__(self, file): ! file.write(PLISTHEADER) ! DumbXMLWriter.__init__(self, file) ! def writeValue(self, value): ! if isinstance(value, (str, unicode)): ! self.simpleElement("string", value) ! elif isinstance(value, bool): ! # must switch for bool before int, as bool is a ! # subclass of int... ! if value: ! self.simpleElement("true") ! else: ! self.simpleElement("false") ! elif isinstance(value, int): ! self.simpleElement("integer", str(value)) ! elif isinstance(value, float): ! # should perhaps use repr() for better precision? ! self.simpleElement("real", str(value)) ! elif isinstance(value, (dict, Dict)): ! self.writeDict(value) ! elif isinstance(value, Data): ! self.writeData(value) ! elif isinstance(value, Date): ! self.simpleElement("date", value.toString()) ! elif isinstance(value, (tuple, list)): ! self.writeArray(value) ! else: ! assert 0, "unsuported type: %s" % type(value) ! def writeData(self, data): ! self.beginElement("data") ! for line in data.asBase64().split("\n"): ! if line: ! self.writeln(line) ! self.endElement("data") ! def writeDict(self, d): ! self.beginElement("dict") ! items = d.items() ! items.sort() ! for key, value in items: ! assert isinstance(key, (str, unicode)), "keys must be strings" ! self.simpleElement("key", key) ! self.writeValue(value) ! self.endElement("dict") ! def writeArray(self, array): ! self.beginElement("array") ! for value in array: ! self.writeValue(value) ! self.endElement("array") class Dict: ! """Dict wrapper for convenient access of values through attributes.""" ! def __init__(self, **kwargs): ! self.__dict__.update(kwargs) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.__dict__, other.__dict__) ! elif isinstance(other, dict): ! return cmp(self.__dict__, other) ! else: ! return cmp(id(self), id(other)) ! def __str__(self): ! return "%s(**%s)" % (self.__class__.__name__, self.__dict__) ! __repr__ = __str__ ! def copy(self): ! return self.__class__(**self.__dict__) ! def __getattr__(self, attr): ! """Delegate everything else to the dict object.""" ! return getattr(self.__dict__, attr) class Plist(Dict): ! """The main Plist object. Basically a dict (the toplevel object ! of a plist is a dict) with two additional methods to read from ! and write to files. ! """ ! def fromFile(cls, pathOrFile): ! didOpen = 0 ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile) ! didOpen = 1 ! p = PlistParser() ! plist = p.parse(pathOrFile) ! if didOpen: ! pathOrFile.close() ! return plist ! fromFile = classmethod(fromFile) ! def write(self, pathOrFile): ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile, "w") ! didOpen = 1 ! else: ! didOpen = 0 ! writer = PlistWriter(pathOrFile) ! writer.writeln("") ! writer.writeDict(self.__dict__) ! writer.writeln("") ! if didOpen: ! pathOrFile.close() class Data: ! """Wrapper for binary data.""" ! def __init__(self, data): ! self.data = data ! def fromBase64(cls, data): ! import base64 ! return cls(base64.decodestring(data)) ! fromBase64 = classmethod(fromBase64) ! def asBase64(self): ! import base64 ! return base64.encodestring(self.data) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.data, other.data) ! elif isinstance(other, str): ! return cmp(self.data, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.data)) class Date: ! """Primitive date wrapper, uses time floats internally, is agnostic ! about time zones. ! """ ! def __init__(self, date): ! if isinstance(date, str): ! from xml.utils.iso8601 import parse ! date = parse(date) ! self.date = date ! def toString(self): ! from xml.utils.iso8601 import tostring ! return tostring(self.date) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.date, other.date) ! elif isinstance(other, (int, float)): ! return cmp(self.date, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.toString())) class PlistParser: ! def __init__(self): ! self.stack = [] ! self.currentKey = None ! self.root = None ! def parse(self, file): ! from xml.parsers.expat import ParserCreate ! parser = ParserCreate() ! parser.StartElementHandler = self.handleBeginElement ! parser.EndElementHandler = self.handleEndElement ! parser.CharacterDataHandler = self.handleData ! parser.ParseFile(file) ! return self.root ! def handleBeginElement(self, element, attrs): ! self.data = [] ! handler = getattr(self, "begin_" + element, None) ! if handler is not None: ! handler(attrs) ! def handleEndElement(self, element): ! handler = getattr(self, "end_" + element, None) ! if handler is not None: ! handler() ! def handleData(self, data): ! self.data.append(data) ! def addObject(self, value): ! if self.currentKey is not None: ! self.stack[-1][self.currentKey] = value ! self.currentKey = None ! elif not self.stack: ! # this is the root object ! assert self.root is value ! else: ! self.stack[-1].append(value) ! def getData(self): ! data = "".join(self.data) ! try: ! data = data.encode("ascii") ! except UnicodeError: ! pass ! self.data = [] ! return data ! # element handlers ! def begin_dict(self, attrs): ! if self.root is None: ! self.root = d = Plist() ! else: ! d = Dict() ! self.addObject(d) ! self.stack.append(d) ! def end_dict(self): ! self.stack.pop() ! def end_key(self): ! self.currentKey = self.getData() ! def begin_array(self, attrs): ! a = [] ! self.addObject(a) ! self.stack.append(a) ! def end_array(self): ! self.stack.pop() ! def end_true(self): ! self.addObject(True) ! def end_false(self): ! self.addObject(False) ! def end_integer(self): ! self.addObject(int(self.getData())) ! def end_real(self): ! self.addObject(float(self.getData())) ! def end_string(self): ! self.addObject(self.getData()) ! def end_data(self): ! self.addObject(Data.fromBase64(self.getData())) ! def end_date(self): ! self.addObject(Date(self.getData())) --- 115,375 ---- class PlistWriter(DumbXMLWriter): ! def __init__(self, file): ! file.write(PLISTHEADER) ! DumbXMLWriter.__init__(self, file) ! def writeValue(self, value): ! if isinstance(value, (str, unicode)): ! self.simpleElement("string", value) ! elif isinstance(value, bool): ! # must switch for bool before int, as bool is a ! # subclass of int... ! if value: ! self.simpleElement("true") ! else: ! self.simpleElement("false") ! elif isinstance(value, int): ! self.simpleElement("integer", str(value)) ! elif isinstance(value, float): ! # should perhaps use repr() for better precision? ! self.simpleElement("real", str(value)) ! elif isinstance(value, (dict, Dict)): ! self.writeDict(value) ! elif isinstance(value, Data): ! self.writeData(value) ! elif isinstance(value, Date): ! self.simpleElement("date", value.toString()) ! elif isinstance(value, (tuple, list)): ! self.writeArray(value) ! else: ! assert 0, "unsuported type: %s" % type(value) ! def writeData(self, data): ! self.beginElement("data") ! for line in data.asBase64().split("\n"): ! if line: ! self.writeln(line) ! self.endElement("data") ! def writeDict(self, d): ! self.beginElement("dict") ! items = d.items() ! items.sort() ! for key, value in items: ! assert isinstance(key, (str, unicode)), "keys must be strings" ! self.simpleElement("key", key) ! self.writeValue(value) ! self.endElement("dict") ! def writeArray(self, array): ! self.beginElement("array") ! for value in array: ! self.writeValue(value) ! self.endElement("array") class Dict: ! """Dict wrapper for convenient access of values through attributes.""" ! def __init__(self, **kwargs): ! self.__dict__.update(kwargs) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.__dict__, other.__dict__) ! elif isinstance(other, dict): ! return cmp(self.__dict__, other) ! else: ! return cmp(id(self), id(other)) ! def __str__(self): ! return "%s(**%s)" % (self.__class__.__name__, self.__dict__) ! __repr__ = __str__ ! def copy(self): ! return self.__class__(**self.__dict__) ! def __getattr__(self, attr): ! """Delegate everything else to the dict object.""" ! return getattr(self.__dict__, attr) class Plist(Dict): ! """The main Plist object. Basically a dict (the toplevel object ! of a plist is a dict) with two additional methods to read from ! and write to files. ! """ ! def fromFile(cls, pathOrFile): ! didOpen = 0 ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile) ! didOpen = 1 ! p = PlistParser() ! plist = p.parse(pathOrFile) ! if didOpen: ! pathOrFile.close() ! return plist ! fromFile = classmethod(fromFile) ! def write(self, pathOrFile): ! if not hasattr(pathOrFile, "write"): ! pathOrFile = open(pathOrFile, "w") ! didOpen = 1 ! else: ! didOpen = 0 ! writer = PlistWriter(pathOrFile) ! writer.writeln("") ! writer.writeDict(self.__dict__) ! writer.writeln("") ! if didOpen: ! pathOrFile.close() class Data: ! """Wrapper for binary data.""" ! def __init__(self, data): ! self.data = data ! def fromBase64(cls, data): ! import base64 ! return cls(base64.decodestring(data)) ! fromBase64 = classmethod(fromBase64) ! def asBase64(self): ! import base64 ! return base64.encodestring(self.data) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.data, other.data) ! elif isinstance(other, str): ! return cmp(self.data, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.data)) class Date: ! """Primitive date wrapper, uses time floats internally, is agnostic ! about time zones. ! """ ! def __init__(self, date): ! if isinstance(date, str): ! from xml.utils.iso8601 import parse ! date = parse(date) ! self.date = date ! def toString(self): ! from xml.utils.iso8601 import tostring ! return tostring(self.date) ! def __cmp__(self, other): ! if isinstance(other, self.__class__): ! return cmp(self.date, other.date) ! elif isinstance(other, (int, float)): ! return cmp(self.date, other) ! else: ! return cmp(id(self), id(other)) ! def __repr__(self): ! return "%s(%s)" % (self.__class__.__name__, repr(self.toString())) class PlistParser: ! def __init__(self): ! self.stack = [] ! self.currentKey = None ! self.root = None ! def parse(self, file): ! from xml.parsers.expat import ParserCreate ! parser = ParserCreate() ! parser.StartElementHandler = self.handleBeginElement ! parser.EndElementHandler = self.handleEndElement ! parser.CharacterDataHandler = self.handleData ! parser.ParseFile(file) ! return self.root ! def handleBeginElement(self, element, attrs): ! self.data = [] ! handler = getattr(self, "begin_" + element, None) ! if handler is not None: ! handler(attrs) ! def handleEndElement(self, element): ! handler = getattr(self, "end_" + element, None) ! if handler is not None: ! handler() ! def handleData(self, data): ! self.data.append(data) ! def addObject(self, value): ! if self.currentKey is not None: ! self.stack[-1][self.currentKey] = value ! self.currentKey = None ! elif not self.stack: ! # this is the root object ! assert self.root is value ! else: ! self.stack[-1].append(value) ! def getData(self): ! data = "".join(self.data) ! try: ! data = data.encode("ascii") ! except UnicodeError: ! pass ! self.data = [] ! return data ! # element handlers ! def begin_dict(self, attrs): ! if self.root is None: ! self.root = d = Plist() ! else: ! d = Dict() ! self.addObject(d) ! self.stack.append(d) ! def end_dict(self): ! self.stack.pop() ! def end_key(self): ! self.currentKey = self.getData() ! def begin_array(self, attrs): ! a = [] ! self.addObject(a) ! self.stack.append(a) ! def end_array(self): ! self.stack.pop() ! def end_true(self): ! self.addObject(True) ! def end_false(self): ! self.addObject(False) ! def end_integer(self): ! self.addObject(int(self.getData())) ! def end_real(self): ! self.addObject(float(self.getData())) ! def end_string(self): ! self.addObject(self.getData()) ! def end_data(self): ! self.addObject(Data.fromBase64(self.getData())) ! def end_date(self): ! self.addObject(Date(self.getData())) *************** *** 377,436 **** import sys if sys.version_info[:2] < (2, 3): ! # Python 2.2 and earlier: no booleans ! # Python 2.2.x: booleans are ints ! class bool(int): ! """Imitation of the Python 2.3 bool object.""" ! def __new__(cls, value): ! return int.__new__(cls, not not value) ! def __repr__(self): ! if self: ! return "True" ! else: ! return "False" ! True = bool(1) ! False = bool(0) else: ! # Bind the boolean builtins to local names ! True = True ! False = False ! bool = bool if __name__ == "__main__": ! from StringIO import StringIO ! import time ! if len(sys.argv) == 1: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! elif len(sys.argv) == 2: ! pl = Plist.fromFile(sys.argv[1]) ! else: ! print "Too many arguments: at most 1 plist file can be given." ! sys.exit(1) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! f = StringIO() ! pl.write(f) ! xml = f.getvalue() ! print xml ! f.seek(0) ! pl2 = Plist.fromFile(f) ! assert pl == pl2 ! f = StringIO() ! pl2.write(f) ! assert xml == f.getvalue() ! #print repr(pl2) --- 377,436 ---- import sys if sys.version_info[:2] < (2, 3): ! # Python 2.2 and earlier: no booleans ! # Python 2.2.x: booleans are ints ! class bool(int): ! """Imitation of the Python 2.3 bool object.""" ! def __new__(cls, value): ! return int.__new__(cls, not not value) ! def __repr__(self): ! if self: ! return "True" ! else: ! return "False" ! True = bool(1) ! False = bool(0) else: ! # Bind the boolean builtins to local names ! True = True ! False = False ! bool = bool if __name__ == "__main__": ! from StringIO import StringIO ! import time ! if len(sys.argv) == 1: ! pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ! ) ! elif len(sys.argv) == 2: ! pl = Plist.fromFile(sys.argv[1]) ! else: ! print "Too many arguments: at most 1 plist file can be given." ! sys.exit(1) ! # unicode keys are possible, but a little awkward to use: ! pl[u'\xc5benraa'] = "That was a unicode key." ! f = StringIO() ! pl.write(f) ! xml = f.getvalue() ! print xml ! f.seek(0) ! pl2 = Plist.fromFile(f) ! assert pl == pl2 ! f = StringIO() ! pl2.write(f) ! assert xml == f.getvalue() ! #print repr(pl2) Index: videoreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/videoreader.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoreader.py 4 Feb 2003 15:36:42 -0000 1.2 --- videoreader.py 9 Apr 2003 13:25:43 -0000 1.3 *************** *** 14,292 **** from Carbon import Res try: ! import MediaDescr except ImportError: ! def _audiodescr(data): ! return None else: ! def _audiodescr(data): ! return MediaDescr.SoundDescription.decode(data) try: ! from imgformat import macrgb except ImportError: ! macrgb = "Macintosh RGB format" import os # import audio.format class VideoFormat: ! def __init__(self, name, descr, width, height, format): ! self.__name = name ! self.__descr = descr ! self.__width = width ! self.__height = height ! self.__format = format ! ! def getname(self): ! return self.__name ! ! def getdescr(self): ! return self.__descr ! ! def getsize(self): ! return self.__width, self.__height ! ! def getformat(self): ! return self.__format ! class _Reader: ! def __init__(self, path): ! fd = Qt.OpenMovieFile(path, 0) ! self.movie, d1, d2 = Qt.NewMovieFromFile(fd, 0, 0) ! self.movietimescale = self.movie.GetMovieTimeScale() ! try: ! self.audiotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.AudioMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.audiomedia = self.audiotrack.GetTrackMedia() ! except Qt.Error: ! self.audiotrack = self.audiomedia = None ! self.audiodescr = {} ! else: ! handle = Res.Handle('') ! n = self.audiomedia.GetMediaSampleDescriptionCount() ! self.audiomedia.GetMediaSampleDescription(1, handle) ! self.audiodescr = _audiodescr(handle.data) ! self.audiotimescale = self.audiomedia.GetMediaTimeScale() ! del handle ! ! try: ! self.videotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.videomedia = self.videotrack.GetTrackMedia() ! except Qt.Error: ! self.videotrack = self.videomedia = self.videotimescale = None ! if self.videotrack: ! self.videotimescale = self.videomedia.GetMediaTimeScale() ! x0, y0, x1, y1 = self.movie.GetMovieBox() ! self.videodescr = {'width':(x1-x0), 'height':(y1-y0)} ! self._initgworld() ! self.videocurtime = None ! self.audiocurtime = None ! ! def __del__(self): ! self.audiomedia = None ! self.audiotrack = None ! self.videomedia = None ! self.videotrack = None ! self.movie = None ! ! def _initgworld(self): ! old_port, old_dev = Qdoffs.GetGWorld() ! try: ! movie_w = self.videodescr['width'] ! movie_h = self.videodescr['height'] ! movie_rect = (0, 0, movie_w, movie_h) ! self.gworld = Qdoffs.NewGWorld(32, movie_rect, None, None, QDOffscreen.keepLocal) ! self.pixmap = self.gworld.GetGWorldPixMap() ! Qdoffs.LockPixels(self.pixmap) ! Qdoffs.SetGWorld(self.gworld.as_GrafPtr(), None) ! Qd.EraseRect(movie_rect) ! self.movie.SetMovieGWorld(self.gworld.as_GrafPtr(), None) ! self.movie.SetMovieBox(movie_rect) ! self.movie.SetMovieActive(1) ! self.movie.MoviesTask(0) ! self.movie.SetMoviePlayHints(QuickTime.hintsHighQuality, QuickTime.hintsHighQuality) ! # XXXX framerate ! finally: ! Qdoffs.SetGWorld(old_port, old_dev) ! ! def _gettrackduration_ms(self, track): ! tracktime = track.GetTrackDuration() ! return self._movietime_to_ms(tracktime) ! ! def _movietime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000) ! return value ! ! def _videotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000) ! return value ! ! def _audiotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000) ! return value ! ! def _videotime_to_movietime(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), ! self.movietimescale) ! return value ! ! def HasAudio(self): ! return not self.audiotrack is None ! ! def HasVideo(self): ! return not self.videotrack is None ! ! def GetAudioDuration(self): ! if not self.audiotrack: ! return 0 ! return self._gettrackduration_ms(self.audiotrack) ! def GetVideoDuration(self): ! if not self.videotrack: ! return 0 ! return self._gettrackduration_ms(self.videotrack) ! ! def GetAudioFormat(self): ! if not self.audiodescr: ! return None, None, None, None, None ! bps = self.audiodescr['sampleSize'] ! nch = self.audiodescr['numChannels'] ! if nch == 1: ! channels = ['mono'] ! elif nch == 2: ! channels = ['left', 'right'] ! else: ! channels = map(lambda x: str(x+1), range(nch)) ! if bps % 8: ! # Funny bits-per sample. We pretend not to understand ! blocksize = 0 ! fpb = 0 ! else: ! # QuickTime is easy (for as far as we support it): samples are always a whole ! # number of bytes, so frames are nchannels*samplesize, and there's one frame per block. ! blocksize = (bps/8)*nch ! fpb = 1 ! if self.audiodescr['dataFormat'] == 'raw ': ! encoding = 'linear-excess' ! elif self.audiodescr['dataFormat'] == 'twos': ! encoding = 'linear-signed' ! else: ! encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat'] ! ## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', ! ## channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps) ! return channels, encoding, blocksize, fpb, bps ! ! def GetAudioFrameRate(self): ! if not self.audiodescr: ! return None ! return int(self.audiodescr['sampleRate']) ! ! def GetVideoFormat(self): ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb) ! ! def GetVideoFrameRate(self): ! tv = self.videocurtime ! if tv == None: ! tv = 0 ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) ! dur = self._videotime_to_ms(dur) ! return int((1000.0/dur)+0.5) ! ! def ReadAudio(self, nframes, time=None): ! if not time is None: ! self.audiocurtime = time ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! if self.audiocurtime == None: ! self.audiocurtime = 0 ! tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0) ! if tv < 0 or (self.audiocurtime and tv < self.audiocurtime): ! return self._audiotime_to_ms(self.audiocurtime), None ! h = Res.Handle('') ! desc_h = Res.Handle('') ! size, actualtime, sampleduration, desc_index, actualcount, flags = \ ! self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes) ! self.audiocurtime = actualtime + actualcount*sampleduration ! return self._audiotime_to_ms(actualtime), h.data ! ! def ReadVideo(self, time=None): ! if not time is None: ! self.videocurtime = time ! flags = QuickTime.nextTimeStep ! if self.videocurtime == None: ! flags = flags | QuickTime.nextTimeEdgeOK ! self.videocurtime = 0 ! tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0) ! if tv < 0 or (self.videocurtime and tv <= self.videocurtime): ! return self._videotime_to_ms(self.videocurtime), None ! self.videocurtime = tv ! moviecurtime = self._videotime_to_movietime(self.videocurtime) ! self.movie.SetMovieTimeValue(moviecurtime) ! self.movie.MoviesTask(0) ! return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent() ! ! def _getpixmapcontent(self): ! """Shuffle the offscreen PixMap data, because it may have funny stride values""" ! rowbytes = Qdoffs.GetPixRowBytes(self.pixmap) ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! start = 0 ! rv = '' ! for i in range(height): ! nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) ! start = start + rowbytes ! rv = rv + nextline ! return rv def reader(url): ! try: ! rdr = _Reader(url) ! except IOError: ! return None ! return rdr def _test(): ! import EasyDialogs ! try: ! import img ! except ImportError: ! img = None ! import MacOS ! Qt.EnterMovies() ! path = EasyDialogs.AskFileForOpen(message='Video to convert') ! if not path: sys.exit(0) ! rdr = reader(path) ! if not rdr: ! sys.exit(1) ! dstdir = EasyDialogs.AskFileForSave(message='Name for output folder') ! if not dstdir: sys.exit(0) ! num = 0 ! os.mkdir(dstdir) ! videofmt = rdr.GetVideoFormat() ! imgfmt = videofmt.getformat() ! imgw, imgh = videofmt.getsize() ! timestamp, data = rdr.ReadVideo() ! while data: ! fname = 'frame%04.4d.jpg'%num ! num = num+1 ! pname = os.path.join(dstdir, fname) ! if not img: print 'Not', ! print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) ! if img: ! wrt = img.writer(imgfmt, pname) ! wrt.width = imgw ! wrt.height = imgh ! wrt.write(data) ! timestamp, data = rdr.ReadVideo() ! MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') ! if num > 20: ! print 'stopping at 20 frames so your disk does not fill up:-)' ! break ! print 'Total frames:', num ! if __name__ == '__main__': ! _test() ! sys.exit(1) ! --- 14,292 ---- from Carbon import Res try: ! import MediaDescr except ImportError: ! def _audiodescr(data): ! return None else: ! def _audiodescr(data): ! return MediaDescr.SoundDescription.decode(data) try: ! from imgformat import macrgb except ImportError: ! macrgb = "Macintosh RGB format" import os # import audio.format class VideoFormat: ! def __init__(self, name, descr, width, height, format): ! self.__name = name ! self.__descr = descr ! self.__width = width ! self.__height = height ! self.__format = format ! ! def getname(self): ! return self.__name ! ! def getdescr(self): ! return self.__descr ! ! def getsize(self): ! return self.__width, self.__height ! ! def getformat(self): ! return self.__format ! class _Reader: ! def __init__(self, path): ! fd = Qt.OpenMovieFile(path, 0) ! self.movie, d1, d2 = Qt.NewMovieFromFile(fd, 0, 0) ! self.movietimescale = self.movie.GetMovieTimeScale() ! try: ! self.audiotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.AudioMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.audiomedia = self.audiotrack.GetTrackMedia() ! except Qt.Error: ! self.audiotrack = self.audiomedia = None ! self.audiodescr = {} ! else: ! handle = Res.Handle('') ! n = self.audiomedia.GetMediaSampleDescriptionCount() ! self.audiomedia.GetMediaSampleDescription(1, handle) ! self.audiodescr = _audiodescr(handle.data) ! self.audiotimescale = self.audiomedia.GetMediaTimeScale() ! del handle ! ! try: ! self.videotrack = self.movie.GetMovieIndTrackType(1, ! QuickTime.VisualMediaCharacteristic, QuickTime.movieTrackCharacteristic) ! self.videomedia = self.videotrack.GetTrackMedia() ! except Qt.Error: ! self.videotrack = self.videomedia = self.videotimescale = None ! if self.videotrack: ! self.videotimescale = self.videomedia.GetMediaTimeScale() ! x0, y0, x1, y1 = self.movie.GetMovieBox() ! self.videodescr = {'width':(x1-x0), 'height':(y1-y0)} ! self._initgworld() ! self.videocurtime = None ! self.audiocurtime = None ! ! def __del__(self): ! self.audiomedia = None ! self.audiotrack = None ! self.videomedia = None ! self.videotrack = None ! self.movie = None ! ! def _initgworld(self): ! old_port, old_dev = Qdoffs.GetGWorld() ! try: ! movie_w = self.videodescr['width'] ! movie_h = self.videodescr['height'] ! movie_rect = (0, 0, movie_w, movie_h) ! self.gworld = Qdoffs.NewGWorld(32, movie_rect, None, None, QDOffscreen.keepLocal) ! self.pixmap = self.gworld.GetGWorldPixMap() ! Qdoffs.LockPixels(self.pixmap) ! Qdoffs.SetGWorld(self.gworld.as_GrafPtr(), None) ! Qd.EraseRect(movie_rect) ! self.movie.SetMovieGWorld(self.gworld.as_GrafPtr(), None) ! self.movie.SetMovieBox(movie_rect) ! self.movie.SetMovieActive(1) ! self.movie.MoviesTask(0) ! self.movie.SetMoviePlayHints(QuickTime.hintsHighQuality, QuickTime.hintsHighQuality) ! # XXXX framerate ! finally: ! Qdoffs.SetGWorld(old_port, old_dev) ! ! def _gettrackduration_ms(self, track): ! tracktime = track.GetTrackDuration() ! return self._movietime_to_ms(tracktime) ! ! def _movietime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.movietimescale, None), 1000) ! return value ! ! def _videotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), 1000) ! return value ! ! def _audiotime_to_ms(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.audiotimescale, None), 1000) ! return value ! ! def _videotime_to_movietime(self, time): ! value, d1, d2 = Qt.ConvertTimeScale((time, self.videotimescale, None), ! self.movietimescale) ! return value ! ! def HasAudio(self): ! return not self.audiotrack is None ! ! def HasVideo(self): ! return not self.videotrack is None ! ! def GetAudioDuration(self): ! if not self.audiotrack: ! return 0 ! return self._gettrackduration_ms(self.audiotrack) ! def GetVideoDuration(self): ! if not self.videotrack: ! return 0 ! return self._gettrackduration_ms(self.videotrack) ! ! def GetAudioFormat(self): ! if not self.audiodescr: ! return None, None, None, None, None ! bps = self.audiodescr['sampleSize'] ! nch = self.audiodescr['numChannels'] ! if nch == 1: ! channels = ['mono'] ! elif nch == 2: ! channels = ['left', 'right'] ! else: ! channels = map(lambda x: str(x+1), range(nch)) ! if bps % 8: ! # Funny bits-per sample. We pretend not to understand ! blocksize = 0 ! fpb = 0 ! else: ! # QuickTime is easy (for as far as we support it): samples are always a whole ! # number of bytes, so frames are nchannels*samplesize, and there's one frame per block. ! blocksize = (bps/8)*nch ! fpb = 1 ! if self.audiodescr['dataFormat'] == 'raw ': ! encoding = 'linear-excess' ! elif self.audiodescr['dataFormat'] == 'twos': ! encoding = 'linear-signed' ! else: ! encoding = 'quicktime-coding-%s'%self.audiodescr['dataFormat'] ! ## return audio.format.AudioFormatLinear('quicktime_audio', 'QuickTime Audio Format', ! ## channels, encoding, blocksize=blocksize, fpb=fpb, bps=bps) ! return channels, encoding, blocksize, fpb, bps ! ! def GetAudioFrameRate(self): ! if not self.audiodescr: ! return None ! return int(self.audiodescr['sampleRate']) ! ! def GetVideoFormat(self): ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! return VideoFormat('dummy_format', 'Dummy Video Format', width, height, macrgb) ! ! def GetVideoFrameRate(self): ! tv = self.videocurtime ! if tv == None: ! tv = 0 ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) ! dur = self._videotime_to_ms(dur) ! return int((1000.0/dur)+0.5) ! ! def ReadAudio(self, nframes, time=None): ! if not time is None: ! self.audiocurtime = time ! flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK ! if self.audiocurtime == None: ! self.audiocurtime = 0 ! tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0) ! if tv < 0 or (self.audiocurtime and tv < self.audiocurtime): ! return self._audiotime_to_ms(self.audiocurtime), None ! h = Res.Handle('') ! desc_h = Res.Handle('') ! size, actualtime, sampleduration, desc_index, actualcount, flags = \ ! self.audiomedia.GetMediaSample(h, 0, tv, desc_h, nframes) ! self.audiocurtime = actualtime + actualcount*sampleduration ! return self._audiotime_to_ms(actualtime), h.data ! ! def ReadVideo(self, time=None): ! if not time is None: ! self.videocurtime = time ! flags = QuickTime.nextTimeStep ! if self.videocurtime == None: ! flags = flags | QuickTime.nextTimeEdgeOK ! self.videocurtime = 0 ! tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0) ! if tv < 0 or (self.videocurtime and tv <= self.videocurtime): ! return self._videotime_to_ms(self.videocurtime), None ! self.videocurtime = tv ! moviecurtime = self._videotime_to_movietime(self.videocurtime) ! self.movie.SetMovieTimeValue(moviecurtime) ! self.movie.MoviesTask(0) ! return self._videotime_to_ms(self.videocurtime), self._getpixmapcontent() ! ! def _getpixmapcontent(self): ! """Shuffle the offscreen PixMap data, because it may have funny stride values""" ! rowbytes = Qdoffs.GetPixRowBytes(self.pixmap) ! width = self.videodescr['width'] ! height = self.videodescr['height'] ! start = 0 ! rv = '' ! for i in range(height): ! nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) ! start = start + rowbytes ! rv = rv + nextline ! return rv def reader(url): ! try: ! rdr = _Reader(url) ! except IOError: ! return None ! return rdr def _test(): ! import EasyDialogs ! try: ! import img ! except ImportError: ! img = None ! import MacOS ! Qt.EnterMovies() ! path = EasyDialogs.AskFileForOpen(message='Video to convert') ! if not path: sys.exit(0) ! rdr = reader(path) ! if not rdr: ! sys.exit(1) ! dstdir = EasyDialogs.AskFileForSave(message='Name for output folder') ! if not dstdir: sys.exit(0) ! num = 0 ! os.mkdir(dstdir) ! videofmt = rdr.GetVideoFormat() ! imgfmt = videofmt.getformat() ! imgw, imgh = videofmt.getsize() ! timestamp, data = rdr.ReadVideo() ! while data: ! fname = 'frame%04.4d.jpg'%num ! num = num+1 ! pname = os.path.join(dstdir, fname) ! if not img: print 'Not', ! print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) ! if img: ! wrt = img.writer(imgfmt, pname) ! wrt.width = imgw ! wrt.height = imgh ! wrt.write(data) ! timestamp, data = rdr.ReadVideo() ! MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') ! if num > 20: ! print 'stopping at 20 frames so your disk does not fill up:-)' ! break ! print 'Total frames:', num ! if __name__ == '__main__': ! _test() ! sys.exit(1) ! From jackjansen@users.sourceforge.net Wed Apr 9 16:12:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 09 Apr 2003 08:12:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac using.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv9666 Modified Files: using.tex Log Message: Created a minimal MacOSX section. Index: using.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/using.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** using.tex 12 Feb 2003 09:58:33 -0000 1.6 --- using.tex 9 Apr 2003 15:12:38 -0000 1.7 *************** *** 2,19 **** \sectionauthor{Bob Savage}{bobsavage@mac.com} ! Using Python on a Mac OS 9 Macintosh can seem like something completely different than using it on a \UNIX-like or Windows system. Most of the ! Python documentation, both the ``official'' documentation and ! published books, describe only how Python is used on these systems, ! causing confusion for the new user of MacPython-OS9. This chapter gives a ! brief introduction to the specifics of using Python on a Macintosh. - Note that this chapter is mainly relevant to Mac OS 9: MacPython-OSX - is a superset of a normal unix Python. While MacPython-OS9 runs fine - on Mac OS X it is a better choice to use MacPython-OSX there. The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX too. \section{Getting and Installing MacPython-OS9 \label{getting}} --- 2,99 ---- \sectionauthor{Bob Savage}{bobsavage@mac.com} ! Using Python on a Macintosh, especially on Mac OS 9 (MacPython-OSX ! includes a complete unix Python) can seem like something completely different than using it on a \UNIX-like or Windows system. Most of the ! Python documentation, both the ``official'' documentation and published ! books, describe only how Python is used on these systems, causing ! confusion for the new user of MacPython-OS9. This chapter gives a brief ! introduction to the specifics of using Python on a Macintosh. The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX too. + \section{Getting and Installing MacPython-OSX \label{getting-OSX}} + + As of Python 2.3a2 the only sure way of getting MacPython-OSX on your machine + is getting a source distribution and building what is called a "framework Python". + The details are in the file \file{Mac/OSX/README}. + + As binary installers become available the details will be posted to + \url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. + + + What you get after installing is a number of things: + + \begin{itemize} + \item A \file{MacPython-2.3} folder in your \file{Applications} + folder. In here you find the PythonIDE Integrated Development Environment; + PythonLauncher, which handles double-clicking Python scripts from the Finder; and + the Package Manager. + + \item A fairly standard unix commandline Python interpreter in + \file{/usr/local/bin/python}, but without the usual \file{/usr/local/lib/python}. + + \item A framework \file{/Library/Frameworks/Python.framework}, where + all the action really is, but which you usually do not have to be aware of. + \end{itemize} + + To uninstall MacPython you can simply remove these three things. + + PythonIDE contains an Apple Help Viewer book called "MacPython Help" + which you can access through its help menu. If you are completely new to + Python you should start reading the IDE introduction in that document. + + If you are familiar with Python on other unix platforms you should read the + section on running Python scripts from the unix shell. + + \subsection{How to run a Python script} + + Your best way to get started with Python on Mac OS X is through the PythonIDE + integrated development environment, see section \ref{IDE} and use the Help + menu when the IDE is running. + + If you want to run Python scripts from the Terminal window command line + or from the Finder you first need an editor to create your script. + Mac OS X comes with a number of standard unix command line editors, + \program{vi} and \program{emacs} among them. If you want a more Mac-like + editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software + (see \url{http://www.barebones.com}) are good choices. Their freeware + \program{BBEdit Lite} is officially discontinued but still available. + \program{AppleWorks} or any other word processor that can save files + in ASCII is also a possibility, but \program{TextEdit} is not: it saves in .rtf + format only. + + To run your script from the Terminal window you must make sure that + \file{/usr/local/bin} is in your shell search path before \file{/usr/bin}, + where the Apple-supplied Python lives (which is version 2.2, as of Mac OS X + 10.2.4). There is one Mac OS X quirk that you need to be aware of: programs + that talk to the window manager (in other words, anything that has a GUI) + need to be run in a special way. Use \program{pythonw} in stead of \program{python} + to start such scripts. + + To run your script from the Finder you have two options: + \begin{itemize} + \item Drag it to \program{PythonLauncher} + \item Select \program{PythonLauncher} as the default application + to open your script (or any .py script) through the finder Info window + and double-click it. + \end{itemize} + + PythonLauncher has various preferences to control how your script is launched. + Option-dragging allows you to change these for one invocation, or use its + Preferences menu to change things globally. + + \subsection{configuration} + + MacPython honours all standard unix environment variables such as \envvar{PYTHONPATH}, + but setting these variables for programs started from the Finder is non-standard + as the Finder does not read your \file{.profile} or \file{.cshrc} at startup. + You need to create a file \file{\textasciitilde /.MacOSX/environment.plist}. + See Apple's Technical Document QA1067 for details. + + Installing additional Python packages is most easily done through the + Package Manager, see the MacPython Help Book for details. + \section{Getting and Installing MacPython-OS9 \label{getting}} *************** *** 22,31 **** Jansen: \url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. - Please refer to the \file{README} included with your distribution for the most up-to-date instructions. ! \section{Entering the interactive Interpreter \label{interpreter}} --- 102,115 ---- Jansen: \url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. Please refer to the \file{README} included with your distribution for the most up-to-date instructions. + Note that MacPython-OS9 runs fine on Mac OS X, and it runs in native + mode, not in the Classic environment. Unless you have specific + requirements for a CFM-based Python there is no reason not to + use MacPython-OSX, though. ! ! \subsection{Entering the interactive Interpreter \label{interpreter}} *************** *** 38,42 **** ! \section{How to run a Python script} There are several ways to run an existing Python script; two common --- 122,126 ---- ! \subsection{How to run a Python script} There are several ways to run an existing Python script; two common *************** *** 46,50 **** ! \subsection{Drag and drop} One of the easiest ways to launch a Python script is via ``Drag and --- 130,134 ---- ! \subsubsection{Drag and drop} One of the easiest ways to launch a Python script is via ``Drag and *************** *** 75,79 **** ! \subsection{Set Creator and Double Click \label{creator-code}} If the script that you want to launch has the appropriate Creator Code --- 159,163 ---- ! \subsubsection{Set Creator and Double Click \label{creator-code}} If the script that you want to launch has the appropriate Creator Code *************** *** 112,116 **** ! \section{Simulating command line arguments \label{argv}} --- 196,200 ---- ! \subsection{Simulating command line arguments \label{argv}} *************** *** 140,144 **** ! \section{Creating a Python script} Since Python scripts are simply text files, they can be created in any --- 224,228 ---- ! \subsection{Creating a Python script} Since Python scripts are simply text files, they can be created in any *************** *** 147,151 **** ! \subsection{In an editor} You can create a text file with any word processing program such as --- 231,235 ---- ! \subsubsection{In an editor} You can create a text file with any word processing program such as *************** *** 191,194 **** --- 275,354 ---- % **NEED INFO HERE** + \subsection{Configuration \label{configuration}} + + The MacPython distribution comes with \program{EditPythonPrefs}, an + applet which will help you to customize the MacPython environment for + your working habits. + + \subsubsection{EditPythonPrefs\label{EditPythonPrefs}} + + \program{EditPythonPrefs} gives you the capability to configure Python + to behave the way you want it to. There are two ways to use + \program{EditPythonPrefs}, you can use it to set the preferences in + general, or you can drop a particular Python engine onto it to + customize only that version. The latter can be handy if, for example, + you want to have a second copy of the \program{PythonInterpreter} that + keeps the output window open on a normal exit even though you prefer + to normally not work that way. + + To change the default preferences, simply double-click on + \program{EditPythonPrefs}. To change the preferences only for one copy + of the Interpreter, drop the icon for that copy onto + \program{EditPythonPrefs}. You can also use \program{EditPythonPrefs} + in this fashion to set the preferences of the \program{Python IDE} and + any applets you create -- see section %s \ref{BuildApplet} and + \ref{IDEapplet}. + + \subsubsection{Adding modules to the Module Search Path + \label{search-path}} + + When executing an \keyword{import} statement, Python looks for modules + in places defined by the \member{sys.path} To edit the + \member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and + enter them into the largish field at the top (one per line). + + Since MacPython defines a main Python directory, the easiest thing is + to add folders to search within the main Python directory. To add a + folder of scripts that you created called ``My Folder'' located in the + main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line. + + To add the Desktop under OS 9 or below, add + \samp{StartupDriveName:Desktop Folder} on a new line. + + \subsubsection{Default startup options \label{defaults}} + + % I'm assuming that there exists some other documentation on the + % rest of the options so I only go over a couple here. + + The ``Default startup options...'' button in the + \program{EditPythonPrefs} dialog box gives you many options including + the ability to keep the ``Output'' window open after the script + terminates, and the ability to enter interactive mode after the + termination of the run script. The latter can be very helpful if you + want to examine the objects that were created during your script. + + %\section{Nifty Tools} + %There are many other tools included with the MacPython + %distribution. In addition to those discussed here, make + %sure to check the \file{Mac} directory. + + %\subsection{BuildApplet \label{BuildApplet}} + % **NEED INFO HERE** + + %\subsection{BuildApplication} + % **NEED INFO HERE** + + %\section{TKInter on the Mac \label{TKInter}} + + %TKinter is installed by default with the MacPython distribution, but + %you may need to add the \file{lib-tk} folder to the Python Path (see + %section \ref{search-path}). Also, it is important that you do not + %try to launch Tk from within the \program{Python IDE} because the two + %event loops will collide -- always run a script which uses Tkinter + %with the \program{PythonInterpreter} instead -- see section + %\ref{interpreter}. + + %\section{CGI on the Mac with Python \label{CGI}} + %**NEED INFO HERE** \section{The IDE\label{IDE}} *************** *** 283,360 **** % **NEED INFO HERE** - \section{Configuration \label{configuration}} - - The MacPython distribution comes with \program{EditPythonPrefs}, an - applet which will help you to customize the MacPython environment for - your working habits. - - \subsection{EditPythonPrefs\label{EditPythonPrefs}} - - \program{EditPythonPrefs} gives you the capability to configure Python - to behave the way you want it to. There are two ways to use - \program{EditPythonPrefs}, you can use it to set the preferences in - general, or you can drop a particular Python engine onto it to - customize only that version. The latter can be handy if, for example, - you want to have a second copy of the \program{PythonInterpreter} that - keeps the output window open on a normal exit even though you prefer - to normally not work that way. - - To change the default preferences, simply double-click on - \program{EditPythonPrefs}. To change the preferences only for one copy - of the Interpreter, drop the icon for that copy onto - \program{EditPythonPrefs}. You can also use \program{EditPythonPrefs} - in this fashion to set the preferences of the \program{Python IDE} and - any applets you create -- see section %s \ref{BuildApplet} and - \ref{IDEapplet}. - - \subsection{Adding modules to the Module Search Path - \label{search-path}} - - When executing an \keyword{import} statement, Python looks for modules - in places defined by the \member{sys.path} To edit the - \member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and - enter them into the largish field at the top (one per line). - - Since MacPython defines a main Python directory, the easiest thing is - to add folders to search within the main Python directory. To add a - folder of scripts that you created called ``My Folder'' located in the - main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line. - - To add the Desktop under OS 9 or below, add - \samp{StartupDriveName:Desktop Folder} on a new line. - - \subsection{Default startup options \label{defaults}} - - % I'm assuming that there exists some other documentation on the - % rest of the options so I only go over a couple here. - - The ``Default startup options...'' button in the - \program{EditPythonPrefs} dialog box gives you many options including - the ability to keep the ``Output'' window open after the script - terminates, and the ability to enter interactive mode after the - termination of the run script. The latter can be very helpful if you - want to examine the objects that were created during your script. - - %\section{Nifty Tools} - %There are many other tools included with the MacPython - %distribution. In addition to those discussed here, make - %sure to check the \file{Mac} directory. - - %\subsection{BuildApplet \label{BuildApplet}} - % **NEED INFO HERE** - - %\subsection{BuildApplication} - % **NEED INFO HERE** - - %\section{TKInter on the Mac \label{TKInter}} - - %TKinter is installed by default with the MacPython distribution, but - %you may need to add the \file{lib-tk} folder to the Python Path (see - %section \ref{search-path}). Also, it is important that you do not - %try to launch Tk from within the \program{Python IDE} because the two - %event loops will collide -- always run a script which uses Tkinter - %with the \program{PythonInterpreter} instead -- see section - %\ref{interpreter}. - - %\section{CGI on the Mac with Python \label{CGI}} - %**NEED INFO HERE** --- 443,444 ---- From jlt63@users.sourceforge.net Wed Apr 9 17:04:01 2003 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Wed, 09 Apr 2003 09:04:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv31414 Modified Files: cygwinccompiler.py Log Message: Patch #709178: remove -static option from cygwinccompiler Currently, the cygwinccompiler.py compiler handling in distutils is invoking the cygwin and mingw compilers with the -static option. Logically, this means that the linker should choose to link to static libraries instead of shared/dynamically linked libraries. Current win32 binutils expect import libraries to have a .dll.a suffix and static libraries to have .a suffix. If -static is passed, it will skip the .dll.a libraries. This is pain if one has a tree with both static and dynamic libraries using this naming convention, and wish to use the dynamic libraries. The -static option being passed in distutils is to get around a bug in old versions of binutils where it would get confused when it found the DLLs themselves. The decision to use static or shared libraries is site or package specific, and should be left to the setup script or to command line options. Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** cygwinccompiler.py 19 Nov 2002 13:12:27 -0000 1.21 --- cygwinccompiler.py 9 Apr 2003 16:03:57 -0000 1.22 *************** *** 34,43 **** # - its dllwrap doesn't work, there is a bug in binutils 2.10.90 # see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html - # - using gcc -mdll instead dllwrap doesn't work without -static because - # it tries to link against dlls instead their import libraries. (If - # it finds the dll first.) - # By specifying -static we force ld to link against the import libraries, - # this is windows standard and there are normally not the necessary symbols - # in the dlls. # *** only the version of June 2000 shows these problems --- 34,37 ---- *************** *** 99,103 **** compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', ! linker_so=('%s -mcygwin -mdll -static' % self.linker_dll)) --- 93,97 ---- compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', ! linker_so=('%s -mcygwin -mdll' % self.linker_dll)) *************** *** 279,283 **** compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', ! linker_so='%s -mno-cygwin -mdll -static %s' % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished --- 273,277 ---- compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', ! linker_so='%s -mno-cygwin -mdll %s' % (self.linker_dll, entry_point)) # Maybe we should also append -mthreads, but then the finished From gvanrossum@users.sourceforge.net Wed Apr 9 18:05:40 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:05:40 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25501 Modified Files: descrobject.c Log Message: property_traverse() should also traverse into prop_doc -- there's no typecheck that guarantees it's a string, and BTW string subclasses could hide references. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** descrobject.c 11 Feb 2003 18:44:39 -0000 2.34 --- descrobject.c 9 Apr 2003 17:05:33 -0000 2.35 *************** *** 1202,1205 **** --- 1202,1206 ---- VISIT(prop_set); VISIT(prop_del); + VISIT(prop_doc); return 0; From gvanrossum@users.sourceforge.net Wed Apr 9 18:06:35 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:06:35 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.22,2.22.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26156 Modified Files: Tag: release22-maint descrobject.c Log Message: Backport from trunk: property_traverse() should also traverse into prop_doc -- there's no typecheck that guarantees it's a string, and BTW string subclasses could hide references. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.22 retrieving revision 2.22.4.1 diff -C2 -d -r2.22 -r2.22.4.1 *** descrobject.c 15 Dec 2001 05:00:30 -0000 2.22 --- descrobject.c 9 Apr 2003 17:06:31 -0000 2.22.4.1 *************** *** 1062,1065 **** --- 1062,1066 ---- VISIT(prop_set); VISIT(prop_del); + VISIT(prop_doc); return 0; From akuchling@users.sourceforge.net Wed Apr 9 18:26:41 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:26:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv4774 Modified Files: whatsnew23.tex Log Message: Re-indent example; fix typo Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** whatsnew23.tex 21 Mar 2003 18:32:43 -0000 1.133 --- whatsnew23.tex 9 Apr 2003 17:26:38 -0000 1.134 *************** *** 739,744 **** } ! if ( hasattr(core, 'setup_keywords') and ! 'classifiers' in core.setup_keywords): kw['classifiers'] = \ ['Topic :: Internet :: WWW/HTTP :: Dynamic Content', --- 739,744 ---- } ! if (hasattr(core, 'setup_keywords') and ! 'classifiers' in core.setup_keywords): kw['classifiers'] = \ ['Topic :: Internet :: WWW/HTTP :: Dynamic Content', *************** *** 889,893 **** The \module{pickle} and \module{cPickle} modules received some attention during the 2.3 development cycle. In 2.2, new-style classes ! could be pickled without difficult, but they weren't pickled very compactly; \pep{307} quotes a trivial example where a new-style class results in a pickled string three times longer than that for a classic --- 889,893 ---- The \module{pickle} and \module{cPickle} modules received some attention during the 2.3 development cycle. In 2.2, new-style classes ! could be pickled without difficulty, but they weren't pickled very compactly; \pep{307} quotes a trivial example where a new-style class results in a pickled string three times longer than that for a classic *************** *** 2253,2257 **** The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Simon Brunning, Michael Chermside, Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo --- 2253,2257 ---- The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Jeff Bauer, Simon Brunning, Michael Chermside, Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo From gvanrossum@users.sourceforge.net Wed Apr 9 18:53:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 10:53:25 -0700 Subject: [Python-checkins] python/dist/src/Modules parsermodule.c,2.78,2.79 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16531 Modified Files: parsermodule.c Log Message: Don't use (PyObject *)PyObject_Type(x). It is a leaky and verbose way of saying x->ob_type. Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -d -r2.78 -r2.79 *** parsermodule.c 10 Feb 2003 01:08:50 -0000 2.78 --- parsermodule.c 9 Apr 2003 17:53:22 -0000 2.79 *************** *** 682,686 **** "second item in terminal node must be a string," " found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(temp); return 0; --- 682,686 ---- "second item in terminal node must be a string," " found %s", ! temp->ob_type->tp_name); Py_DECREF(temp); return 0; *************** *** 695,699 **** "third item in terminal node must be an" " integer, found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(o); Py_DECREF(temp); --- 695,699 ---- "third item in terminal node must be an" " integer, found %s", ! temp->ob_type->tp_name); Py_DECREF(o); Py_DECREF(temp); From gvanrossum@users.sourceforge.net Wed Apr 9 19:02:27 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:02:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv20455 Modified Files: abstract.tex Log Message: Try to discourage use of PyObject_Type(). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** abstract.tex 25 Jan 2003 07:48:13 -0000 1.23 --- abstract.tex 9 Apr 2003 18:02:23 -0000 1.24 *************** *** 320,323 **** --- 320,328 ---- \exception{SystemError} and returns \NULL. This is equivalent to the Python expression \code{type(\var{o})}. + This function increments the reference count of the return value. + There's really no reason to use this function instead of the + common expression \code{\var{o}->ob_type}, which returns a pointer + of type \code{PyTypeObject *}, except when the incremented reference + count is needed. \bifuncindex{type} \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 9 19:16:01 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:16:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv26979 Modified Files: abstract.tex Log Message: Minor markup adjustments. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** abstract.tex 9 Apr 2003 18:02:23 -0000 1.24 --- abstract.tex 9 Apr 2003 18:15:57 -0000 1.25 *************** *** 319,329 **** the object type of object \var{o}. On failure, raises \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}. This function increments the reference count of the return value. There's really no reason to use this function instead of the common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \code{PyTypeObject *}, except when the incremented reference count is needed. - \bifuncindex{type} \end{cfuncdesc} --- 319,328 ---- the object type of object \var{o}. On failure, raises \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}.\bifuncindex{type} This function increments the reference count of the return value. There's really no reason to use this function instead of the common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \ctype{PyTypeObject*}, except when the incremented reference count is needed. \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 9 19:17:20 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:17:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.8.6.8,1.8.6.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv27605 Modified Files: Tag: release22-maint abstract.tex Log Message: Backport comments about PyObject_Type() (HEAD revisions 1.24, 1.25). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.8.6.8 retrieving revision 1.8.6.9 diff -C2 -d -r1.8.6.8 -r1.8.6.9 *** abstract.tex 6 Dec 2002 10:17:35 -0000 1.8.6.8 --- abstract.tex 9 Apr 2003 18:17:18 -0000 1.8.6.9 *************** *** 297,303 **** When \var{o} is non-\NULL, returns a type object corresponding to the object type of object \var{o}. On failure, raises ! \exception{SystemError} and returns \NULL. This is equivalent to ! the Python expression \code{type(\var{o})}. ! \bifuncindex{type} \end{cfuncdesc} --- 297,307 ---- When \var{o} is non-\NULL, returns a type object corresponding to the object type of object \var{o}. On failure, raises ! \exception{SystemError} and returns \NULL.\bifuncindex{type} ! This is equivalent to the Python expression \code{type(\var{o})}. ! This function increments the reference count of the return value. ! There's really no reason to use this function instead of the ! common expression \code{\var{o}->ob_type}, which returns a pointer ! of type \ctype{PyTypeObject*}, except when the incremented reference ! count is needed. \end{cfuncdesc} From fdrake@users.sourceforge.net Wed Apr 9 19:19:28 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 09 Apr 2003 11:19:28 -0700 Subject: [Python-checkins] python/dist/src/Modules parsermodule.c,2.68.6.2,2.68.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28583 Modified Files: Tag: release22-maint parsermodule.c Log Message: Backport reference leak fix from HEAD revision 1.79. Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.68.6.2 retrieving revision 2.68.6.3 diff -C2 -d -r2.68.6.2 -r2.68.6.3 *** parsermodule.c 10 Feb 2003 01:57:51 -0000 2.68.6.2 --- parsermodule.c 9 Apr 2003 18:19:24 -0000 2.68.6.3 *************** *** 682,686 **** "second item in terminal node must be a string," " found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(temp); return 0; --- 682,686 ---- "second item in terminal node must be a string," " found %s", ! temp->ob_type->tp_name); Py_DECREF(temp); return 0; *************** *** 695,699 **** "third item in terminal node must be an" " integer, found %s", ! ((PyTypeObject*)PyObject_Type(temp))->tp_name); Py_DECREF(o); Py_DECREF(temp); --- 695,699 ---- "third item in terminal node must be an" " integer, found %s", ! temp->ob_type->tp_name); Py_DECREF(o); Py_DECREF(temp); From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:26 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:26 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Lib Modified Files: pdb.py Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** pdb.py 27 Feb 2003 20:14:37 -0000 1.62 --- pdb.py 9 Apr 2003 19:06:21 -0000 1.63 *************** *** 524,527 **** --- 524,554 ---- do_j = do_jump + def do_debug(self, arg): + sys.settrace(None) + globals = self.curframe.f_globals + locals = self.curframe.f_locals + p = Pdb() + p.prompt = "(%s) " % self.prompt.strip() + print "ENTERING RECURSIVE DEBUGGER" + sys.call_tracing(p.run, (arg, globals, locals)) + print "LEAVING RECURSIVE DEBUGGER" + sys.settrace(self.trace_dispatch) + self.lastcmd = p.lastcmd + + def dont_debug(self, arg): + locals = self.curframe.f_locals + globals = self.curframe.f_globals + try: + r = sys.call_tracing(eval, (arg, globals, locals)) + print "--- DEBUG RETURNED ---" + if r is not None: + print repr(r) + except: + t, v = sys.exc_info()[:2] + if type(t) == type(''): + exc_type_name = t + else: exc_type_name = t.__name__ + print '***', exc_type_name + ':', v + def do_quit(self, arg): self.set_quit() *************** *** 834,837 **** --- 861,870 ---- print """j(ump) lineno Set the next line that will be executed.""" + + def help_debug(self): + print """debug code + Enter a recursive debugger that steps through the code argument + (which is an arbitrary expression or statement to be executed + in the current environment).""" def help_list(self): From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.716,1.717 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Misc Modified Files: NEWS Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.716 retrieving revision 1.717 diff -C2 -d -r1.716 -r1.717 *** NEWS 8 Apr 2003 17:17:16 -0000 1.716 --- NEWS 9 Apr 2003 19:06:11 -0000 1.717 *************** *** 50,53 **** --- 50,56 ---- ----------------- + - New function sys.call_tracing() allows pdb to debug code + recursively. + - New function gc.get_referents(obj) returns a list of objects directly referenced by obj. In effect, it exposes what the object's *************** *** 86,89 **** --- 89,95 ---- Library ------- + + - pdb has a new command, "debug", which lets you step through + arbitrary code from the debugger's (pdb) prompt. - unittest.failUnlessEqual and its equivalent unittest.assertEqual now From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:49 -0700 Subject: [Python-checkins] python/dist/src/Include eval.h,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Include Modified Files: eval.h Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: eval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/eval.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** eval.h 12 Aug 2002 07:21:56 -0000 2.16 --- eval.h 9 Apr 2003 19:06:16 -0000 2.17 *************** *** 18,21 **** --- 18,23 ---- PyObject *closure); + PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); + #ifdef __cplusplus } From gvanrossum@users.sourceforge.net Wed Apr 9 20:06:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:06:54 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.357,2.358 sysmodule.c,2.116,2.117 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20970/Python Modified Files: ceval.c sysmodule.c Log Message: - New function sys.call_tracing() allows pdb to debug code recursively. - pdb has a new command, "debug", which lets you step through arbitrary code from the debugger's (pdb) prompt. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.357 retrieving revision 2.358 diff -C2 -d -r2.357 -r2.358 *** ceval.c 16 Mar 2003 20:14:44 -0000 2.357 --- ceval.c 9 Apr 2003 19:06:17 -0000 2.358 *************** *** 3025,3028 **** --- 3025,3046 ---- } + PyObject * + _PyEval_CallTracing(PyObject *func, PyObject *args) + { + PyFrameObject *frame = PyEval_GetFrame(); + PyThreadState *tstate = frame->f_tstate; + int save_tracing = tstate->tracing; + int save_use_tracing = tstate->use_tracing; + PyObject *result; + + tstate->tracing = 0; + tstate->use_tracing = ((tstate->c_tracefunc != NULL) + || (tstate->c_profilefunc != NULL)); + result = PyObject_Call(func, args, NULL); + tstate->tracing = save_tracing; + tstate->use_tracing = save_use_tracing; + return result; + } + static int maybe_call_line_trace(Py_tracefunc func, PyObject *obj, Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -d -r2.116 -r2.117 *** sysmodule.c 5 Mar 2003 15:13:47 -0000 2.116 --- sysmodule.c 9 Apr 2003 19:06:19 -0000 2.117 *************** *** 18,21 **** --- 18,22 ---- #include "compile.h" #include "frameobject.h" + #include "eval.h" #include "osdefs.h" *************** *** 610,613 **** --- 611,631 ---- } + PyDoc_STRVAR(call_tracing_doc, + "call_tracing(func, args) -> object\n\ + \n\ + Call func(*args), while tracing is enabled. The tracing state is\n\ + saved, and restored afterwards. This is intended to be called from\n\ + a debugger from a checkpoint, to recursively debug some other code." + ); + + static PyObject * + sys_call_tracing(PyObject *self, PyObject *args) + { + PyObject *func, *funcargs; + if (!PyArg_ParseTuple(args, "OO:call_tracing", &func, &funcargs)) + return NULL; + return _PyEval_CallTracing(func, funcargs); + } + PyDoc_STRVAR(callstats_doc, "callstats() -> tuple of integers\n\ *************** *** 701,704 **** --- 719,723 ---- setrecursionlimit_doc}, {"settrace", sys_settrace, METH_O, settrace_doc}, + {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, {NULL, NULL} /* sentinel */ }; From gvanrossum@users.sourceforge.net Wed Apr 9 20:10:51 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:10:51 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts byext.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv23373 Modified Files: byext.py Log Message: Various improvements to the way the table is formatted, to deal with exceptionally large totals etc. Index: byext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/byext.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** byext.py 1 Jan 2003 14:41:25 -0000 1.1 --- byext.py 9 Apr 2003 19:10:46 -0000 1.2 *************** *** 31,34 **** --- 31,38 ---- names.sort() for name in names: + if name.startswith(".#"): + continue # Skip CVS temp files + if name.endswith("~"): + continue# Skip Emacs backup files full = os.path.join(dir, name) if os.path.islink(full): *************** *** 43,47 **** head, base = os.path.split(file) if ext == base: ! ext = "" # .cvsignore is deemed not to have an extension self.addstats(ext, "files", 1) try: --- 47,54 ---- head, base = os.path.split(file) if ext == base: ! ext = "" # E.g. .cvsignore is deemed not to have an extension ! ext = os.path.normcase(ext) ! if not ext: ! ext = "" self.addstats(ext, "files", 1) try: *************** *** 71,75 **** def report(self): - totals = {} exts = self.stats.keys() exts.sort() --- 78,81 ---- *************** *** 80,107 **** cols = columns.keys() cols.sort() ! minwidth = 7 ! extwidth = max([len(ext) for ext in exts]) ! print "%*s" % (extwidth, "ext"), for col in cols: ! width = max(len(col), minwidth) ! print "%*s" % (width, col), ! print ! for ext in exts: ! print "%*s" % (extwidth, ext), ! for col in cols: ! width = max(len(col), minwidth) value = self.stats[ext].get(col) if value is None: ! s = "" else: ! s = "%d" % value ! totals[col] = totals.get(col, 0) + value ! print "%*s" % (width, s), print ! print "%*s" % (extwidth, "TOTAL"), ! for col in cols: ! width = max(len(col), minwidth) ! print "%*s" % (width, totals[col]), ! print def main(): --- 86,122 ---- cols = columns.keys() cols.sort() ! colwidth = {} ! colwidth["ext"] = max([len(ext) for ext in exts]) ! minwidth = 6 ! self.stats["TOTAL"] = {} for col in cols: ! total = 0 ! cw = max(minwidth, len(col)) ! for ext in exts: value = self.stats[ext].get(col) if value is None: ! w = 0 else: ! w = len("%d" % value) ! total += value ! cw = max(cw, w) ! cw = max(cw, len(str(total))) ! colwidth[col] = cw ! self.stats["TOTAL"][col] = total ! exts.append("TOTAL") ! for ext in exts: ! self.stats[ext]["ext"] = ext ! cols.insert(0, "ext") ! def printheader(): ! for col in cols: ! print "%*s" % (colwidth[col], col), print ! printheader() ! for ext in exts: ! for col in cols: ! value = self.stats[ext].get(col, "") ! print "%*s" % (colwidth[col], value), ! print ! printheader() # Another header at the bottom def main(): From gvanrossum@users.sourceforge.net Wed Apr 9 20:31:06 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:31:06 -0700 Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c,2.43,2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv32370 Modified Files: mmapmodule.c Log Message: Fix two crashes on Windows: - CHECK_VALID() was checking the wrong value for a closed fd - fseek(&_iob[fileno], ...) doesn't work for fileno >= 20 Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** mmapmodule.c 7 Feb 2003 19:44:56 -0000 2.43 --- mmapmodule.c 9 Apr 2003 19:31:02 -0000 2.44 *************** *** 155,159 **** #define CHECK_VALID(err) \ do { \ ! if (!self->map_handle) { \ PyErr_SetString (PyExc_ValueError, "mmap closed or invalid"); \ return err; \ --- 155,159 ---- #define CHECK_VALID(err) \ do { \ ! if (self->map_handle == INVALID_HANDLE_VALUE) { \ PyErr_SetString (PyExc_ValueError, "mmap closed or invalid"); \ return err; \ *************** *** 975,979 **** } /* Win9x appears to need us seeked to zero */ ! fseek(&_iob[fileno], 0, SEEK_SET); } --- 975,979 ---- } /* Win9x appears to need us seeked to zero */ ! lseek(fileno, 0, SEEK_SET); } From gvanrossum@users.sourceforge.net Wed Apr 9 20:32:02 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:32:02 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.206,2.207 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv323 Modified Files: stringobject.c Log Message: Reformat a few docstrings that caused line wraps in help() output. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.206 retrieving revision 2.207 diff -C2 -d -r2.206 -r2.207 *** stringobject.c 31 Mar 2003 18:07:42 -0000 2.206 --- stringobject.c 9 Apr 2003 19:31:57 -0000 2.207 *************** *** 2382,2388 **** "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 2382,2388 ---- "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * *************** *** 2433,2439 **** "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 2433,2439 ---- "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * From gvanrossum@users.sourceforge.net Wed Apr 9 20:32:53 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:32:53 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.185,2.186 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv738 Modified Files: unicodeobject.c Log Message: Reformat a few docstrings that caused line wraps in help() output. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** unicodeobject.c 2 Apr 2003 16:37:23 -0000 2.185 --- unicodeobject.c 9 Apr 2003 19:32:45 -0000 2.186 *************** *** 5694,5700 **** "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 5694,5700 ---- "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * *************** *** 5725,5731 **** "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise. With\n\ ! optional start, test S beginning at that position. With optional end, stop\n\ ! comparing S at that position."); static PyObject * --- 5725,5731 ---- "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise.\n\ ! With optional start, test S beginning at that position.\n\ ! With optional end, stop comparing S at that position."); static PyObject * From gvanrossum@users.sourceforge.net Wed Apr 9 20:35:20 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:35:20 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv1816 Modified Files: classobject.c Log Message: Make it possible to call instancemethod() with 2 arguments. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** classobject.c 7 Apr 2003 17:51:59 -0000 2.169 --- classobject.c 9 Apr 2003 19:35:08 -0000 2.170 *************** *** 2198,2204 **** PyObject *func; PyObject *self; ! PyObject *classObj; ! if (!PyArg_UnpackTuple(args, "instancemethod", 3, 3, &func, &self, &classObj)) return NULL; --- 2198,2204 ---- PyObject *func; PyObject *self; ! PyObject *classObj = NULL; ! if (!PyArg_UnpackTuple(args, "instancemethod", 2, 3, &func, &self, &classObj)) return NULL; From gvanrossum@users.sourceforge.net Wed Apr 9 20:36:40 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:36:40 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2359 Modified Files: pdb.py Log Message: Detabified. Removed dead code. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** pdb.py 9 Apr 2003 19:06:21 -0000 1.63 --- pdb.py 9 Apr 2003 19:36:34 -0000 1.64 *************** *** 528,553 **** globals = self.curframe.f_globals locals = self.curframe.f_locals ! p = Pdb() ! p.prompt = "(%s) " % self.prompt.strip() ! print "ENTERING RECURSIVE DEBUGGER" ! sys.call_tracing(p.run, (arg, globals, locals)) ! print "LEAVING RECURSIVE DEBUGGER" sys.settrace(self.trace_dispatch) self.lastcmd = p.lastcmd - - def dont_debug(self, arg): - locals = self.curframe.f_locals - globals = self.curframe.f_globals - try: - r = sys.call_tracing(eval, (arg, globals, locals)) - print "--- DEBUG RETURNED ---" - if r is not None: - print repr(r) - except: - t, v = sys.exc_info()[:2] - if type(t) == type(''): - exc_type_name = t - else: exc_type_name = t.__name__ - print '***', exc_type_name + ':', v def do_quit(self, arg): --- 528,538 ---- globals = self.curframe.f_globals locals = self.curframe.f_locals ! p = Pdb() ! p.prompt = "(%s) " % self.prompt.strip() ! print "ENTERING RECURSIVE DEBUGGER" ! sys.call_tracing(p.run, (arg, globals, locals)) ! print "LEAVING RECURSIVE DEBUGGER" sys.settrace(self.trace_dispatch) self.lastcmd = p.lastcmd def do_quit(self, arg): From gvanrossum@users.sourceforge.net Wed Apr 9 20:38:11 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:38:11 -0700 Subject: [Python-checkins] python/dist/src/PCbuild winsound.dsp,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv2905/PCbuild Modified Files: winsound.dsp Log Message: Add MessageBeep() API. Index: winsound.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/winsound.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** winsound.dsp 23 Jul 2002 06:31:15 -0000 1.8 --- winsound.dsp 9 Apr 2003 19:38:08 -0000 1.9 *************** *** 55,59 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 ! # ADD LINK32 kernel32.lib winmm.lib user32.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd" # SUBTRACT LINK32 /pdb:none *************** *** 83,87 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 83,87 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 user32.lib kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none From gvanrossum@users.sourceforge.net Wed Apr 9 20:38:11 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:38:11 -0700 Subject: [Python-checkins] python/dist/src/PC winsound.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv2905/PC Modified Files: winsound.c Log Message: Add MessageBeep() API. Index: winsound.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/winsound.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** winsound.c 22 Jul 2002 13:26:41 -0000 1.11 --- winsound.c 9 Apr 2003 19:38:08 -0000 1.12 *************** *** 57,60 **** --- 57,63 ---- "will work on all systems."); + PyDoc_STRVAR(sound_msgbeep_doc, + "MessageBeep(x) - call Windows MessageBeep(x). x defaults to MB_OK."); + PyDoc_STRVAR(sound_module_doc, "PlaySound(sound, flags) - play a sound\n" *************** *** 174,181 **** --- 177,196 ---- } + static PyObject * + sound_msgbeep(PyObject *self, PyObject *args) + { + int x = MB_OK; + if (!PyArg_ParseTuple(args, "|i:MessageBeep", &x)) + return NULL; + MessageBeep(x); + Py_INCREF(Py_None); + return Py_None; + } + static struct PyMethodDef sound_methods[] = { {"PlaySound", sound_playsound, METH_VARARGS, sound_playsound_doc}, {"Beep", sound_beep, METH_VARARGS, sound_beep_doc}, + {"MessageBeep", sound_msgbeep, METH_VARARGS, sound_msgbeep_doc}, {NULL, NULL} }; *************** *** 216,219 **** --- 231,240 ---- ADD_DEFINE(SND_LOOP); ADD_DEFINE(SND_APPLICATION); + + ADD_DEFINE(MB_OK); + ADD_DEFINE(MB_ICONASTERISK); + ADD_DEFINE(MB_ICONEXCLAMATION); + ADD_DEFINE(MB_ICONHAND); + ADD_DEFINE(MB_ICONQUESTION); version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); From gvanrossum@users.sourceforge.net Wed Apr 9 20:39:13 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:39:13 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.717,1.718 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv3582 Modified Files: NEWS Log Message: - New function winsound.MessageBeep() wraps the Win32 API MessageBeep(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.717 retrieving revision 1.718 diff -C2 -d -r1.717 -r1.718 *** NEWS 9 Apr 2003 19:06:11 -0000 1.717 --- NEWS 9 Apr 2003 19:39:06 -0000 1.718 *************** *** 160,164 **** ------- ! TBD Mac --- 160,165 ---- ------- ! - New function winsound.MessageBeep() wraps the Win32 API ! MessageBeep(). Mac From gvanrossum@users.sourceforge.net Wed Apr 9 20:57:10 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:57:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_winsound.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11843 Modified Files: test_winsound.py Log Message: Add test for MessageBeep() Index: test_winsound.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winsound.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_winsound.py 23 Oct 2000 17:22:08 -0000 1.3 --- test_winsound.py 9 Apr 2003 19:57:06 -0000 1.4 *************** *** 1,6 **** # Ridiculously simple test of the winsound module for Windows. ! import winsound for i in range(100, 2000, 100): winsound.Beep(i, 75) print "Hopefully you heard some sounds increasing in frequency!" --- 1,18 ---- # Ridiculously simple test of the winsound module for Windows. ! import winsound, time for i in range(100, 2000, 100): winsound.Beep(i, 75) print "Hopefully you heard some sounds increasing in frequency!" + winsound.MessageBeep() + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_OK) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONASTERISK) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONEXCLAMATION) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONHAND) + time.sleep(0.5) + winsound.MessageBeep(winsound.MB_ICONQUESTION) + time.sleep(0.5) From gvanrossum@users.sourceforge.net Wed Apr 9 20:58:34 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 12:58:34 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv12437/sio Log Message: Directory /cvsroot/python/python/nondist/sandbox/sio added to the repository From jlt63@users.sourceforge.net Wed Apr 9 21:14:07 2003 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Wed, 09 Apr 2003 13:14:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv18318 Modified Files: cygwinccompiler.py Log Message: Patch #718551: cygwinccompiler.get_versions() patch The cygwinccompiler.get_versions() function only handles versions numbers of the form "x.y.z". The attached patch enhances get_versions() to handle "x.y" too (i.e., the ".z" is optional). This change causes the unnecessary "--entry _DllMain@12" link option to be suppressed for recent Cygwin and Mingw toolchains. Additionally, it directs recent Mingw toolchains to use gcc instead of dllwrap during linking. Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** cygwinccompiler.py 9 Apr 2003 16:03:57 -0000 1.22 --- cygwinccompiler.py 9 Apr 2003 20:13:59 -0000 1.23 *************** *** 358,362 **** out_string = out.read() out.close() ! result = re.search('(\d+\.\d+\.\d+)',out_string) if result: gcc_version = StrictVersion(result.group(1)) --- 358,362 ---- out_string = out.read() out.close() ! result = re.search('(\d+\.\d+(\.\d+)*)',out_string) if result: gcc_version = StrictVersion(result.group(1)) *************** *** 370,374 **** out_string = out.read() out.close() ! result = re.search('(\d+\.\d+\.\d+)',out_string) if result: ld_version = StrictVersion(result.group(1)) --- 370,374 ---- out_string = out.read() out.close() ! result = re.search('(\d+\.\d+(\.\d+)*)',out_string) if result: ld_version = StrictVersion(result.group(1)) *************** *** 382,386 **** out_string = out.read() out.close() ! result = re.search(' (\d+\.\d+\.\d+)',out_string) if result: dllwrap_version = StrictVersion(result.group(1)) --- 382,386 ---- out_string = out.read() out.close() ! result = re.search(' (\d+\.\d+(\.\d+)*)',out_string) if result: dllwrap_version = StrictVersion(result.group(1)) From jhylton@users.sourceforge.net Wed Apr 9 22:01:48 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:01:48 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.221,2.222 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8481 Modified Files: typeobject.c Log Message: Missing DECREF. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.221 retrieving revision 2.222 diff -C2 -d -r2.221 -r2.222 *** typeobject.c 6 Apr 2003 19:13:41 -0000 2.221 --- typeobject.c 9 Apr 2003 21:01:42 -0000 2.222 *************** *** 2620,2623 **** --- 2620,2624 ---- Py_XDECREF(args); Py_XDECREF(args2); + Py_XDECREF(slots); Py_XDECREF(state); Py_XDECREF(names); From jhylton@users.sourceforge.net Wed Apr 9 22:05:17 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:05:17 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.142,2.143 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv10315 Modified Files: cPickle.c Log Message: Make Picklers collectable. Bug fix candidate. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.142 retrieving revision 2.143 diff -C2 -d -r2.142 -r2.143 *** cPickle.c 20 Mar 2003 20:53:30 -0000 2.142 --- cPickle.c 9 Apr 2003 21:05:12 -0000 2.143 *************** *** 2725,2729 **** } ! self = PyObject_New(Picklerobject, &Picklertype); if (self == NULL) return NULL; --- 2725,2729 ---- } ! self = PyObject_GC_New(Picklerobject, &Picklertype); if (self == NULL) return NULL; *************** *** 2808,2811 **** --- 2808,2812 ---- Py_INCREF(dispatch_table); } + PyObject_GC_Track(self); return self; *************** *** 2843,2846 **** --- 2844,2848 ---- Pickler_dealloc(Picklerobject *self) { + PyObject_GC_UnTrack(self); Py_XDECREF(self->write); Py_XDECREF(self->memo); *************** *** 2852,2856 **** Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); ! PyObject_Del(self); } --- 2854,2896 ---- Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); ! PyObject_GC_Del(self); ! } ! ! static int ! Pickler_traverse(Picklerobject *self, visitproc visit, void *arg) ! { ! int err; ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->write); ! VISIT(self->memo); ! VISIT(self->fast_memo); ! VISIT(self->arg); ! VISIT(self->file); ! VISIT(self->pers_func); ! VISIT(self->inst_pers_func); ! VISIT(self->dispatch_table); ! #undef VISIT ! return 0; ! } ! ! static int ! Pickler_clear(Picklerobject *self) ! { ! #define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL; ! CLEAR(self->write); ! CLEAR(self->memo); ! CLEAR(self->fast_memo); ! CLEAR(self->arg); ! CLEAR(self->file); ! CLEAR(self->pers_func); ! CLEAR(self->inst_pers_func); ! CLEAR(self->dispatch_table); ! #undef CLEAR ! return 0; } *************** *** 2968,2975 **** PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ Picklertype__doc__, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 3008,3015 ---- PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, Picklertype__doc__, /* tp_doc */ ! (traverseproc)Pickler_traverse, /* tp_traverse */ ! (inquiry)Pickler_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ From gvanrossum@users.sourceforge.net Wed Apr 9 22:17:44 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:17:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,NONE,1.1 test_sio.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv14889 Added Files: sio.py test_sio.py Log Message: Experimental new standard I/O library. --- NEW FILE: sio.py --- """New standard I/O library. This code is still very young and experimental! There are fairly complete unit tests in test_sio.py. The design is simple: - A raw stream supports read(n), write(s), seek(offset, whence=0) and tell(). This is generally unbuffered. Raw streams may support Unicode. - A basis stream provides the raw stream API and builds on a much more low-level API, e.g. the os, mmap or socket modules. - A filtering stream is raw stream built on top of another raw stream. There are filtering streams for universal newline translation and for unicode translation. - A buffering stream supports the full classic Python I/O API: read(n=-1), readline(), readlines(sizehint=0), tell(), seek(offset, whence=0), write(s), writelines(lst), as well as __iter__() and next(). (There's also readall() but that's a synonym for read() without arguments.) This is a superset of the raw stream API. I haven't thought about fileno() and isatty() yet. We really need only one buffering stream implementation, which is a filtering stream. You typically take a basis stream, place zero or more filtering streams on top of it, and then top it off with a buffering stream. """ import os import mmap class BufferingInputStream(object): """Standard buffering input stream. This is typically the top of the stack. """ bigsize = 2**19 # Half a Meg bufsize = 2**13 # 8 K def __init__(self, base, bufsize=None): self.do_read = getattr(base, "read", None) # function to fill buffer some more self.do_tell = getattr(base, "tell", None) # None, or return a byte offset self.do_seek = getattr(base, "seek", None) # None, or seek to abyte offset if bufsize is None: # Get default from the class bufsize = self.bufsize self.bufsize = bufsize # buffer size (hint only) self.lines = [] # ready-made lines (sans "\n") self.buf = "" # raw data (may contain "\n") # Invariant: readahead == "\n".join(self.lines + [self.buf]) # self.lines contains no "\n" # self.buf may contain "\n" def tell(self): bytes = self.do_tell() # This may fail offset = len(self.buf) for line in self.lines: offset += len(line) + 1 assert bytes >= offset, (locals(), self.__dict__) return bytes - offset def seek(self, offset, whence=0): # This may fail on the do_seek() or do_tell() call. # But it won't call either on a relative forward seek. # Nor on a seek to the very end. if whence == 0 or (whence == 2 and self.do_seek is not None): self.do_seek(offset, whence) self.lines = [] self.buf = "" return if whence == 2: # Skip relative to EOF by reading and saving only just as # much as needed assert self.do_seek is None data = "\n".join(self.lines + [self.buf]) total = len(data) buffers = [data] self.lines = [] self.buf = "" while 1: data = self.do_read(self.bufsize) if not data: break buffers.append(data) total += len(data) while buffers and total >= len(buffers[0]) - offset: total -= len(buffers[0]) del buffers[0] cutoff = total + offset if cutoff < 0: raise TypeError, "cannot seek back" if buffers: buffers[0] = buffers[0][cutoff:] self.buf = "".join(buffers) self.lines = [] return if whence == 1: if offset < 0: self.do_seek(self.tell() + offset, 0) self.lines = [] self.buf = "" return while self.lines: line = self.lines[0] if offset <= len(line): self.lines[0] = line[offset:] return offset -= len(self.lines[0]) - 1 del self.lines[0] assert not self.lines if offset <= len(self.buf): self.buf = self.buf[offset:] return offset -= len(self.buf) self.buf = "" if self.do_seek is None: self.read(offset) else: self.do_seek(offset, 1) return raise ValueError, "whence should be 0, 1 or 2" def readall(self): self.lines.append(self.buf) more = ["\n".join(self.lines)] self.lines = [] self.buf = "" bufsize = self.bufsize while 1: data = self.do_read(bufsize) if not data: break more.append(data) bufsize = max(bufsize*2, self.bigsize) return "".join(more) def read(self, n=-1): if n < 0: return self.readall() if self.lines: # See if this can be satisfied from self.lines[0] line = self.lines[0] if len(line) >= n: self.lines[0] = line[n:] return line[:n] # See if this can be satisfied *without exhausting* self.lines k = 0 i = 0 for line in self.lines: k += len(line) if k >= n: lines = self.lines[:i] data = self.lines[i] cutoff = len(data) - (k-n) lines.append(data[:cutoff]) self.lines[:i+1] = [data[cutoff:]] return "\n".join(lines) k += 1 i += 1 # See if this can be satisfied from self.lines plus self.buf if k + len(self.buf) >= n: lines = self.lines self.lines = [] cutoff = n - k lines.append(self.buf[:cutoff]) self.buf = self.buf[cutoff:] return "\n".join(lines) else: # See if this can be satisfied from self.buf data = self.buf k = len(data) if k >= n: cutoff = len(data) - (k-n) self.buf = data[cutoff:] return data[:cutoff] lines = self.lines self.lines = [] lines.append(self.buf) self.buf = "" data = "\n".join(lines) more = [data] k = len(data) while k < n: data = self.do_read(max(self.bufsize, n-k)) k += len(data) more.append(data) if not data: break cutoff = len(data) - (k-n) self.buf = data[cutoff:] more[-1] = data[:cutoff] return "".join(more) def __iter__(self): return self def next(self): if self.lines: return self.lines.pop(0) + "\n" # This block is needed because read() can leave self.buf # containing newlines self.lines = self.buf.split("\n") self.buf = self.lines.pop() if self.lines: return self.lines.pop(0) + "\n" buf = self.buf and [self.buf] or [] while 1: self.buf = self.do_read(self.bufsize) self.lines = self.buf.split("\n") self.buf = self.lines.pop() if self.lines: buf.append(self.lines.pop(0)) buf.append("\n") break if not self.buf: break buf.append(self.buf) line = "".join(buf) if not line: raise StopIteration return line def readline(self): try: return self.next() except StopIteration: return "" def readlines(self, sizehint=0): return list(self) class CRLFFilter(object): """Filtering stream for universal newlines. TextInputFilter is more general, but this is faster when you don't need tell/seek. """ def __init__(self, base): self.do_read = base.read self.atcr = False def read(self, n): data = self.do_read(n) if self.atcr: if data.startswith("\n"): data = data[1:] # Very rare case: in the middle of "\r\n" self.atcr = False if "\r" in data: self.atcr = data.endswith("\r") # Test this before removing \r data = data.replace("\r\n", "\n") # Catch \r\n this first data = data.replace("\r", "\n") # Remaining \r are standalone return data class MMapFile(object): """Standard I/O basis stream using mmap.""" def __init__(self, filename, mode="r"): self.filename = filename self.mode = mode if mode == "r": flag = os.O_RDONLY self.access = mmap.ACCESS_READ else: if mode == "w": flag = os.O_RDWR | os.O_CREAT elif mode == "a": flag = os.O_RDWR else: raise ValueError, "mode should be 'r', 'w' or 'a'" self.access = mmap.ACCESS_WRITE if hasattr(os, "O_BINARY"): flag |= os.O_BINARY self.fd = os.open(filename, flag) self.mm = mmap.mmap(self.fd, 0, access=self.access) self.pos = 0 def __del__(self): self.close() def close(self): if self.mm is not None: self.mm.close() self.mm = None if self.fd is not None: os.close(self.fd) self.fd = None def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 0: self.pos = max(0, offset) elif whence == 1: self.pos = max(0, self.pos + offset) elif whence == 2: self.pos = max(0, self.mm.size() + offset) else: raise ValueError, "seek(): whence must be 0, 1 or 2" def readall(self): return self.read() def read(self, n=-1): if n >= 0: aim = self.pos + n else: aim = self.mm.size() # Actual file size, may be more than mapped n = aim - self.pos data = self.mm[self.pos:aim] if len(data) < n: del data # File grew since opened; remap to get the new data self.mm = mmap.mmap(self.fd, 0, access=self.access) data = self.mm[self.pos:aim] self.pos += len(data) return data def __iter__(self): return self def readline(self): hit = self.mm.find("\n", self.pos) + 1 if hit: data = self.mm[self.pos:hit] self.pos = hit return data # Remap the file just in case self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: # Got a whole line after remapping data = self.mm[self.pos:hit] self.pos = hit return data # Read whatever we've got -- may be empty data = self.mm[self.pos:self.mm.size()] self.pos += len(data) return data def next(self): hit = self.mm.find("\n", self.pos) + 1 if hit: data = self.mm[self.pos:hit] self.pos = hit return data # Remap the file just in case self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: # Got a whole line after remapping data = self.mm[self.pos:hit] self.pos = hit return data # Read whatever we've got -- may be empty data = self.mm[self.pos:self.mm.size()] if not data: raise StopIteration self.pos += len(data) return data def readlines(self, sizehint=0): return list(iter(self.readline, "")) def write(self, data): end = self.pos + len(data) try: self.mm[self.pos:end] = data except IndexError: self.mm.resize(end) self.mm[self.pos:end] = data self.pos = end def writelines(self, lines): filter(self.write, lines) class DiskFile(object): """Standard I/O basis stream using os.open/close/read/write/lseek""" def __init__(self, filename, mode="r"): self.filename = filename self.mode = mode if mode == "r": flag = os.O_RDONLY elif mode == "w": flag = os.O_RDWR | os.O_CREAT elif mode == "a": flag = os.O_RDWR else: raise ValueError, "mode should be 'r', 'w' or 'a'" if hasattr(os, "O_BINARY"): flag |= os.O_BINARY self.fd = os.open(filename, flag) def seek(self, offset, whence=0): os.lseek(self.fd, offset, whence) def tell(self): return os.lseek(self.fd, 0, 1) def read(self, n): return os.read(self.fd, n) def write(self, data): while data: n = os.write(self.fd, data) data = data[n:] def close(self): fd = self.fd if fd is not None: self.fd = None os.close(fd) def __del__(self): try: self.close() except: pass class TextInputFilter(object): """Filtering input stream for universal newline translation.""" def __init__(self, base): self.base = base # must implement read, may implement tell, seek self.atcr = False # Set when last char read was \r self.buf = "" # Optional one-character read-ahead buffer def read(self, n): """Read up to n bytes.""" if n <= 0: return "" if self.buf: assert not self.atcr data = self.buf self.buf = "" return data data = self.base.read(n) if self.atcr: if data.startswith("\n"): data = data[1:] if not data: data = self.base.read(n) self.atcr = False if "\r" in data: self.atcr = data.endswith("\r") data = data.replace("\r\n", "\n").replace("\r", "\n") return data def seek(self, offset, whence=0): self.base.seek(offset, whence) self.atcr = False self.buf = "" def tell(self): pos = self.base.tell() if self.atcr: # Must read the next byte to see if it's \n, # because then we must report the next position. assert not self.buf self.buf = self.base.read(1) pos += 1 self.atcr = False if self.buf == "\n": self.buf = "" return pos - len(self.buf) class TextOutputFilter(object): """Filtering output stream for universal newline translation.""" def __init__(self, base, linesep=os.linesep): assert linesep in ["\n", "\r\n", "\r"] self.base = base # must implement write, may implement seek, tell self.linesep = linesep def write(self, data): if self.linesep is not "\n" and "\n" in data: data = data.replace("\n", self.linesep) self.base.write(data) def seek(self, offset, whence=0): self.base.seek(offset, whence) def tell(self): return self.base.tell() class DecodingInputFilter(object): """Filtering input stream that decodes an encoded file.""" def __init__(self, base, encoding="utf8", errors="strict"): self.base = base self.encoding = encoding self.errors = errors self.tell = base.tell self.seek = base.seek def read(self, n): """Read *approximately* n bytes, then decode them. Under extreme circumstances, the return length could be longer than n! Always return a unicode string. This does *not* translate newlines; you can stack TextInputFilter. """ data = self.base.read(n) try: return data.decode(self.encoding, self.errors) except ValueError: # XXX Sigh. decode() doesn't handle incomplete strings well. # Use the retry strategy from codecs.StreamReader. for i in range(9): more = self.base.read(1) if not more: raise data += more try: return data.decode(self.encoding, self.errors) except ValueError: pass raise class EncodingOutputFilter(object): """Filtering output stream that writes to an encoded file.""" def __init__(self, base, encoding="utf8", errors="strict"): self.base = base self.encoding = encoding self.errors = errors self.tell = base.tell self.seek = base.seek def write(self, chars): if isinstance(chars, str): chars = unicode(chars) # Fail if it's not ASCII self.base.write(chars.encode(self.encoding, self.errors)) --- NEW FILE: test_sio.py --- """Unit tests for sio (new standard I/O).""" import time import tempfile import unittest from test import test_support import sio class TestSource(object): def __init__(self, packets): for x in packets: assert x self.orig_packets = list(packets) self.packets = list(packets) self.pos = 0 def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 1: offset += self.pos elif whence == 2: for packet in self.orig_packets: offset += len(packet) else: assert whence == 0 self.packets = list(self.orig_packets) self.pos = 0 while self.pos < offset: data = self.read(offset - self.pos) if not data: break assert self.pos == offset def read(self, n): try: data = self.packets.pop(0) except IndexError: return "" if len(data) > n: data, rest = data[:n], data[n:] self.packets.insert(0, rest) self.pos += len(data) return data class TestReader(object): def __init__(self, packets): for x in packets: assert x self.orig_packets = list(packets) self.packets = list(packets) self.pos = 0 def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 1: offset += self.pos elif whence == 2: for packet in self.orig_packets: offset += len(packet) else: assert whence == 0 self.packets = list(self.orig_packets) self.pos = 0 while self.pos < offset: data = self.read(offset - self.pos) if not data: break assert self.pos == offset def read(self, n): try: data = self.packets.pop(0) except IndexError: return "" if len(data) > n: data, rest = data[:n], data[n:] self.packets.insert(0, rest) self.pos += len(data) return data class TestWriter(object): def __init__(self): self.buf = "" self.pos = 0 def write(self, data): if self.pos >= len(self.buf): self.buf += "\0" * (self.pos - len(self.buf)) + data self.pos = len(self.buf) else: self.buf = (self.buf[:self.pos] + data + self.buf[self.pos + len(data):]) self.pos += len(data) def tell(self): return self.pos def seek(self, offset, whence=0): if whence == 0: pass elif whence == 1: offset += self.pos elif whence == 2: offset += len(self.buf) else: raise ValueError, "whence should be 0, 1 or 2" if offset < 0: offset = 0 self.pos = offset class BufferingInputStreamTests(unittest.TestCase): packets = ["a", "b", "\n", "def", "\nxy\npq\nuv", "wx"] lines = ["ab\n", "def\n", "xy\n", "pq\n", "uvwx"] def setUp(self): pass def makeStream(self, tell=False, seek=False, bufsize=None): base = TestSource(self.packets) if not tell: base.tell = None if not seek: base.seek = None return sio.BufferingInputStream(base, bufsize) def test_readline(self): file = self.makeStream() self.assertEqual(list(iter(file.readline, "")), self.lines) def test_readlines(self): # This also tests next() and __iter__() file = self.makeStream() self.assertEqual(file.readlines(), self.lines) def test_readlines_small_bufsize(self): file = self.makeStream(bufsize=1) self.assertEqual(list(file), self.lines) def test_readall(self): file = self.makeStream() self.assertEqual(file.readall(), "".join(self.lines)) def test_readall_small_bufsize(self): file = self.makeStream(bufsize=1) self.assertEqual(file.readall(), "".join(self.lines)) def test_readall_after_readline(self): file = self.makeStream() self.assertEqual(file.readline(), self.lines[0]) self.assertEqual(file.readline(), self.lines[1]) self.assertEqual(file.readall(), "".join(self.lines[2:])) def test_read_1_after_readline(self): file = self.makeStream() self.assertEqual(file.readline(), "ab\n") self.assertEqual(file.readline(), "def\n") blocks = [] while 1: block = file.read(1) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, list("".join(self.lines)[7:])) def test_read_1(self): file = self.makeStream() blocks = [] while 1: block = file.read(1) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, list("".join(self.lines))) def test_read_2(self): file = self.makeStream() blocks = [] while 1: block = file.read(2) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, ["ab", "\nd", "ef", "\nx", "y\n", "pq", "\nu", "vw", "x"]) def test_read_4(self): file = self.makeStream() blocks = [] while 1: block = file.read(4) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, ["ab\nd", "ef\nx", "y\npq", "\nuvw", "x"]) def test_read_4_after_readline(self): file = self.makeStream() self.assertEqual(file.readline(), "ab\n") self.assertEqual(file.readline(), "def\n") blocks = [file.read(4)] while 1: block = file.read(4) if not block: break blocks.append(block) self.assertEqual(file.read(0), "") self.assertEqual(blocks, ["xy\np", "q\nuv", "wx"]) def test_read_4_small_bufsize(self): file = self.makeStream(bufsize=1) blocks = [] while 1: block = file.read(4) if not block: break blocks.append(block) self.assertEqual(blocks, ["ab\nd", "ef\nx", "y\npq", "\nuvw", "x"]) def test_tell_1(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.read(1)) if not n: break pos += n def test_tell_1_after_readline(self): file = self.makeStream(tell=True) pos = 0 pos += len(file.readline()) self.assertEqual(file.tell(), pos) pos += len(file.readline()) self.assertEqual(file.tell(), pos) while 1: self.assertEqual(file.tell(), pos) n = len(file.read(1)) if not n: break pos += n def test_tell_2(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.read(2)) if not n: break pos += n def test_tell_4(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.read(4)) if not n: break pos += n def test_tell_readline(self): file = self.makeStream(tell=True) pos = 0 while 1: self.assertEqual(file.tell(), pos) n = len(file.readline()) if not n: break pos += n def test_seek(self): file = self.makeStream(tell=True, seek=True) all = file.readall() end = len(all) for readto in range(0, end+1): for seekto in range(0, end+1): for whence in 0, 1, 2: file.seek(0) self.assertEqual(file.tell(), 0) head = file.read(readto) self.assertEqual(head, all[:readto]) if whence == 1: offset = seekto - readto elif whence == 2: offset = seekto - end else: offset = seekto file.seek(offset, whence) here = file.tell() self.assertEqual(here, seekto) rest = file.readall() self.assertEqual(rest, all[seekto:]) def test_seek_noseek(self): file = self.makeStream() all = file.readall() end = len(all) for readto in range(0, end+1): for seekto in range(readto, end+1): for whence in 1, 2: file = self.makeStream() head = file.read(readto) self.assertEqual(head, all[:readto]) if whence == 1: offset = seekto - readto elif whence == 2: offset = seekto - end file.seek(offset, whence) rest = file.readall() self.assertEqual(rest, all[seekto:]) class CRLFFilterTests(unittest.TestCase): def test_filter(self): packets = ["abc\ndef\rghi\r\nxyz\r", "123\r", "\n456"] expected = ["abc\ndef\nghi\nxyz\n", "123\n", "456"] crlf = sio.CRLFFilter(TestSource(packets)) blocks = [] while 1: block = crlf.read(100) if not block: break blocks.append(block) self.assertEqual(blocks, expected) class MMapFileTests(BufferingInputStreamTests): tfn = None def tearDown(self): tfn = self.tfn if tfn: self.tfn = None try: os.remove(self.tfn) except os.error, msg: print "can't remove %s: %s" % (tfn, msg) def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): self.tfn = tempfile.mktemp() f = open(tfn, "wb") f.writelines(self.packets) f.close() return sio.MMapFile(self.tfn, mode) def test_write(self): file = self.makeStream(mode="w") file.write("BooHoo\n") file.write("Barf\n") file.writelines(["a\n", "b\n", "c\n"]) self.assertEqual(file.tell(), len("BooHoo\nBarf\na\nb\nc\n")) file.seek(0) self.assertEqual(file.read(), "BooHoo\nBarf\na\nb\nc\n") file.seek(0) self.assertEqual(file.readlines(), ["BooHoo\n", "Barf\n", "a\n", "b\n", "c\n"]) self.assertEqual(file.tell(), len("BooHoo\nBarf\na\nb\nc\n")) class TextInputFilterTests(unittest.TestCase): packets = [ "foo\r", "bar\r", "\nfoo\r\n", "abc\ndef\rghi\r\nxyz", "\nuvw\npqr\r", "\n", "abc\n", ] expected = [ ("foo\n", 4), ("bar\n", 9), ("foo\n", 14), ("abc\ndef\nghi\nxyz", 30), ("\nuvw\npqr\n", 40), ("abc\n", 44), ("", 44), ("", 44), ] expected_with_tell = [ ("foo\n", 4), ("b", 5), ("ar\n", 9), ("foo\n", 14), ("abc\ndef\nghi\nxyz", 30), ("\nuvw\npqr\n", 40), ("abc\n", 44), ("", 44), ("", 44), ] def test_read(self): base = TestReader(self.packets) filter = sio.TextInputFilter(base) for data, pos in self.expected: self.assertEqual(filter.read(100), data) def test_read_tell(self): base = TestReader(self.packets) filter = sio.TextInputFilter(base) for data, pos in self.expected_with_tell: self.assertEqual(filter.read(100), data) self.assertEqual(filter.tell(), pos) self.assertEqual(filter.tell(), pos) # Repeat the tell() ! def test_seek(self): base = TestReader(self.packets) filter = sio.TextInputFilter(base) sofar = "" pairs = [] while True: pairs.append((sofar, filter.tell())) c = filter.read(1) if not c: break self.assertEqual(len(c), 1) sofar += c all = sofar for i in range(len(pairs)): sofar, pos = pairs[i] filter.seek(pos) self.assertEqual(filter.tell(), pos) self.assertEqual(filter.tell(), pos) bufs = [sofar] while True: data = filter.read(100) if not data: self.assertEqual(filter.read(100), "") break bufs.append(data) self.assertEqual("".join(bufs), all) class TextOutputFilterTests(unittest.TestCase): def test_write_nl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("abc") filter.write("def\npqr\nuvw") filter.write("\n123\n") self.assertEqual(base.buf, "abcdef\npqr\nuvw\n123\n") def test_write_cr(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r") filter.write("abc") filter.write("def\npqr\nuvw") filter.write("\n123\n") self.assertEqual(base.buf, "abcdef\rpqr\ruvw\r123\r") def test_write_crnl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r\n") filter.write("abc") filter.write("def\npqr\nuvw") filter.write("\n123\n") self.assertEqual(base.buf, "abcdef\r\npqr\r\nuvw\r\n123\r\n") def test_write_tell_nl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("xxx") self.assertEqual(filter.tell(), 3) filter.write("\nabc\n") self.assertEqual(filter.tell(), 8) def test_write_tell_cr(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r") filter.write("xxx") self.assertEqual(filter.tell(), 3) filter.write("\nabc\n") self.assertEqual(filter.tell(), 8) def test_write_tell_crnl(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\r\n") filter.write("xxx") self.assertEqual(filter.tell(), 3) filter.write("\nabc\n") self.assertEqual(filter.tell(), 10) def test_write_seek(self): base = TestWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("x"*100) filter.seek(50) filter.write("y"*10) self.assertEqual(base.buf, "x"*50 + "y"*10 + "x"*40) class DecodingInputFilterTests(unittest.TestCase): def test_read(self): chars = u"abc\xff\u1234\u4321\x80xyz" data = chars.encode("utf8") base = TestReader([data]) filter = sio.DecodingInputFilter(base) bufs = [] for n in range(1, 11): while 1: c = filter.read(n) self.assertEqual(type(c), unicode) if not c: break bufs.append(c) self.assertEqual(u"".join(bufs), chars) class EncodingOutputFilterTests(unittest.TestCase): def test_write(self): chars = u"abc\xff\u1234\u4321\x80xyz" data = chars.encode("utf8") for n in range(1, 11): base = TestWriter() filter = sio.EncodingOutputFilter(base) pos = 0 while 1: c = chars[pos:pos+n] if not c: break pos += len(c) filter.write(c) self.assertEqual(base.buf, data) # Speed test FN = "BIG" def timeit(fn=FN): f = sio.MMapFile(fn, "r") lines = bytes = 0 t0 = time.clock() for line in f: lines += 1 bytes += len(line) t1 = time.clock() print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) def timeold(fn=FN): f = open(fn, "rb") lines = bytes = 0 t0 = time.clock() for line in f: lines += 1 bytes += len(line) t1 = time.clock() print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) # Functional test def main(): f = sio.DiskFile("sio.py") f = sio.DecodingInputFilter(f) f = sio.TextInputFilter(f) f = sio.BufferingInputStream(f) for i in range(10): print repr(f.readline()) # Unit test main program def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(BufferingInputStreamTests)) suite.addTest(unittest.makeSuite(CRLFFilterTests)) ##suite.addTest(unittest.makeSuite(MMapFileTests)) suite.addTest(unittest.makeSuite(TextInputFilterTests)) suite.addTest(unittest.makeSuite(TextOutputFilterTests)) suite.addTest(unittest.makeSuite(DecodingInputFilterTests)) suite.addTest(unittest.makeSuite(EncodingOutputFilterTests)) test_support.run_suite(suite) if __name__ == "__main__": test_main() From jhylton@users.sourceforge.net Wed Apr 9 22:25:34 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:25:34 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.143,2.144 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18000 Modified Files: cPickle.c Log Message: Make Unpickler objects colletable. Bugfix candidate. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.143 retrieving revision 2.144 diff -C2 -d -r2.143 -r2.144 *** cPickle.c 9 Apr 2003 21:05:12 -0000 2.143 --- cPickle.c 9 Apr 2003 21:25:30 -0000 2.144 *************** *** 5118,5122 **** Unpicklerobject *self; ! if (!( self = PyObject_New(Unpicklerobject, &Unpicklertype))) return NULL; --- 5118,5122 ---- Unpicklerobject *self; ! if (!( self = PyObject_GC_New(Unpicklerobject, &Unpicklertype))) return NULL; *************** *** 5171,5174 **** --- 5171,5175 ---- } } + PyObject_GC_Track(self); return self; *************** *** 5194,5197 **** --- 5195,5199 ---- Unpickler_dealloc(Unpicklerobject *self) { + PyObject_GC_UnTrack((PyObject *)self); Py_XDECREF(self->readline); Py_XDECREF(self->read); *************** *** 5211,5217 **** } ! PyObject_Del(self); } static PyObject * --- 5213,5257 ---- } ! PyObject_GC_Del(self); ! } ! ! static int ! Unpickler_traverse(Unpicklerobject *self, visitproc visit, void *arg) ! { ! int err; ! ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->readline); ! VISIT(self->read); ! VISIT(self->file); ! VISIT(self->memo); ! VISIT(self->stack); ! VISIT(self->pers_func); ! VISIT(self->arg); ! VISIT(self->last_string); ! #undef VISIT ! return 0; } + static int + Unpickler_clear(Unpicklerobject *self) + { + #define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL + CLEAR(self->readline); + CLEAR(self->read); + CLEAR(self->file); + CLEAR(self->memo); + CLEAR(self->stack); + CLEAR(self->pers_func); + CLEAR(self->arg); + CLEAR(self->last_string); + #undef CLEAR + return 0; + } static PyObject * *************** *** 5411,5435 **** static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cPickle.Unpickler", /*tp_name*/ ! sizeof(Unpicklerobject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ ! /* methods */ ! (destructor)Unpickler_dealloc, /*tp_dealloc*/ ! (printfunc)0, /*tp_print*/ ! (getattrfunc)Unpickler_getattr, /*tp_getattr*/ ! (setattrfunc)Unpickler_setattr, /*tp_setattr*/ ! (cmpfunc)0, /*tp_compare*/ ! (reprfunc)0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)0, /*tp_hash*/ ! (ternaryfunc)0, /*tp_call*/ ! (reprfunc)0, /*tp_str*/ ! ! /* Space for future expansion */ ! 0L,0L,0L,0L, ! Unpicklertype__doc__ /* Documentation string */ }; --- 5451,5477 ---- static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cPickle.Unpickler", /*tp_name*/ ! sizeof(Unpicklerobject), /*tp_basicsize*/ ! 0, ! (destructor)Unpickler_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! (getattrfunc)Unpickler_getattr, /* tp_getattr */ ! (setattrfunc)Unpickler_setattr, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, ! Unpicklertype__doc__, /* tp_doc */ ! (traverseproc)Unpickler_traverse, /* tp_traverse */ ! (inquiry)Unpickler_clear, /* tp_clear */ }; From gvanrossum@users.sourceforge.net Wed Apr 9 22:46:57 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:46:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv26834 Modified Files: sio.py Log Message: Make MMapFile work a bit better on Unix; this requires using fstat() to find out the size since specifying 0 for the initial size doesn't work. But writing to an file that starts out empty doesn't work on Unix, because the mmap module's test for writability fails if size==0. :-( Index: sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/sio.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sio.py 9 Apr 2003 21:17:41 -0000 1.1 --- sio.py 9 Apr 2003 21:46:54 -0000 1.2 *************** *** 292,296 **** flag |= os.O_BINARY self.fd = os.open(filename, flag) ! self.mm = mmap.mmap(self.fd, 0, access=self.access) self.pos = 0 --- 292,297 ---- flag |= os.O_BINARY self.fd = os.open(filename, flag) ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) self.pos = 0 *************** *** 332,336 **** del data # File grew since opened; remap to get the new data ! self.mm = mmap.mmap(self.fd, 0, access=self.access) data = self.mm[self.pos:aim] self.pos += len(data) --- 333,338 ---- del data # File grew since opened; remap to get the new data ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) data = self.mm[self.pos:aim] self.pos += len(data) *************** *** 347,351 **** return data # Remap the file just in case ! self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: --- 349,354 ---- return data # Remap the file just in case ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: *************** *** 366,370 **** return data # Remap the file just in case ! self.mm = mmap.mmap(self.fd, 0, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: --- 369,374 ---- return data # Remap the file just in case ! size = os.fstat(self.fd).st_size ! self.mm = mmap.mmap(self.fd, size, access=self.access) hit = self.mm.find("\n", self.pos) + 1 if hit: *************** *** 387,391 **** try: self.mm[self.pos:end] = data ! except IndexError: self.mm.resize(end) self.mm[self.pos:end] = data --- 391,397 ---- try: self.mm[self.pos:end] = data ! # This can raise IndexError on Windows, ValueError on Unix ! except (IndexError, ValueError): ! # XXX On Unix, this resize() call doesn't work self.mm.resize(end) self.mm[self.pos:end] = data From gvanrossum@users.sourceforge.net Wed Apr 9 22:47:57 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 14:47:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio test_sio.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv27191 Modified Files: test_sio.py Log Message: MMapFileTests now works, except for writing on Unix. Index: test_sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/test_sio.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sio.py 9 Apr 2003 21:17:41 -0000 1.1 --- test_sio.py 9 Apr 2003 21:47:54 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- """Unit tests for sio (new standard I/O).""" + import os import time import tempfile *************** *** 122,128 **** lines = ["ab\n", "def\n", "xy\n", "pq\n", "uvwx"] - def setUp(self): - pass - def makeStream(self, tell=False, seek=False, bufsize=None): base = TestSource(self.packets) --- 123,126 ---- *************** *** 348,352 **** self.tfn = None try: ! os.remove(self.tfn) except os.error, msg: print "can't remove %s: %s" % (tfn, msg) --- 346,350 ---- self.tfn = None try: ! os.remove(tfn) except os.error, msg: print "can't remove %s: %s" % (tfn, msg) *************** *** 354,358 **** def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): self.tfn = tempfile.mktemp() ! f = open(tfn, "wb") f.writelines(self.packets) f.close() --- 352,356 ---- def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): self.tfn = tempfile.mktemp() ! f = open(self.tfn, "wb") f.writelines(self.packets) f.close() *************** *** 360,363 **** --- 358,363 ---- def test_write(self): + if os.name == "posix": + return # write() does't work on Unix :-( file = self.makeStream(mode="w") file.write("BooHoo\n") *************** *** 578,582 **** suite.addTest(unittest.makeSuite(BufferingInputStreamTests)) suite.addTest(unittest.makeSuite(CRLFFilterTests)) ! ##suite.addTest(unittest.makeSuite(MMapFileTests)) suite.addTest(unittest.makeSuite(TextInputFilterTests)) suite.addTest(unittest.makeSuite(TextOutputFilterTests)) --- 578,582 ---- suite.addTest(unittest.makeSuite(BufferingInputStreamTests)) suite.addTest(unittest.makeSuite(CRLFFilterTests)) ! suite.addTest(unittest.makeSuite(MMapFileTests)) suite.addTest(unittest.makeSuite(TextInputFilterTests)) suite.addTest(unittest.makeSuite(TextOutputFilterTests)) From gvanrossum@users.sourceforge.net Thu Apr 10 02:00:07 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 18:00:07 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv1321 Modified Files: sio.py Log Message: Add class variables mm and fd so that close() and hence __del__() will work even if __init__() failed. Index: sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/sio.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sio.py 9 Apr 2003 21:46:54 -0000 1.2 --- sio.py 10 Apr 2003 01:00:04 -0000 1.3 *************** *** 299,302 **** --- 299,304 ---- self.close() + mm = fd = None + def close(self): if self.mm is not None: From gvanrossum@users.sourceforge.net Thu Apr 10 02:00:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 09 Apr 2003 18:00:55 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio test_sio.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv1683 Modified Files: test_sio.py Log Message: Improve the speed test. Index: test_sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/test_sio.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_sio.py 9 Apr 2003 21:47:54 -0000 1.2 --- test_sio.py 10 Apr 2003 01:00:53 -0000 1.3 *************** *** 542,547 **** FN = "BIG" ! def timeit(fn=FN): ! f = sio.MMapFile(fn, "r") lines = bytes = 0 t0 = time.clock() --- 542,547 ---- FN = "BIG" ! def timeit(fn=FN, opener=sio.MMapFile): ! f = opener(fn, "r") lines = bytes = 0 t0 = time.clock() *************** *** 550,568 **** bytes += len(line) t1 = time.clock() ! print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) ! def timeold(fn=FN): ! f = open(fn, "rb") ! lines = bytes = 0 ! t0 = time.clock() ! for line in f: ! lines += 1 ! bytes += len(line) ! t1 = time.clock() ! print "%d lines (%d bytes) in %.3f seconds" % (lines, bytes, t1-t0) # Functional test ! def main(): f = sio.DiskFile("sio.py") f = sio.DecodingInputFilter(f) --- 550,567 ---- bytes += len(line) t1 = time.clock() ! print "%d lines (%d bytes) in %.3f seconds for %s" % ( ! lines, bytes, t1-t0, opener.__name__) ! def speed_main(): ! def diskopen(fn, mode): ! base = sio.DiskFile(fn, mode) ! return sio.BufferingInputStream(base) ! timeit(opener=diskopen) ! timeit(opener=sio.MMapFile) ! timeit(opener=open) # Functional test ! def functional_main(): f = sio.DiskFile("sio.py") f = sio.DecodingInputFilter(f) From rhettinger@users.sourceforge.net Thu Apr 10 17:03:26 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 10 Apr 2003 09:03:26 -0700 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.135,2.136 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11764 Modified Files: timemodule.c Log Message: SF patch #718867: Fix reference leak for time.strptime (contributed by Brett Cannon) Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.135 retrieving revision 2.136 diff -C2 -d -r2.135 -r2.136 *** timemodule.c 14 Mar 2003 21:51:36 -0000 2.135 --- timemodule.c 10 Apr 2003 16:03:22 -0000 2.136 *************** *** 455,462 **** { PyObject *strptime_module = PyImport_ImportModule("_strptime"); if (!strptime_module) return NULL; ! return PyObject_CallMethod(strptime_module, "strptime", "O", args); } --- 455,465 ---- { PyObject *strptime_module = PyImport_ImportModule("_strptime"); + PyObject *strptime_result; if (!strptime_module) return NULL; ! strptime_result = PyObject_CallMethod(strptime_module, "strptime", "O", args); ! Py_DECREF(strptime_module); ! return strptime_result; } From montanaro@users.sourceforge.net Thu Apr 10 18:16:20 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 10 Apr 2003 10:16:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26542/test Modified Files: test_csv.py Log Message: hoist contents of csv submodule up to the package level Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_csv.py 21 Mar 2003 01:15:58 -0000 1.2 --- test_csv.py 10 Apr 2003 17:16:15 -0000 1.3 *************** *** 5,9 **** import unittest from StringIO import StringIO ! from csv import csv import gc from test.test_support import verbose --- 5,9 ---- import unittest from StringIO import StringIO ! import csv import gc from test.test_support import verbose From montanaro@users.sourceforge.net Thu Apr 10 18:16:20 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 10 Apr 2003 10:16:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/csv __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv In directory sc8-pr-cvs1:/tmp/cvs-serv26542/csv Modified Files: __init__.py Log Message: hoist contents of csv submodule up to the package level Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 20 Mar 2003 23:29:12 -0000 1.1 --- __init__.py 10 Apr 2003 17:16:14 -0000 1.2 *************** *** 1 **** --- 1,2 ---- + from csv import * From gvanrossum@users.sourceforge.net Thu Apr 10 21:29:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 10 Apr 2003 13:29:54 -0700 Subject: [Python-checkins] python/dist/src/Python errors.c,2.76,2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28485 Modified Files: errors.c Log Message: PyErr_NormalizeException(): in the type==NULL test, we should simply return. Setting an exception can mess with the exception state, and continuing is definitely wrong (since type is dereferenced later on). Some code that calls this seems to be prepared for a NULL exception type, so let's be safe rather than sorry and simply assume there's nothing to normalize in this case. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -d -r2.76 -r2.77 *** errors.c 19 Feb 2003 00:33:32 -0000 2.76 --- errors.c 10 Apr 2003 20:29:48 -0000 2.77 *************** *** 132,138 **** if (type == NULL) { ! /* This is a bug. Should never happen. Don't dump core. */ ! PyErr_SetString(PyExc_SystemError, ! "PyErr_NormalizeException() called without exception"); } --- 132,137 ---- if (type == NULL) { ! /* There was no exception, so nothing to do. */ ! return; } From gvanrossum@users.sourceforge.net Thu Apr 10 21:30:24 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 10 Apr 2003 13:30:24 -0700 Subject: [Python-checkins] python/dist/src/Python errors.c,2.66.10.1,2.66.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28810 Modified Files: Tag: release22-maint errors.c Log Message: Backport: PyErr_NormalizeException(): in the type==NULL test, we should simply return. Setting an exception can mess with the exception state, and continuing is definitely wrong (since type is dereferenced later on). Some code that calls this seems to be prepared for a NULL exception type, so let's be safe rather than sorry and simply assume there's nothing to normalize in this case. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.66.10.1 retrieving revision 2.66.10.2 diff -C2 -d -r2.66.10.1 -r2.66.10.2 *** errors.c 3 Mar 2002 21:32:01 -0000 2.66.10.1 --- errors.c 10 Apr 2003 20:30:18 -0000 2.66.10.2 *************** *** 132,138 **** if (type == NULL) { ! /* This is a bug. Should never happen. Don't dump core. */ ! PyErr_SetString(PyExc_SystemError, ! "PyErr_NormalizeException() called without exception"); } --- 132,137 ---- if (type == NULL) { ! /* There was no exception, so nothing to do. */ ! return; } From nnorwitz@users.sourceforge.net Thu Apr 10 22:51:32 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 14:51:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv20908/Doc/ref Modified Files: ref5.tex Log Message: Add a space after expression to be consistent Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** ref5.tex 16 Dec 2002 13:54:01 -0000 1.71 --- ref5.tex 10 Apr 2003 21:51:29 -0000 1.72 *************** *** 158,162 **** \production{listmaker} {\token{expression} ( \token{list_for} ! | ( "," \token{expression})* [","] )} \production{list_iter} {\token{list_for} | \token{list_if}} --- 158,162 ---- \production{listmaker} {\token{expression} ( \token{list_for} ! | ( "," \token{expression} )* [","] )} \production{list_iter} {\token{list_for} | \token{list_if}} From nnorwitz@users.sourceforge.net Thu Apr 10 22:53:16 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 14:53:16 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.182,2.183 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22457/Python Modified Files: pythonrun.c Log Message: Move declaration of enc to scope where it is used Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.182 retrieving revision 2.183 diff -C2 -d -r2.182 -r2.183 *** pythonrun.c 19 Mar 2003 00:35:36 -0000 2.182 --- pythonrun.c 10 Apr 2003 21:53:14 -0000 2.183 *************** *** 191,199 **** char *saved_locale = setlocale(LC_CTYPE, NULL); char *codeset; - PyObject *enc = NULL; setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); if (*codeset) { ! enc = PyCodec_Encoder(codeset); if (enc) { Py_FileSystemDefaultEncoding = strdup(codeset); --- 191,198 ---- char *saved_locale = setlocale(LC_CTYPE, NULL); char *codeset; setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); if (*codeset) { ! PyObject *enc = PyCodec_Encoder(codeset); if (enc) { Py_FileSystemDefaultEncoding = strdup(codeset); From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:33 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Doc/lib Modified Files: libstring.tex Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** libstring.tex 12 Sep 2002 14:16:07 -0000 1.48 --- libstring.tex 10 Apr 2003 22:35:29 -0000 1.49 *************** *** 244,247 **** --- 244,249 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in earlier 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 252,255 **** --- 254,259 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in 2.2 versions]{2.2.3} \end{funcdesc} *************** *** 260,263 **** --- 264,269 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in 2.2 or 2.2.1]{2.2.2} \end{funcdesc} From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:34 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Lib/test Modified Files: string_tests.py Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** string_tests.py 31 Mar 2003 18:07:50 -0000 1.30 --- string_tests.py 10 Apr 2003 22:35:31 -0000 1.31 *************** *** 196,199 **** --- 196,226 ---- self.checkequal('hello', 'hello', 'strip') + # strip/lstrip/rstrip with None arg + self.checkequal('hello', ' hello ', 'strip', None) + self.checkequal('hello ', ' hello ', 'lstrip', None) + self.checkequal(' hello', ' hello ', 'rstrip', None) + self.checkequal('hello', 'hello', 'strip', None) + + # strip/lstrip/rstrip with str arg + self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz') + self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz') + self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz') + self.checkequal('hello', 'hello', 'strip', 'xyz') + + # strip/lstrip/rstrip with unicode arg + if test_support.have_unicode: + self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', + 'strip', unicode('xyz', 'ascii')) + self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', + 'lstrip', unicode('xyz', 'ascii')) + self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', + 'rstrip', unicode('xyz', 'ascii')) + self.checkequal(unicode('hello', 'ascii'), 'hello', + 'strip', unicode('xyz', 'ascii')) + + self.checkraises(TypeError, 'hello', 'strip', 42, 42) + self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) + self.checkraises(TypeError, 'hello', 'rstrip', 42, 42) + def test_ljust(self): self.checkequal('abc ', 'abc', 'ljust', 10) *************** *** 432,463 **** self.checkraises(TypeError, 'hello', 'endswith') self.checkraises(TypeError, 'hello', 'endswith', 42) - - def test_strip_args(self): - # strip/lstrip/rstrip with None arg - self.checkequal('hello', ' hello ', 'strip', None) - self.checkequal('hello ', ' hello ', 'lstrip', None) - self.checkequal(' hello', ' hello ', 'rstrip', None) - self.checkequal('hello', 'hello', 'strip', None) - - # strip/lstrip/rstrip with str arg - self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz') - self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz') - self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz') - self.checkequal('hello', 'hello', 'strip', 'xyz') - - # strip/lstrip/rstrip with unicode arg - if test_support.have_unicode: - self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', - 'strip', unicode('xyz', 'ascii')) - self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', - 'lstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', - 'rstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('hello', 'ascii'), 'hello', - 'strip', unicode('xyz', 'ascii')) - - self.checkraises(TypeError, 'hello', 'strip', 42, 42) - self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) - self.checkraises(TypeError, 'hello', 'rstrip', 42, 42) def test___contains__(self): --- 459,462 ---- From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:34 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:34 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.16,1.17 string.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Lib Modified Files: UserString.py string.py Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UserString.py 18 Nov 2002 16:12:54 -0000 1.16 --- UserString.py 10 Apr 2003 22:35:31 -0000 1.17 *************** *** 100,104 **** def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, sep=None): return self.__class__(self.data.lstrip(sep)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) --- 100,104 ---- def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) *************** *** 108,112 **** return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, sep=None): return self.__class__(self.data.rstrip(sep)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) --- 108,112 ---- return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) *************** *** 114,118 **** def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, sep=None): return self.__class__(self.data.strip(sep)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) --- 114,118 ---- def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, chars=None): return self.__class__(self.data.strip(chars)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** string.py 14 Nov 2002 03:31:32 -0000 1.67 --- string.py 10 Apr 2003 22:35:31 -0000 1.68 *************** *** 80,84 **** Return a copy of the string s with leading and trailing whitespace removed. ! If chars is given and not None, remove characters in sep instead. If chars is unicode, S will be converted to unicode before stripping. --- 80,84 ---- Return a copy of the string s with leading and trailing whitespace removed. ! If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping. *************** *** 87,107 **** # Strip leading tabs and spaces ! def lstrip(s): ! """lstrip(s) -> string Return a copy of the string s with leading whitespace removed. """ ! return s.lstrip() # Strip trailing tabs and spaces ! def rstrip(s): ! """rstrip(s) -> string ! Return a copy of the string s with trailing whitespace ! removed. """ ! return s.rstrip() --- 87,108 ---- # Strip leading tabs and spaces ! def lstrip(s, chars=None): ! """lstrip(s [,chars]) -> string Return a copy of the string s with leading whitespace removed. + If chars is given and not None, remove characters in chars instead. """ ! return s.lstrip(chars) # Strip trailing tabs and spaces ! def rstrip(s, chars=None): ! """rstrip(s [,chars]) -> string ! Return a copy of the string s with trailing whitespace removed. ! If chars is given and not None, remove characters in chars instead. """ ! return s.rstrip(chars) From nnorwitz@users.sourceforge.net Thu Apr 10 23:35:35 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 15:35:35 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.207,2.208 unicodeobject.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv20253/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Attempt to make all the various string *strip methods the same. * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.207 retrieving revision 2.208 diff -C2 -d -r2.207 -r2.208 *** stringobject.c 9 Apr 2003 19:31:57 -0000 2.207 --- stringobject.c 10 Apr 2003 22:35:32 -0000 2.208 *************** *** 1771,1780 **** PyDoc_STRVAR(strip__doc__, ! "S.strip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"); static PyObject * --- 1771,1780 ---- PyDoc_STRVAR(strip__doc__, ! "S.strip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"); static PyObject * *************** *** 1789,1797 **** PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"); static PyObject * --- 1789,1797 ---- PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"); static PyObject * *************** *** 1806,1814 **** PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"); static PyObject * --- 1806,1814 ---- PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([chars]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is unicode, S will be converted to unicode before stripping"); static PyObject * Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** unicodeobject.c 9 Apr 2003 19:32:45 -0000 2.186 --- unicodeobject.c 10 Apr 2003 22:35:32 -0000 2.187 *************** *** 5248,5257 **** PyDoc_STRVAR(strip__doc__, ! "S.strip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"); static PyObject * --- 5248,5257 ---- PyDoc_STRVAR(strip__doc__, ! "S.strip([chars]) -> unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"); static PyObject * *************** *** 5266,5274 **** PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"); static PyObject * --- 5266,5274 ---- PyDoc_STRVAR(lstrip__doc__, ! "S.lstrip([chars]) -> unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"); static PyObject * *************** *** 5283,5291 **** PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([sep]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"); static PyObject * --- 5283,5291 ---- PyDoc_STRVAR(rstrip__doc__, ! "S.rstrip([chars]) -> unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If chars is given and not None, remove characters in chars instead.\n\ ! If chars is a str, it will be converted to unicode before stripping"); static PyObject * From nnorwitz@users.sourceforge.net Fri Apr 11 04:05:58 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 10 Apr 2003 20:05:58 -0700 Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11875/Lib Modified Files: tarfile.py Log Message: Fix test_tarfile failure when gzip is not available The module would exist, but be empty if already imported. This change ensures we have gzip available. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tarfile.py 7 Mar 2003 15:36:41 -0000 1.6 --- tarfile.py 11 Apr 2003 03:05:56 -0000 1.7 *************** *** 924,928 **** try: import gzip ! except ImportError: raise CompressionError, "gzip module is not available" --- 924,929 ---- try: import gzip ! gzip.GzipFile ! except (ImportError, AttributeError): raise CompressionError, "gzip module is not available" From gvanrossum@users.sourceforge.net Fri Apr 11 15:17:24 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 11 Apr 2003 07:17:24 -0700 Subject: [Python-checkins] python/nondist/sandbox/sio sio.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sio In directory sc8-pr-cvs1:/tmp/cvs-serv22310 Modified Files: sio.py Log Message: Document more missing API aspects. Index: sio.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sio/sio.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sio.py 10 Apr 2003 01:00:04 -0000 1.3 --- sio.py 11 Apr 2003 14:17:20 -0000 1.4 *************** *** 23,29 **** next(). (There's also readall() but that's a synonym for read() without arguments.) This is a superset of the raw stream API. I ! haven't thought about fileno() and isatty() yet. We really need ! only one buffering stream implementation, which is a filtering ! stream. You typically take a basis stream, place zero or more filtering --- 23,30 ---- next(). (There's also readall() but that's a synonym for read() without arguments.) This is a superset of the raw stream API. I ! haven't thought about fileno() and isatty() yet, nor about ! truncate() or the various attributes like name and mode. Also, ! close() is not implemented right. We really need only one buffering ! stream implementation, which is a filtering stream. You typically take a basis stream, place zero or more filtering From fdrake@users.sourceforge.net Fri Apr 11 16:14:09 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:14:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_timeout.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19216 Modified Files: test_timeout.py Log Message: Avoid creating one of the TestSuite objects. Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_timeout.py 28 Feb 2003 19:53:34 -0000 1.12 --- test_timeout.py 11 Apr 2003 15:14:05 -0000 1.13 *************** *** 188,193 **** test_support.requires('network') ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(CreationTestCase)) suite.addTest(unittest.makeSuite(TimeoutTestCase)) test_support.run_suite(suite) --- 188,192 ---- test_support.requires('network') ! suite = unittest.makeSuite(CreationTestCase) suite.addTest(unittest.makeSuite(TimeoutTestCase)) test_support.run_suite(suite) From jackjansen@users.sourceforge.net Fri Apr 11 16:35:32 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 11 Apr 2003 08:35:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libaetools.tex,NONE,1.1 libgensuitemodule.tex,NONE,1.1 scripting.tex,NONE,1.1 libaepack.tex,1.2,1.3 libaetypes.tex,1.1,1.2 mac.tex,1.10,1.11 using.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv30924/mac Modified Files: libaepack.tex libaetypes.tex mac.tex using.tex Added Files: libaetools.tex libgensuitemodule.tex scripting.tex Log Message: Moved all the scripting stuff to a separate section, added all the missing bits (well, all the bits I could think of) and updated the rest. --- NEW FILE: libaetools.tex --- \section{\module{aetools} --- OSA client support} \declaremodule{standard}{aetools} \platform{Mac} %\moduleauthor{Jack Jansen?}{email} \modulesynopsis{Basic support for sending Apple Events} \sectionauthor{Jack Jansen}{Jack.Jansen@cwi.nl} The \module{aetools} module contains the basic functionality on which Python AppleScript client support is built. It also imports and re-exports the core functionality of the \module{aetypes} and \module{aepack} modules. The stub packages generated by \module{gensuitemodule} import the relevant portions of \module{aetools}, so usually you do not need to import it yourself. The exception to this is when you cannot use a generated suite package and need lower-level access to scripting. The \module{aetools} module itself uses the AppleEvent support provided by the \module{Carbon.AE} module. This has one drawback: you need access to the window manager, see section \ref{osx-gui-scripts} for details. This restriction may be lifted in future releases. The \module{aetools} module defines the following functions: \begin{funcdesc}{packevent}{ae, parameters, attributes} Stores parameters and attributes in a pre-created \code{Carbon.AE.AEDesc} object. \code{parameters} and \code{attributes} are dictionaries mapping 4-character OSA parameter keys to Python objects. The objects are packed using \code{aepack.pack()}. \end{funcdesc} \begin{funcdesc}{unpackevent}{ae\optional{, formodulename}} Recursively unpacks a \code{Carbon.AE.AEDesc} event to Python objects. The function returns the parameter dictionary and the attribute dictionary. The \code{formodulename} argument is used by generated stub packages to control where AppleScript classes are looked up. \end{funcdesc} \begin{funcdesc}{keysubst}{arguments, keydict} Converts a Python keyword argument dictionary \code{arguments} to the format required by \code{packevent} by replacing the keys, which are Python identifiers, by the four-character OSA keys according to the mapping specified in \code{keydict}. Used by the generated suite packages. \end{funcdesc} \begin{funcdesc}{enumsubst}{arguments, key, edict} If the \code{arguments} dictionary contains an entry for \code{key} convert the value for that entry according to dictionary \code{edict}. This converts human-readable Python enumeration names to the OSA 4-character codes. Used by the generated suite packages. \end{funcdesc} The \module{aetools} module defines the following class: \begin{classdesc}{TalkTo}{\optional{signature=None, start=0, timeout=0}} Base class for the proxy used to talk to an application. \code{signature} overrides the class attribute \code{_signature} (which is usually set by subclasses) and is the 4-char creator code defining the application to talk to. \code{start} can be set to true to enable running the application on class instantiation. \code{timeout} can be specified to change the default timeout used while waiting for an AppleEvent reply. \end{classdesc} \begin{methoddesc}{_start}{} Test whether the application is running, and attempt to start it if not. \end{methoddesc} \begin{methoddesc}{send}{code, subcode\optional{, parameters, attributes}} Create the AppleEvent \code{Carbon.AE.AEDesc} for the verb with the OSA designation \code{code, subcode} (which are the usual 4-character strings), pack the \code{parameters} and \code{attributes} into it, send it to the target application, wait for the reply, unpack the reply with \code{unpackevent} and return the reply appleevent, the unpacked return values as a dictionary and the return attributes. \end{methoddesc} --- NEW FILE: libgensuitemodule.tex --- \section{\module{gensuitemodule} --- Generate OSA stub packages} \declaremodule{standard}{gensuitemodule} \platform{Mac} %\moduleauthor{Jack Jansen?}{email} \modulesynopsis{Create a stub package from an OSA dictionary} \sectionauthor{Jack Jansen}{Jack.Jansen@cwi.nl} The \module{gensuitemodule} module creates a Python package implementing stub code for the AppleScript suites that are implemented by a specific application, according to its AppleScript dictionary. It is usually invoked by the user through the \program{PythonIDE}, but it can also be run as a script from the command line (pass \code{--help} for help on the options) or imported from Python code. For an example of its use see \file{Mac/scripts/genallsuites.py} in a source distribution, which generates the stub packages that are included in the standard library. It defines the following public functions: \begin{funcdesc}{is_scriptable}{application} Returns true if \code{application}, which should be passed as a pathname, appears to be scriptable. Take the return value with a grain of salt: \program{Internet Explorer} appears not to be scriptable but definitely is. \end{funcdesc} \begin{funcdesc}{processfile}{application\optional{, output, basepkgname, edit_modnames, creatorsignature, dump, verbose}} Create a stub package for \code{application}, which should be passed as a full pathname. For a \file{.app} bundle this is the pathname to the bundle, not to the executable inside the bundle; for an unbundled CFM application you pass the filename of the application binary. This function asks the application for its OSA terminology resources, decodes these resources and uses the resultant data