Changeset 612
- Timestamp:
- 07/10/03 16:46:57 (5 years ago)
- Files:
-
- trunk/RBFoundation/RBFoundation/Utilities.py (modified) (1 diff)
- trunk/RBFoundation/RBFoundation/XMLBuilder.py (modified) (1 diff)
- trunk/RBFoundation/RBFoundation/_InstallerHookUtilities.py (modified) (3 diffs)
- trunk/RBSkinning/support/Installer-hooks (added)
- trunk/RBSkinning/support/Installer-hooks/README (added)
- trunk/RBSkinning/support/Installer-hooks/hook-RBSkinning.dotSkin.py (added)
- trunk/RBSkinning/support/Installer-hooks/hook-RBSkinning.skin.py (added)
- trunk/RBSkinning/support/Installer-hooks/hook-RBSkinning.wxPythonSkin.py (added)
- trunk/RBSkinning/support/Installer-hooks/hook-RBSkinning.xhtml.py (added)
- trunk/RBSkinning/support/Installer-hooks/hook-RBSkinning.xmlObjectifySkin.py (added)
- trunk/RBSkinning/support/Installer-hooks/hook-RBSkinning.xmlPython.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/Utilities.py
r605 r612 57 57 58 58 def flatten(collection, level=1): 59 if is Iterable(collection):59 if isinstance(collection, (list, tuple)): 60 60 if level: 61 61 return [each for item in collection for each in flatten(item, level-1)] trunk/RBFoundation/RBFoundation/XMLBuilder.py
r576 r612 245 245 """Creates the Expat parser in a python-OO way.""" 246 246 parser = _ExpatParserCreate(self._encoding, self._seperator) 247 try: 248 #if using python 2.3 or above, the buffer text should speed things up 249 parser.buffer_text = True 250 except AttributeError: 251 # Otherwise, ignore the set attribute error 252 pass 253 247 254 parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 248 255 parser.StartElementHandler = WeakBindCallable(self._start_element) trunk/RBFoundation/RBFoundation/_InstallerHookUtilities.py
r291 r612 20 20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 21 22 """ 23 Requires path.py from: 24 Jason Orendorff <jason@jorendorff.com> (and others - see the url!) 25 http://www.jorendorff.com/articles/python/path 26 """ 27 22 28 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 29 #~ Imports … … 25 31 26 32 import os 33 try: 34 from path import path 35 except ImportError, e: 36 print """Requires path.py from: 37 Jason Orendorff <jason@jorendorff.com> (and others - see the url!) 38 http://www.jorendorff.com/articles/python/path 39 """ 40 raise 27 41 28 42 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 30 44 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 45 32 def MakePackageHook(Package, RootPackageName='Foundation', packageTypes=('.py','.pyw','.pyc','.pyo','.pyd')): 33 def MakeHooks(modules, dirname, dircontent): 34 prefix, package, packages = dirname, None, [] 35 while prefix and package != RootPackageName: 36 prefix, package = os.path.split(prefix) 37 assert package 38 packages.append(package) 39 packages.reverse() 46 def MakePackageHook(Package, recurse=True, includefiletypes=('*.py','*.pyw','*.pyc','*.pyo','*.pyd'), excludedirs=('CVS',)): 47 def GetPyModules(packagedir): 48 modules = {} 49 for filetype in includefiletypes: 50 for filename in packagedir.walkfiles(filetype ): 51 modules[filename.splitext()[0].name] = True 40 52 41 for name in dircontent: 42 idx = name.rfind('.py') 43 name, ext = name[:idx], name[idx:] 53 if recurse: 54 for dirname in packagedir.walkdirs(): 55 if dirname not in excludedirs: 56 for result in GetPyModules(dirname): 57 modules['%s.%s'%(dirname.name, result)] = True 58 return modules.keys() 44 59 45 if ext in packageTypes: 46 if name not in {'__init__':1}: 47 modulename = '.'.join(packages + [name]) 48 else: modulename = '.'.join(packages) 49 modules[modulename] = 1 50 60 packagedir = path(Package.__file__).splitpath()[0] 51 61 modules = {} 52 walkdir = os.path.split(Package.__file__)[0]53 os.path.walk(walkdir, MakeHooks, modules)62 for result in GetPyModules(packagedir): 63 modules['%s.%s'%(Package.__name__, result)] = True 54 64 return modules.keys() 55 65
