home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1964 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  1.8 KB  |  51 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __docformat__ = 'restructuredtext en'
  5. import os
  6. import types
  7.  
  8. def tarModule(mod):
  9.     if not isinstance(mod, types.ModuleType):
  10.         raise TypeError, 'Pass an imported module to push_module'
  11.     isinstance(mod, types.ModuleType)
  12.     (module_dir, module_file) = os.path.split(mod.__file__)
  13.     print 'Locating the module...'
  14.     if '__init__.py' in module_file:
  15.         module_name = module_dir.split('/')[-1]
  16.         module_dir = '/'.join(module_dir.split('/')[:-1])
  17.         module_file = module_name
  18.     else:
  19.         module_name = module_file.split('.')[0]
  20.         module_dir = module_dir
  21.     print 'Module (%s) found in:\n%s' % (module_name, module_dir)
  22.     if module_dir:
  23.         os.system('tar -cf %s.tar -C %s %s' % (module_name, module_dir, module_file))
  24.     else:
  25.         os.system('tar -cf %s.tar %s' % (module_name, module_file))
  26.     tarball_name = module_name + '.tar'
  27.     tar_file = open(tarball_name, 'rb')
  28.     fileString = tar_file.read()
  29.     tar_file.close()
  30.     return (tarball_name, fileString)
  31.  
  32.  
  33. def curry(f, *curryArgs, **curryKWargs):
  34.     
  35.     def curried(*args, **kwargs):
  36.         dikt = dict(kwargs)
  37.         dikt.update(curryKWargs)
  38.         return f(*curryArgs + args, **dikt)
  39.  
  40.     return curried
  41.  
  42.  
  43. def catcher(r):
  44.     pass
  45.  
  46.  
  47. def printer(r, msg = ''):
  48.     print '%s\n%r' % (msg, r)
  49.     return r
  50.  
  51.