hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [16/28] incubator-hawq git commit: HAWQ-837. Add python modules into HAWQ code
Date Tue, 21 Jun 2016 02:41:32 GMT
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/_psi_test.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/_psi_test.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/_psi_test.py
new file mode 100644
index 0000000..c89935a
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/_psi_test.py
@@ -0,0 +1,145 @@
+# The MIT License
+#
+# Copyright (C) 2008-2009 Floris Bruynooghe
+#
+# Copyright (C) 2008-2009 Abilisoft Ltd.
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+import os
+import time
+import unittest
+
+import psi
+
+
+class ExceptionsTests(unittest.TestCase):
+    def test_attr_subclass(self):
+        self.assert_(issubclass(psi.AttrNotAvailableError, AttributeError))
+        self.assert_(issubclass(psi.AttrInsufficientPrivsError, AttributeError))
+        self.assert_(issubclass(psi.AttrNotImplementedError, AttributeError))
+
+    def test_attr_instances(self):
+        na = psi.AttrNotAvailableError()
+        ip = psi.AttrInsufficientPrivsError()
+        ni = psi.AttrNotImplementedError()
+        self.assert_(isinstance(na, AttributeError))
+        self.assert_(isinstance(ip, AttributeError))
+        self.assert_(isinstance(ni, AttributeError))
+
+    def test_resource_subclass(self):
+        self.assert_(issubclass(psi.MissingResourceError, Exception))
+
+    def test_resource_instance(self):
+        mr = psi.MissingResourceError()
+        self.assert_(isinstance(mr, Exception))
+
+
+class LoadavgTests(unittest.TestCase):
+    def test_type(self):
+        loadavg = psi.loadavg()
+        self.failUnless(isinstance(loadavg, tuple))
+
+    def test_len(self):
+        loadavg = psi.loadavg()
+        self.assertEqual(len(loadavg), 3)
+
+    def test_value_types(self):
+        loadavg = psi.loadavg()
+        for v in loadavg:
+            self.failUnless(isinstance(v, float))
+
+    def test_values(self):
+        psiavg = psi.loadavg()
+        if hasattr(os, 'getloadavg'):
+            osavg = os.getloadavg()
+            for i, j in zip(psiavg, osavg):
+                self.assertAlmostEqual(i, j)
+        else:
+            for l in psiavg:
+                self.assert_(0.0 <= l < 1000.0, '0.0 < %f < 1000.0'%l)
+
+
+class BoottimeTests(unittest.TestCase):
+    def test_timespec(self):
+        self.assert_(isinstance(psi.boottime(), psi.TimeSpec))
+
+    def test_gt_epoch(self):
+        bt = psi.boottime()
+        self.assert_(bt.timestamp() > 0, '%s > 0' % bt.timestamp())
+
+    def test_lt_now(self):
+        bt = psi.boottime()
+        now = time.time()
+        self.assert_(bt.timestamp() < now, '%s < %s' % (bt.timestamp(), now))
+
+    def test_boottime_calc(self):
+        psi_bt = psi.boottime()
+        calc_bt = time.time() - psi.uptime().timestamp()
+        calc_min = calc_bt - 2
+        calc_max = calc_bt + 2
+        self.assert_(calc_min < psi_bt.timestamp() < calc_max,
+                     '%s < %s < %s' % (calc_min, psi_bt.timestamp(), calc_max))
+
+
+class UptimeTests(unittest.TestCase):
+    def test_timedelta(self):
+        ut = psi.uptime()
+        self.assert_(isinstance(ut, psi.TimeSpec))
+
+    def test_uptime_gt_null(self):
+        self.assert_(psi.uptime().timestamp() > 0)
+
+    def test_uptime_calc(self):
+        psi_uptime = psi.uptime().timestamp()
+        calc_uptime = time.time() - psi.boottime().timestamp()
+        calc_min = calc_uptime - 2
+        calc_max = calc_uptime + 2
+        self.assert_(calc_min < psi_uptime < calc_max,
+                     "%s < %s < %s" % (calc_min, psi_uptime, calc_max))
+
+
+if hasattr(psi, 'getzoneid'):
+    class SolarisZonesTests(unittest.TestCase):
+        def test_getzoneid(self):
+            id = psi.getzoneid()
+            self.assert_(0 >= id)
+
+        def test_getzonenamebyid(self):
+            name = psi.getzonenamebyid(0)
+            self.assertEqual(name, 'global')
+
+        def test_getzonenamebyid_exception(self):
+            self.assertRaises(ValueError, psi.getzonenamebyid, -1)
+
+        def test_getzoneidbyname(self):
+            id = psi.getzoneidbyname('global')
+            self.assertEqual(id, 0)
+
+        def test_getzoneidbyname_exception(self):
+            # XXX This is brittle.
+            self.assertRaises(ValueError, psi.getzoneidbyname, 'foobar')
+
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/aixapp.c
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/aixapp.c b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/aixapp.c
new file mode 100644
index 0000000..6396975
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/aixapp.c
@@ -0,0 +1,34 @@
+/** Program to test AIX priority values
+ *
+ * This program will schedule itself on the SCHED_RR scheduler and set it's
+ * priority to 42.  Then it will print it's pid and do nothing for 10 minutes.
+ * You can finish it earlier by sending a SIGTERM.
+ 
+ * Since it changes the scheduler it will have to run as root and it will only
+ * run on AIX due to the AIX specific setpri() system call. */
+
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/sched.h>
+#include <unistd.h>
+
+
+int
+main(int argc, char **argv)
+{
+    int i;
+
+    if (setpri(0, 42) < 0) {
+        printf("%d: %s\nAre you root?\n", errno, strerror(errno));
+        return 1;
+    }
+
+    printf("%ld\n", (long)getpid());
+    fflush(stdout);
+
+    for (i = 0; i < 60; i++)
+        sleep(10);
+    return 0;
+}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/app.c
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/app.c b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/app.c
new file mode 100644
index 0000000..ee538c4
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/app.c
@@ -0,0 +1,19 @@
+/* Simple executable that will print it's pid and then do nothing for 10
+ * minutes.  You can finish it earlier by sending a SIGTERM. */
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+int
+main(int argc, char **argv)
+{
+    int i;
+
+    printf("%ld\n", (long)getpid());
+    fflush(stdout);
+
+    for (i = 0; i < 60; i++)
+        sleep(10);
+    return 0;
+}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/apphelper.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/apphelper.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/apphelper.py
new file mode 100644
index 0000000..ecff9ea
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/apphelper.py
@@ -0,0 +1,225 @@
+# The MIT License
+#
+# Copyright (C) 2009 Floris Bruynooghe
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Helper module for running test appllications"""
+
+
+import os
+import signal
+import sys
+
+try:
+    import subprocess
+except ImportError:
+    HAVE_SUBPROCESS = False
+    import popen2
+    import select
+else:
+    HAVE_SUBPROCESS = True
+
+
+__all__ = ['APP32', 'APP64', 'pscmd', 'TestApp']
+
+
+def can_run(file):
+    """Check if we can run a test application
+
+    Returns the filename if so, False otherwise.
+    """
+    if not os.path.exists(file):
+        return False
+    if HAVE_SUBPROCESS:
+        try:
+            p = subprocess.Popen([file], stdout=subprocess.PIPE)
+            p.stdout.read(1)
+        except OSError:
+            pass
+        else:
+            os.kill(p.pid, signal.SIGTERM)
+            p.wait()
+            return file
+    else:
+        p = popen2.Popen3(file, True)
+        rlist, wlist, xlist = select.select([p.fromchild, p.childerr], [], [])
+        if p.poll() == -1:
+            os.kill(p.pid, signal.SIGTERM)
+            p.wait()
+        stdout = p.fromchild.read()
+        stderr = p.childerr.read()
+        if stdout:
+            return file
+#     sys.stdout.write('%s not runnable, some tests will be skipped'
+#                      % os.path.basename(file))
+    return False
+
+
+APP32 = can_run(os.path.join(os.path.dirname(__file__), 'app32'))
+APP64 = can_run(os.path.join(os.path.dirname(__file__), 'app64'))
+
+
+def run(cmd):
+    """Invoke a command, return stdout
+
+    This is a small helper that runs on all supported Python versions.
+    `cmd` is a list of the command line arguments.
+    """
+    if HAVE_SUBPROCESS:
+        val = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
+    else:
+        val = os.popen(' '.join(cmdl)).read()
+    val = val.decode()
+    return val.strip()
+
+
+# Find the ps command.
+if os.path.exists('/bin/ps'):
+    PSCMD = '/bin/ps'
+elif os.path.exists('/usr/bin/ps'):
+    PSCMD = '/usr/bin/ps'
+else:
+    PSCMD = None
+
+
+def pscmd(item, pid=os.getpid()):
+    """Invoke ps -o %(item)s -p %(pid)d and return the result"""
+    pscmd = PSCMD
+    if item == 'sid' and os.uname()[0] == 'AIX':
+        pscmd = '/usr/sysv/bin/ps'
+    if item == 'sid' and os.uname()[0] == 'Darwin':
+        item = 'sess'
+    assert pscmd, 'ps command not found (%s), can not run test' % pscmd
+    if item == 'ni' and os.uname()[0] == 'SunOS':
+        item = 'nice'
+    if item == 'rssize' and os.uname()[0] in ['SunOS', 'Darwin']:
+        item = 'rss'
+    if item == 'pgrp' and os.uname()[0] in ['SunOS', 'AIX', 'Darwin']:
+        item = 'pgid'
+    cmdl = [pscmd, '-o', item, '-p', str(pid)]
+    if HAVE_SUBPROCESS:
+        val = subprocess.Popen(cmdl, stdout=subprocess.PIPE).communicate()[0]
+    else:
+        val = os.popen(' '.join(cmdl)).read()
+    val = val.decode()
+    val = val.strip().split()[-1]
+    if item == 'sess' and os.uname()[0] == 'Darwin':
+        # 'ps -o sess' on Darwin returns a hex value
+        val = int(val, 16)
+    return val
+
+
+class TestApp:
+    """Simple class to run test apps as subprocesses
+
+    This will work on all supported python versions (as opposed to the
+    subprocess module).  It will also ensure that the process is
+    actually running when the constructor returns.
+    """
+    def __init__(self, args, env=None):
+        """Create the instance
+
+        args:: Argument list as a Python list.
+        env:: Environment to run in.
+        """
+        self.args = args
+        self.env = env
+        self.pid = None
+        if HAVE_SUBPROCESS:
+            self.app = self._run_subprocess()
+        else:
+            self.app = self._run_fork()
+
+    def kill(self):
+        """Kill the process
+
+        Calling this more then once or on an already killed process
+        does not do any harm.
+        """
+        self.kill_to_zombie()
+        self.wait()
+
+    def kill_to_zombie(self):
+        """Kill the process, leaving it in a zombie state
+
+        This does not guarantee the process is in zombie state, it
+        might have been waited on somewhere else.
+        """
+        try:
+            os.kill(self.pid, signal.SIGTERM)
+        except OSError:
+            e = sys.exc_info()[1]
+            if not e.errno == 3:
+                raise
+
+    def wait(self):
+        """Wait for the process
+
+        If the process in no longer waitable, i.e. does no longer
+        exist, this will return immediately.
+        """
+        try:
+            if hasattr(self.app, 'wait'):
+                self.app.wait()
+            else:
+                os.waitpid(self.pid, 0)
+        except OSError:
+            e = sys.exc_info()[1]
+            if not e.errno == 10:
+                raise
+        self.pid = None
+
+    def _run_subprocess(self):
+        app =  subprocess.Popen(self.args, env=self.env, stdout=subprocess.PIPE)
+        self.pid = app.pid
+        app.stdout.read(1)
+        return app
+
+    def _run_fork(self):
+        # Based on popen2.Popen3 but simplified.
+        try:
+            MAXFD = os.sysconf('SC_OPEN_MAX')
+        except (AttributeError, ValueError):
+            MAXFD = 256
+        c2pread, c2pwrite = os.pipe()
+        pid = os.fork()
+        if pid == 0:            # child
+            os.dup2(c2pwrite, 1)
+            for i in xrange(3, MAXFD):
+                try:
+                    os.close(i)
+                except OSError:
+                    pass
+            try:
+                if self.env is not None:
+                    os.execve(self.args[0], self.args, self.env)
+                else:
+                    os.execv(self.args[0], self.args)
+            finally:
+                os._exit(1)
+        else:                   # parent
+            self.pid = pid
+            os.close(c2pwrite)
+            fromchild = os.fdopen(c2pread, 'r')
+            fromchild.read(1)
+            return None

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/arch_test.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/arch_test.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/arch_test.py
new file mode 100644
index 0000000..bb21020
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/arch_test.py
@@ -0,0 +1,68 @@
+# The MIT License
+#
+# Copyright (C) 2008-2009 Floris Bruynooghe
+#
+# Copyright (C) 2008-2009 Abilisoft Ltd.
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+import os
+import unittest
+
+import psi
+
+
+class ArchTests(unittest.TestCase):
+    def setUp(self):
+        self.arch = psi.arch.arch_type()
+
+    def test_type(self):
+        self.failUnless(isinstance(self.arch, psi.arch.ArchBase))
+
+    def test_singleton(self):
+        base = psi.arch.ArchBase()
+        self.assertEqual(id(self.arch), id(base))
+
+    def test_sysname(self):
+        self.assertEqual(self.arch.sysname, os.uname()[0])
+
+    def test_nodename(self):
+        self.assertEqual(self.arch.nodename, os.uname()[1])
+
+    def test_release(self):
+        self.assertEqual(self.arch.release, os.uname()[2])
+
+    def test_release_info(self):
+        rel = os.uname()[2].split('-')[0]
+        rel_info = tuple([int(i) for i in rel.split('.')])
+        self.assertEqual(self.arch.release_info, rel_info)
+
+    def test_version(self):
+        self.assertEqual(self.arch.version, os.uname()[3])
+
+    def test_machine(self):
+        self.assertEqual(self.arch.machine, os.uname()[4])
+
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/mount_test.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/mount_test.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/mount_test.py
new file mode 100644
index 0000000..51e1469
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/mount_test.py
@@ -0,0 +1,169 @@
+# The MIT License
+#
+# Copyright (C) 2009 Erick Tryzelaar
+#
+# Copyright (C) 2008-2009 Abilisoft Ltd.
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+import os
+import unittest
+
+import apphelper
+import psi.arch
+
+import psi.mount
+
+
+class MountAttrTests(unittest.TestCase):
+    def setUp(self):
+        self.mounts = psi.mount.mounts()
+        for mount in psi.mount.mounts():
+            if mount.mountpoint == '/':
+                break
+        self.m = mount
+        if isinstance(psi.arch.arch_type(), psi.arch.ArchLinux):
+            fd = open('/etc/mtab')
+            mtab = fd.readlines()
+            fd.close()
+            for line in mtab:
+                if line.split()[1] == '/':
+                    break
+            mount = line.split()
+            self.device = mount[0]
+            self.mountpoint = mount[1]
+            self.fstype = mount[2]
+            self.options = mount[3]
+        elif isinstance(psi.arch.arch_type(), psi.arch.ArchSunOS):
+            mounts = apphelper.run(['/usr/sbin/mount', '-p']).split('\n')
+            for line in mounts:
+                if line.split()[2] == '/':
+                    break
+            mount = line.split()
+            self.device = mount[0]
+            self.mountpoint = mount[2]
+            self.fstype = mount[3]
+            if len(mount) >= 7:
+                self.options = mount[6]
+            else:
+                self.options = ''
+            # Special case to find dev=XXXXX option
+            if psi.arch.arch_type().release_info > (5, 8):
+                mounts = apphelper.run(['/usr/sbin/mount', '-v']).split('\n')
+                for line in mounts:
+                    if line.split()[2] == '/':
+                        break
+                opts = line.split()[5]
+                opts = opts.split('/')
+                for o in opts:
+                    if o[:4] == 'dev=':
+                        break
+                self.options += ',' + o
+                self.options = self.options.strip(',')
+        elif isinstance(psi.arch.arch_type(), psi.arch.ArchAIX):
+            mounts = apphelper.run(['/usr/sbin/mount']).split('\n')[2:]
+            for line in mounts:
+                if line.split()[1] == '/':
+                    break
+            mount = line.split()
+            self.device = mount[0]
+            self.mountpoint = mount[1]
+            self.fstype = mount[2]
+            self.options = mount[-1]
+        elif isinstance(psi.arch.arch_type(), psi.arch.ArchDarwin):
+            mounts = apphelper.run(['/sbin/mount']).split('\n')
+            for line in mounts:
+                if line.split()[2] == '/':
+                    break
+            mount = line.split()
+            self.device = mount[0]
+            self.mountpoint = mount[2]
+            self.fstype = mount[3][1:-1]
+            self.options = ','.join(line[line.find('('):line.find(')')].split(', ')[1:])
+
+    def test_enumerate(self):
+        self.assert_(hasattr(self.mounts, '__iter__'))
+
+    def test_len(self):
+        self.assert_(len(list(self.mounts)) > 0)
+
+    def test_type(self):
+        for m in self.mounts:
+            self.assert_(isinstance(m, psi.mount.MountBase))
+
+    def test_remote(self):
+        local = len(list(psi.mount.mounts()))
+        remote = len(list(psi.mount.mounts(True)))
+        self.assert_(remote >= local, '%d >= %d' % (remote, local))
+
+    def test_device(self):
+        self.assertEqual(self.m.device, self.device)
+
+    def test_fstype(self):
+        self.assertEqual(self.m.fstype, self.fstype)
+
+    def test_options(self):
+        self.assertEqual(self.m.options, self.options)
+
+    def test_mountpoint(self):
+        self.assertEqual(self.m.mountpoint, self.mountpoint)
+
+    def test_total(self):
+        self.assert_(self.m.total > 0)
+
+    def test_free(self):
+        self.assert_(self.m.free > 0)
+        self.assert_(self.m.total > self.m.free)
+
+    def test_available(self):
+        self.assert_(self.m.available > 0)
+        self.assert_(self.m.free >= self.m.available,
+                     '%d > %d' % (self.m.free, self.m.available))
+
+    def test_inodes(self):
+        self.assert_(self.m.inodes > 0)
+
+    def test_free_inodes(self):
+        self.assert_(self.m.free_inodes > 0)
+        self.assert_(self.m.inodes > self.m.free_inodes)
+
+    def test_available_inodes(self):
+        self.assert_(self.m.available_inodes > 0)
+        self.assert_(self.m.free_inodes >= self.m.available_inodes,
+                     '%d > %d' % (self.m.free_inodes, self.m.available_inodes))
+
+
+class MountMethodsTests(unittest.TestCase):
+    def setUp(self):
+        for mount in psi.mount.mounts():
+            break
+        self.m = mount
+
+    def test_refresh(self):
+        mp = self.m.mountpoint
+        self.m.refresh()
+        self.assertEqual(mp, self.m.mountpoint)
+
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/process_test.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/process_test.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/process_test.py
new file mode 100644
index 0000000..bf09340
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/process_test.py
@@ -0,0 +1,673 @@
+# The MIT License
+#
+# Copyright (C) 2007 Chris Miles
+#
+# Copyright (C) 2008-2009 Floris Bruynooghe
+#
+# Copyright (C) 2008-2009 Abilisoft Ltd.
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Tests for the psi.process.Process class"""
+
+
+import grp
+import math
+import os
+import pwd
+import signal
+import sys
+import time
+import unittest
+import warnings
+
+from apphelper import *
+
+try:
+    import subprocess
+except ImportError:
+    HAVE_SUBPROCESS = False
+else:
+    HAVE_SUBPROCESS = True
+
+import psi
+import psi.arch
+import psi.process
+
+
+# Ignore FutureWarnings, we test those bits
+if sys.hexversion >= 0x02030000: # >= 2.3
+    warnings.simplefilter('ignore', FutureWarning)
+
+
+# Patch old versions of unittest
+if not hasattr(unittest.TestCase, 'assertTrue'):
+    unittest.TestCase.assertTrue = unittest.TestCase.failUnless
+if not hasattr(unittest.TestCase, 'assertFalse'):
+    unittest.TestCase.assertFalse = unittest.TestCase.failIf
+if not hasattr(unittest.TestCase, 'assertAlmostEqual'):
+    def assertAlmostEqual(self, first, second, places=7, msg=None):
+        """Stolen from Python 2.5"""
+        if round(second-first, places) != 0:
+            raise self.failureException(
+                msg or '%r != %r within %r places'
+                % (first, second, places))
+    unittest.TestCase.assertAlmostEqual = assertAlmostEqual
+
+
+def do_work():
+    """Make sure total CPU time of our process increases"""
+    t = 0
+    e = time.clock() + 0.05
+    if isinstance(psi.arch.arch_type(), psi.arch.ArchAIX):
+        e += 0.8
+    while t < e:
+        for i in range(100):
+            math.sin(i)
+        t = time.clock()
+
+
+class ExceptionTest(unittest.TestCase):
+    def test_class(self):
+        self.assert_(issubclass(psi.process.NoSuchProcessError,
+                                psi.MissingResourceError))
+
+    def test_instance(self):
+        np = psi.process.NoSuchProcessError('foo')
+        self.assert_(isinstance(np, psi.MissingResourceError))
+
+
+class ProcessInitTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+
+    def test_type(self):
+        self.assert_(isinstance(self.p, psi.process.Process))
+
+    def test_bad_kw_arg(self):
+        self.assertRaises(TypeError, psi.process.Process, foo=1)
+
+    def test_bad_pos_arg(self):
+        self.assertRaises(TypeError, psi.process.Process, 'foo')
+
+    def test_no_such_pid(self):
+        # may not work in rare circumstances ... see how we go
+        self.assertRaises(psi.process.NoSuchProcessError,
+                          psi.process.Process, pid=-1)
+
+    def test_pid(self):
+        self.assertEqual(self.p.pid, self.pid)
+
+
+class ProcessSpecialMethods(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+
+    def test_repr(self):
+        self.assertEqual('psi.process.Process(pid=%d)'%self.pid, repr(self.p))
+
+    def test_hash_works(self):
+        self.assertTrue(hash(self.p))
+
+    def test_hash_compare(self):
+        p = psi.process.Process(self.pid)
+        self.assertEqual(hash(self.p), hash(p))
+
+
+class RichCompareTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+        self.init = psi.process.Process(1)
+
+    def test_eq(self):
+        self.assertEqual(self.p, self.p)
+        self.assertEqual(self.p, psi.process.Process(self.pid))
+
+    def test_ne(self):
+        self.assertNotEqual(self.p, self.pid)
+        self.assertNotEqual(self.p, self.init)
+
+    def test_lt(self):
+        self.assertTrue(self.init < self.p)
+        self.assertFalse(self.p < self.p)
+        self.assertFalse(self.p < self.init)
+
+    def test_le(self):
+        self.assertTrue(self.init <= self.p)
+        self.assertTrue(self.p <= self.p)
+        self.assertFalse(self.p <= self.init)
+
+    def test_gt(self):
+        self.assertFalse(self.init > self.p)
+        self.assertFalse(self.p > self.p)
+        self.assertTrue(self.p > self.init)
+
+    def test_ge(self):
+        self.assertFalse(self.init >= self.p)
+        self.assertTrue(self.p >= self.p)
+        self.assertTrue(self.p >= self.init)
+
+
+class ProcessExeArgsEnvTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+        self.arch = psi.arch.arch_type()
+        self.args_short = ['abcdefghijklmnopqrtstuvw']
+        self.args_long = 50 * self.args_short
+        self.env = {'foo': 'fooenv',
+                    'bar': 'barenv',
+                    'baz': 'bazenv'}
+        self.app = None
+
+    def tearDown(self):
+        if self.app is not None:
+            self.app.kill()
+
+    def test_name(self):
+        # Lets assume that 'python' will at least appear inside our name
+        if isinstance(self.arch, psi.arch.ArchDarwin):
+            python_name = 'Python'  # OS X
+        else:
+            python_name = 'python'
+        self.assert_(self.p.name.find(python_name) >= 0)
+
+    def test_exe(self):
+        if (isinstance(self.arch, psi.arch.ArchLinux) or
+            (isinstance(self.arch, psi.arch.ArchSunOS) and
+             self.arch.release_info >= (5, 10))):
+            self.assertTrue(os.path.isabs(self.p.exe), self.p.exe)
+        elif isinstance(self.arch, psi.arch.ArchDarwin):
+            self.assertTrue(self.p.exe.endswith('Python'))
+        else:
+            self.assertTrue(self.p.exe.find('python') >= 0)
+
+    def test_args_simple(self):
+        self.assert_('python' ' '.join(self.p.args).lower())
+
+    def test_argc_simple(self):
+        self.assertTrue(self.p.argc > len(sys.argv))
+
+    def test_command(self):
+        calc_comm = ' '.join(self.p.args)
+        psi_comm = self.p.command
+        self.assertEqual(psi_comm, calc_comm[:len(psi_comm)])
+
+    def test_env_simple(self):
+        self.assertEqual(self.p.env['HOME'], os.path.expanduser('~'))
+
+
+    if APP32:
+        def test_env_32bit(self):
+            self.app = TestApp([APP32], env=self.env)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.env, self.env)
+
+        def test_args_32bit_short(self):
+            self.app = TestApp([APP32] + self.args_short)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.args, tuple([APP32] + self.args_short))
+
+        def test_args_32bit_long(self):
+            self.app = TestApp([APP32] + self.args_long)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.args, tuple([APP32] + self.args_long))
+
+        def test_args_32bit_longarg(self):
+            args = [APP32, 'arg_longer_then_fifty_characters'*2]
+            self.app = TestApp(args)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.args[1], args[1])
+
+        def test_argc_32bit(self):
+            self.app = TestApp([APP32, 'foo', 'bar'])
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.argc, 3)
+
+    if APP64:
+        def test_env_64bit(self):
+            self.app = TestApp([APP64], env=self.env)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.env, self.env)
+
+        def test_args_64bit_short(self):
+            self.app = TestApp([APP64] + self.args_short)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.args, tuple([APP64] + self.args_short))
+
+        def test_args_64bit_long(self):
+            self.app = TestApp([APP64] + self.args_long)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.args, tuple([APP64] + self.args_long))
+
+        def test_args_64bit_longarg(self):
+            args = [APP64, 'arg_longer_then_fifty_characters'*2]
+            self.app = TestApp(args)
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.args[1], args[1])
+
+        def test_argc_64bit(self):
+            self.app = TestApp([APP64] + ['foo', 'bar'])
+            p = psi.process.Process(self.app.pid)
+            self.assertEqual(p.argc, 3)
+
+
+class ProcessIdsTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+
+    def test_euid(self):
+        self.assertEqual(self.p.euid, os.geteuid())
+
+    def test_egid(self):
+        self.assertEqual(self.p.egid, os.getegid())
+
+    def test_ruid(self):
+        self.assertEqual(self.p.ruid, os.getuid())
+
+    def test_rgid(self):
+        self.assertEqual(self.p.rgid, os.getgid())
+
+
+class ProcessAttrsTest(unittest.TestCase):
+    def setUp(self):
+        self.arch = psi.arch.arch_type()
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+
+    def test_cwd(self):
+        if isinstance(self.arch, psi.arch.ArchDarwin):
+            self.assertRaises(psi.AttrNotAvailableError, getattr, self.p, 'cwd')
+        else:
+            self.assertEqual(os.path.normpath(self.p.cwd), os.getcwd())
+
+    def test_ppid(self):
+        self.assert_(self.p.ppid > 1)
+        self.assertEqual(type(self.p.ppid), type(self.p.pid))
+
+    def test_pgrp(self):
+        pgrp = pscmd('pgrp')
+        self.assertEqual(self.p.pgrp, int(pgrp))
+
+    def test_sid(self):
+        sid = pscmd('sid')
+        self.assertEqual(self.p.sid, int(sid))
+
+    def test_nthreads(self):
+        if isinstance(self.arch, psi.arch.ArchLinux) \
+                and self.arch.release[:3] == '2.4':
+            return
+        if isinstance(self.arch, psi.arch.ArchSunOS):
+            nlwp = pscmd('nlwp')
+            self.assertEqual(self.p.nthreads, int(nlwp))
+        else:
+            self.assertEqual(self.p.nthreads, 1)
+
+    def test_terminal(self):
+        if isinstance(self.arch, psi.arch.ArchSunOS) \
+                and self.arch.release in ['5.8', '5.9']:
+            return
+        if not HAVE_SUBPROCESS:
+            return
+
+        terminal = subprocess.Popen(['/usr/bin/tty'],
+                                    stdout=subprocess.PIPE).communicate()[0]
+        terminal = terminal.decode()
+        self.assertEqual(self.p.terminal, terminal.strip())
+
+    def test_status(self):
+        if isinstance(self.arch, psi.arch.ArchLinux):
+            self.assertEqual(self.p.status, psi.process.PROC_STATUS_RUNNING)
+        elif isinstance(self.arch, psi.arch.ArchSunOS):
+            if hasattr(psi.process, 'PROC_STATUS_SONPROC'):
+                self.assertEqual(self.p.status, psi.process.PROC_STATUS_SONPROC)
+            else:
+                self.assertEqual(self.p.status, psi.process.PROC_STATUS_SRUN)
+        elif isinstance(self.arch, psi.arch.ArchAIX):
+            self.assertEqual(self.p.status, psi.process.PROC_STATUS_SACTIVE)
+
+    def test_nice(self):
+        # XXX Also need to test non-default nice values.
+        ni = pscmd('ni')
+        self.assertEqual(self.p.nice, int(ni))
+
+
+class ProcessPriorityTest(unittest.TestCase):
+    if os.uname()[0] == 'AIX':
+        def test_range(self):
+            p = psi.process.Process(os.getpid())
+            self.assertTrue(0 <= p.priority <= 255)
+
+    # XXX Add tests_range like tests for Linux and SunOS.
+
+
+class ProcessTimeTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+        self.arch = psi.arch.arch_type()
+
+    def test_start_time(self):
+        self.assert_(isinstance(self.p.start_time, psi.TimeSpec))
+
+        # Due to rounding errors and CPUs being able to do lots within
+        # just one jiffie/tick it can appear that we started after
+        # now, at least on Linux.
+        # By assuming we haven't been running for more then 20 minutes
+        # we can more accurately detect if the timezone handling is correct
+
+        now = time.time() + 1
+        before_start = now - 20*60
+        self.assert_(before_start < self.p.start_time.timestamp() <= now,
+                     '%s < %s <= %s' %
+                     (before_start, self.p.start_time.timestamp(), now))
+
+        localnow = time.time() + time.timezone + 1
+        if time.daylight:
+            localnow += time.altzone
+        before_start = localnow - 20*60
+        self.assert_(before_start < self.p.start_time.mktime() <= localnow,
+                     '%s < %s <= %s' %
+                     (before_start, self.p.start_time.mktime(), localnow))
+
+    def test_jiffies(self):
+        if isinstance(self.arch, psi.arch.ArchLinux):
+            f = open('/proc/%d/stat' % self.pid)
+            try:
+                stat = f.read().split()
+            finally:
+                f.close()
+            self.assertEqual(self.p.jiffies, int(stat[21]))
+
+
+class ProcessCpuTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+
+    def test_cputime(self):
+        self.assert_(isinstance(self.p.cputime, psi.TimeSpec))
+        self.assert_(self.p.cputime >= (0, 0))
+
+    def test_utime(self):
+        self.assert_(isinstance(self.p.utime, psi.TimeSpec))
+        self.assert_(self.p.utime >= (0, 0))
+
+    def test_stime(self):
+        self.assert_(isinstance(self.p.stime, psi.TimeSpec))
+        self.assert_(self.p.stime >= (0, 0))
+
+    def test_cputime_sum(self):
+        variance = psi.TimeSpec(1, 0)
+        min = self.p.cputime - variance
+        max = self.p.cputime + variance
+        self.assert_(min < self.p.utime+self.p.stime < max,
+                     '%s < %s < %s' % (min, self.p.utime+self.p.stime, max))
+
+    def test_cputime_increases(self):
+        do_work()
+        p = psi.process.Process(self.pid)
+        assert self.p.cputime < p.cputime
+
+
+    if hasattr(psi.process.Process, 'pcpu'):
+        def test_pcpu(self):
+            self.assertTrue(0 <= self.p.pcpu <= 100)
+
+
+class ProcessMemTest(unittest.TestCase):
+    def setUp(self):
+        self.pid = os.getpid()
+        self.p = psi.process.Process(self.pid)
+        self.arch = psi.arch.arch_type()
+
+    def test_rss(self):
+        self.assert_(self.p.rss > 0)
+
+    def test_vsz(self):
+        self.assert_(self.p.vsz > 0)
+
+    def test_rss_vs_vsz(self):
+        if isinstance(self.arch, psi.arch.ArchAIX):
+            # On AIX the VSZ is only the data section of the virtual
+            # size since that's what ps(1) does there.  This means
+            # that often (but not always) the RSS value will be larger
+            # then the VSZ value, depending on the amount of data in
+            # the shared libraries.
+            return
+        self.assert_(self.p.rss < self.p.vsz,
+                     "%d < %d" % (self.p.rss, self.p.vsz))
+
+    def test_rss_ps(self):
+        rss = int(pscmd('rssize'))
+        rss_min = rss - rss*0.1
+        rss_max = rss + rss*0.1
+        self.assert_(rss_min < self.p.rss/1024 < rss_max,
+                     '%s < %s < %s' % (rss_min, self.p.rss/1024, rss_max))
+
+    def test_vsz_ps(self):
+        vsz = int(pscmd('vsz'))
+        self.assert_(vsz*0.8 < self.p.vsz/1024 < vsz*1.2,
+                     '%s < %s < %s' % (vsz*0.8, self.p.vsz/1024, vsz*1.2))
+
+
+class ConstantsTest(unittest.TestCase):
+    def test_status_codes(self):
+        stat_names = [s for s in dir(psi.process)
+                      if s.startswith('PROC_STATUS_')]
+        self.assert_(len(stat_names) > 0)
+        for name in stat_names:
+            attr = getattr(psi.process, name)
+            self.assert_(isinstance(attr, int))
+
+
+class ProcessPrivsTest(unittest.TestCase):
+    def test_init_works(self):
+        p = psi.process.Process(1)
+        self.assertEqual(p.euid, 0)
+
+
+if os.geteuid() == 0 and (APP32 or APP64):
+    class ProcessPriorityTest(unittest.TestCase):
+        def setUp(self):
+            self.appname = APP32 or APP64
+            self.app = None
+
+        def tearDown(self):
+            if self.app is not None:
+                self.app.kill()
+
+        if os.uname()[0] == 'Linux':
+            def test_sched_other(self):
+                self.app = TestApp(['/usr/bin/chrt',
+                                    '--other', '0', self.appname])
+                p = psi.process.Process(self.app.pid)
+                self.assertEqual(p.priority, 0)
+
+            def test_sched_fifo(self):
+                self.app = TestApp(['/usr/bin/chrt',
+                                    '--fifo', '42', self.appname])
+                p = psi.process.Process(self.app.pid)
+                self.assertEqual(p.priority, 42)
+
+            def test_sched_rr(self):
+                self.app = TestApp(['/usr/bin/chrt',
+                                    '--rr', '42', self.appname])
+                p = psi.process.Process(self.app.pid)
+                self.assertEqual(p.priority, 42)
+
+        if os.uname()[0] == 'SunOS':
+            def test_class_ts(self):
+                # This is a very bad class to test, we can't really
+                # assert anything since psi gets the real priority and
+                # not the user priority.  But on SunOS 8 the FX class
+                # is not available, so better have this test then none.
+                self.app = TestApp(['/usr/bin/priocntl', '-e',
+                                    '-c', 'TS', self.appname])
+                p = psi.process.Process(self.app.pid)
+                self.assertTrue(-60 <= p.priority <= 60,
+                                '-60 <= %d <= 60' % p.priority)
+
+            if psi.arch.arch_type().release_info > (5,8):
+                def test_class_fx(self):
+                    self.app = TestApp(['/usr/bin/priocntl', '-e',
+                                        '-c', 'FX', '-m', '60',
+                                        '-p', '42', self.appname])
+                    p = psi.process.Process(self.app.pid)
+                    self.assertEqual(p.priority, 42)
+
+        if os.uname()[0] == 'AIX':
+            def test_aixapp(self):
+                # aixapp runs under SCHED_RR at priority 42.
+                aixapp = os.path.join(os.path.dirname(__file__), 'aixapp')
+                self.app = TestApp([aixapp])
+                p = psi.process.Process(self.app.pid)
+                self.assertEqual(p.priority, 42)
+
+
+class RefreshTests(unittest.TestCase):
+    def test_refresh(self):
+        p = psi.process.Process(os.getpid())
+        pid = p.pid
+        ct = p.cputime
+        do_work()
+        p.refresh()
+        self.assertEqual(pid, p.pid)
+        self.assert_(ct < p.cputime, '%s < %s' % (ct, p.cputime))
+
+    def test_proc_gone(self):
+        app = TestApp(APP32 or APP64)
+        try:
+            p = psi.process.Process(app.pid)
+            app.kill()
+            app = None
+            self.assertRaises(psi.process.NoSuchProcessError, p.refresh)
+        finally:
+            if app is not None:
+                app.kill()
+
+
+class ChildrenTests(unittest.TestCase):
+    def setUp(self):
+        self.p = psi.process.Process(os.getpid())
+
+    def test_no_child(self):
+        children = self.p.children()
+        self.assertEqual(len(children), 0)
+
+    def test_one_child(self):
+        app = TestApp(APP32 or APP64)
+        try:
+            child = psi.process.Process(app.pid)
+            children = self.p.children()
+            self.assertEqual(len(children), 1)
+            self.assertEqual(children[0], child)
+        finally:
+            app.kill()
+
+
+class ExistsTests(unittest.TestCase):
+    def test_exists(self):
+        p = psi.process.Process(os.getpid())
+        self.assertEqual(p.exists(), True)
+
+    def test_dead(self):
+        app = TestApp(APP32 or APP64)
+        try:
+            p = psi.process.Process(app.pid)
+            app.kill()
+            app = None
+            self.assertEqual(p.exists(), False)
+        finally:
+            if app is not None:
+                app.kill()
+
+
+class KillTests(unittest.TestCase):
+    def setUp(self):
+        self.app = TestApp(APP32 or APP64)
+        self.p = psi.process.Process(self.app.pid)
+
+    def tearDown(self):
+        if self.app.pid:
+            self.app.kill()
+
+    def test_default(self):
+        self.p.kill()
+        t = 5.0
+        while t > 0:
+            os.waitpid(self.p.pid, os.WNOHANG)
+            if not self.p.exists():
+                break
+            time.sleep(0.05)
+            t -= 0.05
+        self.assertEqual(self.p.exists(), False)
+
+    def test_stop(self):
+        if isinstance(psi.arch.arch_type(), psi.arch.ArchLinux):
+            stop_status = psi.process.PROC_STATUS_STOPPED
+        else:
+            stop_status = psi.process.PROC_STATUS_SSTOP
+        self.p.kill(signal.SIGSTOP)
+        t = 5.0
+        while t > 0:
+            self.p.refresh()
+            if self.p.status == stop_status:
+                break
+            time.sleep(0.05)
+            t -= 0.05
+        self.assertEqual(self.p.status, stop_status)
+        self.p.kill(signal.SIGCONT)
+        self.p.refresh()
+        self.assertNotEqual(self.p.status, stop_status)
+        self.assertEqual(self.p.exists(), True)
+
+
+class ZombieTests(unittest.TestCase):
+    def setUp(self):
+        self.app = TestApp(APP32 or APP64)
+        self.app.kill_to_zombie()
+        a = psi.arch.arch_type()
+        if isinstance(a, psi.arch.ArchLinux):
+            self.zombie_stat = psi.process.PROC_STATUS_ZOMBIE
+        else:
+            self.zombie_stat = psi.process.PROC_STATUS_SZOMB
+
+    def tearDown(self):
+        if self.app.pid:
+            self.app.kill()
+
+    def test_zombie_no_err(self):
+        # Ensure no error during init when looking at a zombie
+        if isinstance(psi.arch.arch_type(), psi.arch.ArchDarwin):
+            # pause to allow process status to update
+            time.sleep(1)
+        p = psi.process.Process(self.app.pid)
+        self.assertEqual(p.status, self.zombie_stat)
+
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/processtable_test.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/processtable_test.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/processtable_test.py
new file mode 100644
index 0000000..ee38154
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/processtable_test.py
@@ -0,0 +1,90 @@
+# The MIT License
+#
+# Copyright (C) 2008-2009 Floris Bruynooghe
+#
+# Copyright (C) 2008-2009 Abilisoft Ltd.
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+import os
+import unittest
+
+import psi
+
+
+class ProcessTableTests(unittest.TestCase):
+    def setUp(self):
+        self.archtype = psi.arch.arch_type()
+        self.pt = psi.process.ProcessTable()
+
+    def test_type(self):
+        self.assert_(isinstance(self.pt, psi.process.ProcessTable))
+        self.assert_(isinstance(self.pt, dict))
+
+    def test_len_nonzero(self):
+        self.assert_(len(self.pt) > 0)
+
+    def test_keys(self):
+        self.assert_(1 in self.pt)
+
+    def test_vals(self):
+        init = self.pt[1]
+        self.assert_(isinstance(init, psi.process.Process))
+
+    def test_setitem(self):
+        self.assertRaises(TypeError, self.pt.__setitem__, 123, 'dummy')
+
+    def test_delitem(self):
+        self.assertRaises(TypeError, self.pt.__delitem__, 1)
+
+
+class ProcessAttributeTests(unittest.TestCase):
+    """Check the bahaviour of some process attributes
+
+    Some process attributes must be present on all processes, these
+    tests check for this.
+    """
+    def setUp(self):
+        self.archtype = psi.arch.arch_type()
+
+    def test_name(self):
+        for p in psi.process.ProcessTable().values():
+            self.assert_(p.name, str(p))
+
+    def test_argc(self):
+        for p in psi.process.ProcessTable().values():
+            try:
+                self.assert_(p.argc >= 0, '%s, argc=%s' % (p, p.argc))
+            except psi.AttrInsufficientPrivsError:
+                if isinstance(self.archtype, psi.arch.ArchDarwin):
+                    self.assert_(p.euid != os.geteuid())
+                else:
+                    raise
+    
+    def test_command(self):
+        for p in psi.process.ProcessTable().values():
+            self.assert_(p.command, str(p))
+
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/timespec_test.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/timespec_test.py b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/timespec_test.py
new file mode 100644
index 0000000..3cf9839
--- /dev/null
+++ b/tools/bin/pythonSrc/PSI-0.3b2_gp/tests/timespec_test.py
@@ -0,0 +1,233 @@
+# The MIT License
+#
+# Copyright (C) 2009 Erick Tryzelaar
+#
+# Copyright (C) 2009 Floris Bruynooghe
+#
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+import sys
+import time
+import unittest
+
+import psi
+
+try:
+    import datetime
+except ImportError:
+    HAVE_DATETIME = False
+else:
+    HAVE_DATETIME = True
+
+
+class TimeSpecTests(unittest.TestCase):
+    def setUp(self):
+        self.tv = psi.TimeSpec(5, 10)
+
+    def test_type(self):
+        self.assert_(isinstance(self.tv, psi.TimeSpec))
+
+    def test_init(self):
+        tv = psi.TimeSpec(5, 10)
+        self.assertEqual(tv.tv_sec, 5)
+        self.assertEqual(tv.tv_nsec, 10)
+        tv = psi.TimeSpec(tv_sec=6, tv_nsec=11)
+        self.assertEqual(tv.tv_sec, 6)
+        self.assertEqual(tv.tv_nsec, 11)
+
+    def test_init_normalise(self):
+        t = psi.TimeSpec(0, 1000000001)
+        self.assertEqual(t.tv_sec, 1)
+        self.assertEqual(t.tv_nsec, 1)
+        t = psi.TimeSpec(-1, -1000000001)
+        self.assertEqual(t.tv_sec, -1)
+        self.assertEqual(t.tv_nsec, -999999999)
+        t = psi.TimeSpec(0, -2000000000)
+        self.assertEqual(t.tv_sec, -2)
+        self.assertEqual(t.tv_nsec, 0)
+        t = psi.TimeSpec(-1, 500000000)
+        self.assertEqual(t.tv_sec, 0)
+        self.assertEqual(t.tv_nsec, -500000000)
+        t = psi.TimeSpec(1, -500000000)
+        self.assertEqual(t.tv_sec, 0)
+        self.assertEqual(t.tv_nsec, 500000000)
+
+    def test_tuple(self):
+        self.assertEqual(self.tv[0], 5)
+        self.assertEqual(self.tv[1], 10)
+        self.assertRaises(IndexError, self.tv.__getitem__, -1)
+        self.assertRaises(IndexError, self.tv.__getitem__, 2)
+
+    def test_hash(self):
+        self.assertEqual(hash(self.tv), hash(psi.TimeSpec(5, 10)))
+
+    def test_eq(self):
+        self.assertEqual(self.tv, psi.TimeSpec(5, 10))
+
+    def test_ne(self):
+        self.assertNotEqual(self.tv, psi.TimeSpec(5, 11))
+        self.assertNotEqual(self.tv, psi.TimeSpec(4, 10))
+        self.assertNotEqual(self.tv, psi.TimeSpec(4, 11))
+
+    def test_lt(self):
+        self.assert_(self.tv < psi.TimeSpec(5, 11))
+        self.assert_(self.tv < psi.TimeSpec(6, 10))
+        self.assert_(not self.tv < psi.TimeSpec(5, 9))
+        self.assert_(not self.tv < psi.TimeSpec(5, 10))
+
+    def test_lt_distorted(self):
+        self.assert_(self.tv < psi.TimeSpec(4, 1000000015))
+
+    def test_le(self):
+        self.assert_(self.tv <= psi.TimeSpec(5, 11))
+        self.assert_(self.tv <= psi.TimeSpec(5, 10))
+        self.assert_(not self.tv <= psi.TimeSpec(5, 9))
+
+    def test_gt(self):
+        self.assert_(self.tv > psi.TimeSpec(5, 9))
+        self.assert_(not self.tv > psi.TimeSpec(5, 10))
+
+    def test_gt_distorted(self):
+        self.assert_(psi.TimeSpec(4, 1000000015) > self.tv)
+
+    def test_ge(self):
+        self.assert_(self.tv >= psi.TimeSpec(5, 10))
+        self.assert_(self.tv >= psi.TimeSpec(5, 9))
+        self.assert_(not self.tv >= psi.TimeSpec(5, 11))
+
+    def test_compare_tuple(self):
+        self.assert_(self.tv > (5, 9))
+        self.assert_(self.tv >= (5, 9))
+        self.assert_(self.tv == (5, 10))
+        self.assert_((5, 10) == self.tv)
+        self.assert_(self.tv <= (5, 11))
+        self.assert_(self.tv < (5, 11))
+
+    def test_compare_int(self):
+        self.assert_(self.tv > 5)
+        self.assert_(self.tv != 5)
+        self.assert_(self.tv < 6)
+
+    def test_compare_float(self):
+        self.assert_(self.tv > 5.0)
+        self.assert_(self.tv != 5.0)
+        self.assert_(self.tv < 5.1)
+
+    if sys.version_info[0] < 3:
+        def test_compare_tuple_long(self):
+            self.assert_(self.tv == (long(5), long(10)))
+
+    def test_add(self):
+        self.assertEqual(self.tv + psi.TimeSpec(5, 10), psi.TimeSpec(10, 20))
+
+    def test_add_rollover(self):
+        sum = self.tv + psi.TimeSpec(0, 999999995)
+        self.assertEqual(sum, psi.TimeSpec(6, 5))
+
+    def test_add_tuple(self):
+        self.assertEqual(self.tv + (5, 10), psi.TimeSpec(10, 20))
+
+    def test_add_tuple_bad(self):
+        self.assertEqual(self.tv.__add__((5, 10, 0)), NotImplemented)
+
+    def test_add_int(self):
+        self.assertEqual(self.tv + 5, psi.TimeSpec(10, 10))
+
+    def test_add_float(self):
+        self.assertEqual(self.tv + 5.5, psi.TimeSpec(10, 500000010))
+
+    def test_sub(self):
+        self.assertEqual(self.tv - psi.TimeSpec(1, 5), psi.TimeSpec(4, 5))
+
+    def test_sub_rollover(self):
+        self.assertEqual(self.tv - psi.TimeSpec(0, 15),
+                         psi.TimeSpec(4, 999999995))
+
+    def test_sub_tuple(self):
+        self.assertEqual(self.tv - (1, 5), psi.TimeSpec(4, 5))
+
+    def test_sub_tuple_bad(self):
+        self.assertEqual(self.tv.__sub__((1, 5, 0)), NotImplemented)
+
+    def test_sub_int(self):
+        self.assertEqual(self.tv - 1, psi.TimeSpec(4, 10))
+
+    def test_sub_float(self):
+        self.assertEqual(self.tv - 1.5, psi.TimeSpec(3, 500000010))
+
+    def test_bool(self):
+        self.assertEqual(bool(self.tv), True)
+        self.assertEqual(bool(psi.TimeSpec(0, 0)), False)
+        self.assertEqual(bool(psi.TimeSpec(-1, -1)), True)
+
+
+class TimeSpecMethodsTests(unittest.TestCase):
+    def setUp(self):
+        self.tv = psi.TimeSpec(5, 500000000)
+
+    def test_timestamp(self):
+        self.assertEqual(self.tv.timestamp(), 5.5)
+
+    def test_float(self):
+        self.assertEqual(self.tv.float(), 5.5)
+
+    def test_mktime(self):
+        if time.daylight:
+            t = 5.5 + time.timezone + time.altzone
+        else:
+            t = 5.5 + time.timezone
+        self.assertEqual(self.tv.mktime(), t)
+
+    def test_timetuple(self):
+        self.assertEqual(self.tv.timetuple(), time.gmtime(5.5))
+
+    def test_gmtime(self):
+        self.assertEqual(self.tv.gmtime(), time.gmtime(5.5))
+
+    def test_localtime(self):
+        self.assertEqual(self.tv.localtime(), time.localtime(5.5))
+
+    def test_utcdatetime(self):
+        if HAVE_DATETIME:
+            self.assertEqual(self.tv.utcdatetime(),
+                             datetime.datetime.utcfromtimestamp(5.5))
+        else:
+            self.assert_(not hasattr(self.tv, 'utcdatetime'))
+
+    def test_datetime(self):
+        if HAVE_DATETIME:
+            self.assertEqual(self.tv.datetime(),
+                             datetime.datetime.fromtimestamp(5.5))
+        else:
+            self.assert_(not hasattr(self.tv, 'datetime'))
+
+    def test_timedelta(self):
+        if HAVE_DATETIME:
+            self.assertEqual(self.tv.timedelta(),
+                             datetime.timedelta(seconds=5, microseconds=500000))
+        else:
+            self.assert_(not hasattr(self.tv, 'timedelta'))
+
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/2.4.diff
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/2.4.diff b/tools/bin/pythonSrc/lockfile-0.9.1/2.4.diff
new file mode 100644
index 0000000..72318d5
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/2.4.diff
@@ -0,0 +1,99 @@
+Index: lockfile/sqlitelockfile.py
+===================================================================
+--- lockfile/sqlitelockfile.py	(revision 93)
++++ lockfile/sqlitelockfile.py	(working copy)
+@@ -1,9 +1,7 @@
+-from __future__ import absolute_import, division
+-
+ import time
+ import os
+ 
+-from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
++from lockfile import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
+ 
+ class SQLiteLockFile(LockBase):
+     "Demonstrate SQL-based locking."
+Index: lockfile/__init__.py
+===================================================================
+--- lockfile/__init__.py	(revision 93)
++++ lockfile/__init__.py	(working copy)
+@@ -24,16 +24,14 @@
+ >>> lock = LockFile('somefile')
+ >>> print lock.is_locked()
+ False
+->>> with lock:
+-...    print lock.is_locked()
+-True
+->>> print lock.is_locked()
+-False
+ 
+ >>> lock = LockFile('somefile')
+ >>> # It is okay to lock twice from the same thread...
+->>> with lock:
+-...     lock.acquire()
++>>> lock.acquire()
++>>> try:
++...   lock.acquire()
++... finally:
++...   lock.release()
+ ...
+ >>> # Though no counter is kept, so you can't unlock multiple times...
+ >>> print lock.is_locked()
+Index: lockfile/mkdirlockfile.py
+===================================================================
+--- lockfile/mkdirlockfile.py	(revision 93)
++++ lockfile/mkdirlockfile.py	(working copy)
+@@ -1,12 +1,10 @@
+-from __future__ import absolute_import, division
+-
+ import time
+ import os
+ import sys
+ import errno
+ 
+-from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
+-               AlreadyLocked)
++from lockfile import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
++                      AlreadyLocked)
+ 
+ class MkdirLockFile(LockBase):
+     """Lock file by creating a directory."""
+Index: lockfile/pidlockfile.py
+===================================================================
+--- lockfile/pidlockfile.py	(revision 96)
++++ lockfile/pidlockfile.py	(working copy)
+@@ -12,15 +12,13 @@
+ """ Lockfile behaviour implemented via Unix PID files.
+     """
+ 
+-from __future__ import absolute_import
+-
+ import os
+ import sys
+ import errno
+ import time
+ 
+-from . import (LockBase, AlreadyLocked, LockFailed, NotLocked, NotMyLock,
+-               LockTimeout)
++from lockfile import (LockBase, AlreadyLocked, LockFailed, NotLocked,
++                      NotMyLock, LockTimeout)
+ 
+ 
+ class PIDLockFile(LockBase):
+Index: lockfile/linklockfile.py
+===================================================================
+--- lockfile/linklockfile.py	(revision 93)
++++ lockfile/linklockfile.py	(working copy)
+@@ -1,10 +1,8 @@
+-from __future__ import absolute_import
+-
+ import time
+ import os
+ 
+-from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
+-               AlreadyLocked)
++from lockfile import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
++                      AlreadyLocked)
+ 
+ class LinkLockFile(LockBase):
+     """Lock access to a file using atomic property of link(2).

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/ACKS
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/ACKS b/tools/bin/pythonSrc/lockfile-0.9.1/ACKS
new file mode 100644
index 0000000..44519d1
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/ACKS
@@ -0,0 +1,6 @@
+Thanks to the following people for help with lockfile.
+
+  Scott Dial
+  Ben Finney
+  Frank Niessink
+  Konstantin Veretennicov

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/LICENSE
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/LICENSE b/tools/bin/pythonSrc/lockfile-0.9.1/LICENSE
new file mode 100644
index 0000000..610c079
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/LICENSE
@@ -0,0 +1,21 @@
+This is the MIT license: http://www.opensource.org/licenses/mit-license.php
+
+Copyright (c) 2007 Skip Montanaro.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/MANIFEST
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/MANIFEST b/tools/bin/pythonSrc/lockfile-0.9.1/MANIFEST
new file mode 100644
index 0000000..d302eef
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/MANIFEST
@@ -0,0 +1,19 @@
+2.4.diff
+ACKS
+LICENSE
+MANIFEST
+README
+RELEASE-NOTES
+setup.py
+doc/Makefile
+doc/conf.py
+doc/glossary.rst
+doc/index.rst
+doc/lockfile.rst
+lockfile/__init__.py
+lockfile/linklockfile.py
+lockfile/mkdirlockfile.py
+lockfile/pidlockfile.py
+lockfile/sqlitelockfile.py
+test/compliancetest.py
+test/test_lockfile.py

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/PKG-INFO
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/PKG-INFO b/tools/bin/pythonSrc/lockfile-0.9.1/PKG-INFO
new file mode 100644
index 0000000..7d897e8
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/PKG-INFO
@@ -0,0 +1,51 @@
+Metadata-Version: 1.0
+Name: lockfile
+Version: 0.9.1
+Summary: Platform-independent file locking module
+Home-page: http://code.google.com/p/pylockfile/
+Author: Skip Montanaro
+Author-email: skip@pobox.com
+License: MIT License
+Download-URL: http://code.google.com/p/pylockfile/downloads/detail?name=lockfile-0.9.1.tar.gz
+Description: The lockfile package exports a LockFile class which provides a simple API for
+        locking files.  Unlike the Windows msvcrt.locking function, the fcntl.lockf
+        and flock functions, and the deprecated posixfile module, the API is
+        identical across both Unix (including Linux and Mac) and Windows platforms.
+        The lock mechanism relies on the atomic nature of the link (on Unix) and
+        mkdir (on Windows) system calls.  An implementation based on SQLite is also
+        provided, more as a demonstration of the possibilities it provides than as
+        production-quality code.
+        
+        Note: In version 0.9 the API changed in two significant ways:
+        
+         * It changed from a module defining several classes to a package containing
+           several modules, each defining a single class.
+        
+         * Where classes had been named SomethingFileLock before the last two words
+           have been reversed, so that class is now SomethingLockFile.
+        
+        The previous module-level definitions of LinkFileLock, MkdirFileLock and
+        SQLiteFileLock will be retained until the 1.0 release.
+        
+        Download from:
+        
+            http://code.google.com/p/pylockfile/
+        
+        To install:
+        
+            python setup.py install
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: MacOS
+Classifier: Operating System :: Microsoft :: Windows :: Windows NT/2000
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.4
+Classifier: Programming Language :: Python :: 2.5
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.0
+Classifier: Topic :: Software Development :: Libraries :: Python Modules

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/README
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/README b/tools/bin/pythonSrc/lockfile-0.9.1/README
new file mode 100644
index 0000000..128b1f3
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/README
@@ -0,0 +1,27 @@
+The lockfile package exports a LockFile class which provides a simple API for
+locking files.  Unlike the Windows msvcrt.locking function, the fcntl.lockf
+and flock functions, and the deprecated posixfile module, the API is
+identical across both Unix (including Linux and Mac) and Windows platforms.
+The lock mechanism relies on the atomic nature of the link (on Unix) and
+mkdir (on Windows) system calls.  An implementation based on SQLite is also
+provided, more as a demonstration of the possibilities it provides than as
+production-quality code.
+
+Note: In version 0.9 the API changed in two significant ways:
+
+ * It changed from a module defining several classes to a package containing
+   several modules, each defining a single class.
+
+ * Where classes had been named SomethingFileLock before the last two words
+   have been reversed, so that class is now SomethingLockFile.
+
+The previous module-level definitions of LinkFileLock, MkdirFileLock and
+SQLiteFileLock will be retained until the 1.0 release.
+
+Download from:
+
+    http://code.google.com/p/pylockfile/
+
+To install:
+
+    python setup.py install

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/RELEASE-NOTES
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/RELEASE-NOTES b/tools/bin/pythonSrc/lockfile-0.9.1/RELEASE-NOTES
new file mode 100644
index 0000000..8b452ed
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/RELEASE-NOTES
@@ -0,0 +1,50 @@
+Version 0.9.1
+=============
+
+* This release moves the source location to Google Code.
+
+* Threaded support is currently broken.  (It might not actually be broken.
+  It might just be the tests which are broken.)
+
+Version 0.9
+===========
+
+* The lockfile module was reorganized into a package.
+
+* The names of the three main classes have changed as follows:
+
+    LinkFileLock -> LinkLockFile
+    MkdirFileLock -> MkdirLockFile
+    SQLiteFileLock -> SQLiteLockFile
+
+* A PIDLockFile class was added.
+
+Version 0.3
+===========
+
+* Fix 2.4.diff file error.
+
+* More documentation updates.
+
+Version 0.2
+===========
+
+* Added 2.4.diff file to patch lockfile to work with Python 2.4 (removes use
+  of with statement).
+
+* Renamed _FileLock base class to LockBase to expose it (and its docstrings)
+  to pydoc.
+
+* Got rid of time.sleep() calls in tests (thanks to Konstantin
+  Veretennicov).
+
+* Use thread.get_ident() as the thread discriminator.
+
+* Updated documentation a bit.
+
+* Added RELEASE-NOTES.
+
+Version 0.1
+===========
+
+* First release - All basic functionality there.

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/doc/Makefile
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/doc/Makefile b/tools/bin/pythonSrc/lockfile-0.9.1/doc/Makefile
new file mode 100644
index 0000000..1b1e8d2
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/doc/Makefile
@@ -0,0 +1,73 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html      to make standalone HTML files"
+	@echo "  pickle    to make pickle files (usable by e.g. sphinx-web)"
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  changes   to make an overview over all changed/added/deprecated items"
+	@echo "  linkcheck to check all external links for integrity"
+
+clean:
+	-rm -rf .build/*
+
+html:
+	mkdir -p .build/html .build/doctrees
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) .build/html
+	@echo
+	@echo "Build finished. The HTML pages are in .build/html."
+
+pickle:
+	mkdir -p .build/pickle .build/doctrees
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) .build/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files or run"
+	@echo "  sphinx-web .build/pickle"
+	@echo "to start the sphinx-web server."
+
+web: pickle
+
+htmlhelp:
+	mkdir -p .build/htmlhelp .build/doctrees
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in .build/htmlhelp."
+
+latex:
+	mkdir -p .build/latex .build/doctrees
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in .build/latex."
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+	      "run these through (pdf)latex."
+
+changes:
+	mkdir -p .build/changes .build/doctrees
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes
+	@echo
+	@echo "The overview file is in .build/changes."
+
+linkcheck:
+	mkdir -p .build/linkcheck .build/doctrees
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in .build/linkcheck/output.txt."
+
+html.zip: html
+	(cd .build/html ; zip -r ../../$@ *)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/doc/conf.py
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/doc/conf.py b/tools/bin/pythonSrc/lockfile-0.9.1/doc/conf.py
new file mode 100644
index 0000000..64678e9
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/doc/conf.py
@@ -0,0 +1,179 @@
+# -*- coding: utf-8 -*-
+#
+# lockfile documentation build configuration file, created by
+# sphinx-quickstart on Sat Sep 13 17:54:17 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('some/directory'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['.templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'lockfile'
+
+# General substitutions.
+project = 'lockfile'
+copyright = '2008, Skip Montanaro'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '0.3'
+# The full version, including alpha/beta/rc tags.
+release = '0.3'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directories, that shouldn't be searched
+# for source files.
+#exclude_dirs = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['.static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'lockfiledoc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+  ('lockfile', 'lockfile.tex', 'lockfile Documentation',
+   'Skip Montanaro', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/doc/glossary.rst
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/doc/glossary.rst b/tools/bin/pythonSrc/lockfile-0.9.1/doc/glossary.rst
new file mode 100644
index 0000000..9401d48
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/doc/glossary.rst
@@ -0,0 +1,15 @@
+.. _glossary:
+
+********
+Glossary
+********
+
+.. if you add new entries, keep the alphabetical sorting!
+
+.. glossary::
+
+   context manager
+      An object which controls the environment seen in a :keyword:`with`
+      statement by defining :meth:`__enter__` and :meth:`__exit__` methods.
+      See :pep:`343`.
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/lockfile-0.9.1/doc/index.rst
----------------------------------------------------------------------
diff --git a/tools/bin/pythonSrc/lockfile-0.9.1/doc/index.rst b/tools/bin/pythonSrc/lockfile-0.9.1/doc/index.rst
new file mode 100644
index 0000000..9718a68
--- /dev/null
+++ b/tools/bin/pythonSrc/lockfile-0.9.1/doc/index.rst
@@ -0,0 +1,22 @@
+.. lockfile documentation master file, created by sphinx-quickstart on Sat Sep 13 17:54:17 2008.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to lockfile's documentation!
+====================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   lockfile.rst
+   glossary.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+


Mime
View raw message