THRIFT-3613 Port Python C extension to Python 3
Client: Python
Patch: Nobuaki Sukegawa

This closes #845
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index 8819821..070560c 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -19,16 +19,15 @@
 # under the License.
 #
 from __future__ import division
-import glob
 import logging
 import os
 import sys
 import time
 from optparse import OptionParser
 
+from util import local_libpath
+
 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
-ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
-DEFAULT_LIBDIR_GLOB = os.path.join(ROOT_DIR, 'lib', 'py', 'build', 'lib.*')
 
 
 class TestHandler(object):
@@ -300,10 +299,7 @@
     logging.basicConfig(level=options.verbose)
 
     sys.path.insert(0, os.path.join(SCRIPT_DIR, options.genpydir))
-    if options.libpydir:
-        sys.path.insert(0, glob.glob(options.libpydir)[0])
-    else:
-        sys.path.insert(0, glob.glob(DEFAULT_LIBDIR_GLOB)[0])
+    sys.path.insert(0, local_libpath())
 
     from ThriftTest import ThriftTest
     from ThriftTest.ttypes import Xtruct, Xception, Xception2, Insanity