Example #1
0
 def get_environ(self):
     """
     This dictionary is added to our environment for a child process.
     """
     environ = os.environ.copy()
     environ.update(self.environ)
     environ.update({
         'SERVICE_URL': str(self.url),
         'SERVICE_PATH': str(self.path),
         'SERVICE_JSON': json.dumps(self.simple()),
         'SERVICE_MANAGER_PATH': self._manager.path,
     })
     
     # Place our path in the Path:
     path_insert(environ, 'PATH', os.path.abspath(os.curdir))
     path_insert(environ, 'PATH', os.path.abspath(self.path))
     
     environ['OLDPWD'] = environ.get('PWD', '')
     environ['PWD'] = os.path.abspath(self.path) 
     
     return environ
Example #2
0
 def get_environ(self):
     environ = super(PythonService, self).get_environ()
     
     ### Put our virtual env in the environ
     if self.virtualenv:
         path = os.path.abspath(os.path.join(self.path, self.virtualenv))
         environ['VIRTUAL_ENV'] = path
         logging.info("Using virtualenv: %s", path)
         path_insert(environ, 'PATH', os.path.join(path, 'bin'))
     
     path_insert(environ, 'PYTHONPATH', os.path.abspath(os.curdir))
     path_insert(environ, 'PYTHONPATH', os.path.abspath(self.path))
     
     return environ