Back to index

enigmail  1.4.3
Public Member Functions | Public Attributes | Static Public Attributes
pymake.process.PythonJob Class Reference
Inheritance diagram for pymake.process.PythonJob:
Inheritance graph
[legend]
Collaboration diagram for pymake.process.PythonJob:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def run
def notify
def get_callback

Public Attributes

 module
 method
 argv
 env
 cwd
 pycommandpath
 exitcode

Static Public Attributes

 done = False

Detailed Description

A job that calls a Python method.

Definition at line 186 of file process.py.


Constructor & Destructor Documentation

def pymake.process.PythonJob.__init__ (   self,
  module,
  method,
  argv,
  env,
  cwd,
  pycommandpath = None 
)

Definition at line 190 of file process.py.

00190 
00191     def __init__(self, module, method, argv, env, cwd, pycommandpath=None):
00192         self.module = module
00193         self.method = method
00194         self.argv = argv
00195         self.env = env
00196         self.cwd = cwd
00197         self.pycommandpath = pycommandpath or []


Member Function Documentation

def pymake.process.Job.get_callback (   self,
  condition 
) [inherited]

Definition at line 138 of file process.py.

00138 
00139     def get_callback(self, condition):
00140         return lambda result: self.notify(condition, result)

Here is the call graph for this function:

def pymake.process.Job.notify (   self,
  condition,
  result 
) [inherited]

Definition at line 131 of file process.py.

00131 
00132     def notify(self, condition, result):
00133         condition.acquire()
00134         self.done = True
00135         self.exitcode = result
00136         condition.notify()
00137         condition.release()

Here is the caller graph for this function:

Definition at line 198 of file process.py.

00198 
00199     def run(self):
00200         oldenv = os.environ
00201         try:
00202             os.chdir(self.cwd)
00203             os.environ = self.env
00204             if self.module not in sys.modules:
00205                 load_module_recursive(self.module,
00206                                       sys.path + self.pycommandpath)
00207             if self.module not in sys.modules:
00208                 print >>sys.stderr, "No module named '%s'" % self.module
00209                 return -127                
00210             m = sys.modules[self.module]
00211             if self.method not in m.__dict__:
00212                 print >>sys.stderr, "No method named '%s' in module %s" % (method, module)
00213                 return -127
00214             m.__dict__[self.method](self.argv)
00215         except PythonException, e:
00216             print >>sys.stderr, e
00217             return e.exitcode
00218         except:
00219             e = sys.exc_info()[1]
00220             if isinstance(e, SystemExit) and (e.code == 0 or e.code == '0'):
00221                 pass # sys.exit(0) is not a failure
00222             else:
00223                 print >>sys.stderr, e
00224                 print >>sys.stderr, traceback.print_exc()
00225                 return -127
00226         finally:
00227             os.environ = oldenv
00228         return 0

Here is the call graph for this function:


Member Data Documentation

Definition at line 193 of file process.py.

Definition at line 195 of file process.py.

pymake.process.Job.done = False [static, inherited]

Definition at line 126 of file process.py.

Definition at line 194 of file process.py.

Definition at line 129 of file process.py.

Definition at line 192 of file process.py.

Definition at line 191 of file process.py.

Definition at line 196 of file process.py.


The documentation for this class was generated from the following file: