Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
imputil Namespace Reference

Data Structures

class  ImportManager
 doesn't work in JPython... More...
 
class  Importer
 
class  BuiltinImporter
 Emulate the import mechanism for builtin and frozen modules. More...
 
class  _FilesystemImporter
 
class  DynLoadSuffixImporter
 

Functions

def py_suffix_importer
 

Variables

list __all__ = ["ImportManager","Importer","BuiltinImporter"]
 
tuple _StringType = type('')
 
tuple _ModuleType = type(sys)
 
string _suffix_char = __debug__and'c'
 
string _suffix = '.py'
 
 _os_stat = None
 

Detailed Description

Import utilities

Exported classes:
    ImportManager   Manage the import process

    Importer        Base class for replacing standard import functions
    BuiltinImporter Emulate the import mechanism for builtin and frozen modules

    DynLoadSuffixImporter

Function Documentation

def imputil.py_suffix_importer (   filename,
  finfo,
  fqname 
)

Definition at line 577 of file imputil.py.

References aifc.open().

578 def py_suffix_importer(filename, finfo, fqname):
579  file = filename[:-3] + _suffix
580  t_py = long(finfo[8])
581  t_pyc = _timestamp(file)
582 
583  code = None
584  if t_pyc is not None and t_pyc >= t_py:
585  f = open(file, 'rb')
586  if f.read(4) == imp.get_magic():
587  t = struct.unpack('<I', f.read(4))[0]
588  if t == t_py:
589  code = marshal.load(f)
590  f.close()
591  if code is None:
592  file = filename
593  code = _compile(file, t_py)
594 
595  return 0, code, { '__file__' : file }

Variable Documentation

list __all__ = ["ImportManager","Importer","BuiltinImporter"]

Definition at line 22 of file imputil.py.

tuple _ModuleType = type(sys)

Definition at line 25 of file imputil.py.

_os_stat = None

Definition at line 434 of file imputil.py.

tuple _StringType = type('')

Definition at line 24 of file imputil.py.

string _suffix = '.py'

Definition at line 401 of file imputil.py.

string _suffix_char = __debug__and'c'

Definition at line 398 of file imputil.py.