summaryrefslogtreecommitdiff
path: root/eggs/py-1.4.0-py2.6.egg/py/_process
diff options
context:
space:
mode:
authorNishanth Amuluru2011-01-11 22:41:51 +0530
committerNishanth Amuluru2011-01-11 22:41:51 +0530
commitb03203c8cb991c16ac8a3d74c8c4078182d0bb48 (patch)
tree7cf13b2deacbfaaec99edb431b83ddd5ea734a52 /eggs/py-1.4.0-py2.6.egg/py/_process
parent0c50203cd9eb94b819883c3110922e873f003138 (diff)
downloadpytask-b03203c8cb991c16ac8a3d74c8c4078182d0bb48.tar.gz
pytask-b03203c8cb991c16ac8a3d74c8c4078182d0bb48.tar.bz2
pytask-b03203c8cb991c16ac8a3d74c8c4078182d0bb48.zip
removed all the buildout files
Diffstat (limited to 'eggs/py-1.4.0-py2.6.egg/py/_process')
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/__init__.py1
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/__init__.pyobin228 -> 0 bytes
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.py53
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.pyobin2480 -> 0 bytes
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.py108
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.pyobin4063 -> 0 bytes
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/killproc.py23
-rw-r--r--eggs/py-1.4.0-py2.6.egg/py/_process/killproc.pyobin1496 -> 0 bytes
8 files changed, 0 insertions, 185 deletions
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/__init__.py b/eggs/py-1.4.0-py2.6.egg/py/_process/__init__.py
deleted file mode 100644
index 86c714a..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-""" high-level sub-process handling """
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/__init__.pyo b/eggs/py-1.4.0-py2.6.egg/py/_process/__init__.pyo
deleted file mode 100644
index ba8dde5..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/__init__.pyo
+++ /dev/null
Binary files differ
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.py b/eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.py
deleted file mode 100644
index 4ceb647..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.py
+++ /dev/null
@@ -1,53 +0,0 @@
-"""
-
-"""
-
-import os, sys
-import subprocess
-import py
-from subprocess import Popen, PIPE
-
-def cmdexec(cmd):
- """ return unicode output of executing 'cmd' in a separate process.
-
- raise cmdexec.ExecutionFailed exeception if the command failed.
- the exception will provide an 'err' attribute containing
- the error-output from the command.
- if the subprocess module does not provide a proper encoding/unicode strings
- sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
- """
- process = subprocess.Popen(cmd, shell=True,
- universal_newlines=True,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, err = process.communicate()
- if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
- try:
- default_encoding = sys.getdefaultencoding() # jython may not have it
- except AttributeError:
- default_encoding = sys.stdout.encoding or 'UTF-8'
- out = unicode(out, process.stdout.encoding or default_encoding)
- err = unicode(err, process.stderr.encoding or default_encoding)
- status = process.poll()
- if status:
- raise ExecutionFailed(status, status, cmd, out, err)
- return out
-
-class ExecutionFailed(py.error.Error):
- def __init__(self, status, systemstatus, cmd, out, err):
- Exception.__init__(self)
- self.status = status
- self.systemstatus = systemstatus
- self.cmd = cmd
- self.err = err
- self.out = out
-
- def __str__(self):
- return "ExecutionFailed: %d %s\n%s" %(self.status, self.cmd, self.err)
-
-# export the exception under the name 'py.process.cmdexec.Error'
-cmdexec.Error = ExecutionFailed
-try:
- ExecutionFailed.__module__ = 'py.process.cmdexec'
- ExecutionFailed.__name__ = 'Error'
-except (AttributeError, TypeError):
- pass
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.pyo b/eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.pyo
deleted file mode 100644
index 10d45bf..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/cmdexec.pyo
+++ /dev/null
Binary files differ
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.py b/eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.py
deleted file mode 100644
index 604412c..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.py
+++ /dev/null
@@ -1,108 +0,0 @@
-
-"""
- ForkedFunc provides a way to run a function in a forked process
- and get at its return value, stdout and stderr output as well
- as signals and exitstatusus.
-
- XXX see if tempdir handling is sane
-"""
-
-import py
-import os
-import sys
-import marshal
-
-class ForkedFunc(object):
- EXITSTATUS_EXCEPTION = 3
- def __init__(self, fun, args=None, kwargs=None, nice_level=0):
- if args is None:
- args = []
- if kwargs is None:
- kwargs = {}
- self.fun = fun
- self.args = args
- self.kwargs = kwargs
- self.tempdir = tempdir = py.path.local.mkdtemp()
- self.RETVAL = tempdir.ensure('retval')
- self.STDOUT = tempdir.ensure('stdout')
- self.STDERR = tempdir.ensure('stderr')
-
- pid = os.fork()
- if pid: # in parent process
- self.pid = pid
- else: # in child process
- self._child(nice_level)
-
- def _child(self, nice_level):
- # right now we need to call a function, but first we need to
- # map all IO that might happen
- # make sure sys.stdout points to file descriptor one
- sys.stdout = stdout = self.STDOUT.open('w')
- sys.stdout.flush()
- fdstdout = stdout.fileno()
- if fdstdout != 1:
- os.dup2(fdstdout, 1)
- sys.stderr = stderr = self.STDERR.open('w')
- fdstderr = stderr.fileno()
- if fdstderr != 2:
- os.dup2(fdstderr, 2)
- retvalf = self.RETVAL.open("wb")
- EXITSTATUS = 0
- try:
- if nice_level:
- os.nice(nice_level)
- try:
- retval = self.fun(*self.args, **self.kwargs)
- retvalf.write(marshal.dumps(retval))
- except:
- excinfo = py.code.ExceptionInfo()
- stderr.write(excinfo.exconly())
- EXITSTATUS = self.EXITSTATUS_EXCEPTION
- finally:
- stdout.close()
- stderr.close()
- retvalf.close()
- os.close(1)
- os.close(2)
- os._exit(EXITSTATUS)
-
- def waitfinish(self, waiter=os.waitpid):
- pid, systemstatus = waiter(self.pid, 0)
- if systemstatus:
- if os.WIFSIGNALED(systemstatus):
- exitstatus = os.WTERMSIG(systemstatus) + 128
- else:
- exitstatus = os.WEXITSTATUS(systemstatus)
- #raise ExecutionFailed(status, systemstatus, cmd,
- # ''.join(out), ''.join(err))
- else:
- exitstatus = 0
- signal = systemstatus & 0x7f
- if not exitstatus and not signal:
- retval = self.RETVAL.open('rb')
- try:
- retval_data = retval.read()
- finally:
- retval.close()
- retval = marshal.loads(retval_data)
- else:
- retval = None
- stdout = self.STDOUT.read()
- stderr = self.STDERR.read()
- self._removetemp()
- return Result(exitstatus, signal, retval, stdout, stderr)
-
- def _removetemp(self):
- if self.tempdir.check():
- self.tempdir.remove()
-
- def __del__(self):
- self._removetemp()
-
-class Result(object):
- def __init__(self, exitstatus, signal, retval, stdout, stderr):
- self.exitstatus = exitstatus
- self.signal = signal
- self.retval = retval
- self.out = stdout
- self.err = stderr
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.pyo b/eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.pyo
deleted file mode 100644
index 502d8f9..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/forkedfunc.pyo
+++ /dev/null
Binary files differ
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/killproc.py b/eggs/py-1.4.0-py2.6.egg/py/_process/killproc.py
deleted file mode 100644
index 18e8310..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/killproc.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import py
-import os, sys
-
-if sys.platform == "win32" or getattr(os, '_name', '') == 'nt':
- try:
- import ctypes
- except ImportError:
- def dokill(pid):
- py.process.cmdexec("taskkill /F /PID %d" %(pid,))
- else:
- def dokill(pid):
- PROCESS_TERMINATE = 1
- handle = ctypes.windll.kernel32.OpenProcess(
- PROCESS_TERMINATE, False, pid)
- ctypes.windll.kernel32.TerminateProcess(handle, -1)
- ctypes.windll.kernel32.CloseHandle(handle)
-else:
- def dokill(pid):
- os.kill(pid, 15)
-
-def kill(pid):
- """ kill process by id. """
- dokill(pid)
diff --git a/eggs/py-1.4.0-py2.6.egg/py/_process/killproc.pyo b/eggs/py-1.4.0-py2.6.egg/py/_process/killproc.pyo
deleted file mode 100644
index 57c276a..0000000
--- a/eggs/py-1.4.0-py2.6.egg/py/_process/killproc.pyo
+++ /dev/null
Binary files differ