THRIFT-3515 Python 2.6 compatibility and test on CI

This closes #766
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index 342e040..695a615 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -42,46 +42,50 @@
 
 # C++
 option(WITH_CPP "Build C++ Thrift library" ON)
-find_package(Boost 1.53 QUIET)
+if(WITH_CPP)
+    find_package(Boost 1.53 QUIET)
+    # NOTE: Currently the following options are C++ specific,
+    # but in future other libraries might reuse them.
+    # So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
+    # has no effect.
+    if(ZLIB_LIBRARY)
+        # FindZLIB.cmake does not normalize path so we need to do it ourselves.
+        file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY)
+    endif()
+    find_package(ZLIB QUIET)
+    CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
+                           "ZLIB_FOUND" OFF)
+    find_package(Libevent QUIET)
+    CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON
+                           "Libevent_FOUND" OFF)
+    find_package(Qt4 QUIET COMPONENTS QtCore QtNetwork)
+    CMAKE_DEPENDENT_OPTION(WITH_QT4 "Build with Qt4 support" ON
+                           "QT4_FOUND" OFF)
+    find_package(Qt5 QUIET COMPONENTS Core Network)
+    CMAKE_DEPENDENT_OPTION(WITH_QT5 "Build with Qt5 support" ON
+                           "Qt5_FOUND" OFF)
+    if(${WITH_QT4} AND ${WITH_QT5} AND ${CMAKE_MAJOR_VERSION} LESS 3)
+      # cmake < 3.0.0 causes conflict when building both Qt4 and Qt5
+      set(WITH_QT4 OFF)
+    endif()
+    find_package(OpenSSL QUIET)
+    CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
+                           "OPENSSL_FOUND" OFF)
+    option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
+    CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" OFF
+        "NOT WITH_STDTHREADS;Boost_FOUND" OFF)
+endif()
 CMAKE_DEPENDENT_OPTION(BUILD_CPP "Build C++ library" ON
                        "BUILD_LIBRARIES;WITH_CPP;Boost_FOUND" OFF)
-# NOTE: Currently the following options are C++ specific,
-# but in future other libraries might reuse them.
-# So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
-# has no effect.
-if(ZLIB_LIBRARY)
-    # FindZLIB.cmake does not normalize path so we need to do it ourselves.
-    file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY)
-endif()
-find_package(ZLIB QUIET)
-CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
-                       "ZLIB_FOUND" OFF)
-find_package(Libevent QUIET)
-CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON
-                       "Libevent_FOUND" OFF)
-find_package(Qt4 QUIET COMPONENTS QtCore QtNetwork)
-CMAKE_DEPENDENT_OPTION(WITH_QT4 "Build with Qt4 support" ON
-                       "QT4_FOUND" OFF)
-find_package(Qt5 QUIET COMPONENTS Core Network)
-CMAKE_DEPENDENT_OPTION(WITH_QT5 "Build with Qt5 support" ON
-                       "Qt5_FOUND" OFF)
-if(${WITH_QT4} AND ${WITH_QT5} AND ${CMAKE_MAJOR_VERSION} LESS 3)
-  # cmake < 3.0.0 causes conflict when building both Qt4 and Qt5
-  set(WITH_QT4 OFF)
-endif()
-find_package(OpenSSL QUIET)
-CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
-                       "OPENSSL_FOUND" OFF)
-option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
-CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" OFF
-    "NOT WITH_STDTHREADS;Boost_FOUND" OFF)
-
 
 # C GLib
 option(WITH_C_GLIB "Build C (GLib) Thrift library" ON)
-find_package(GLIB QUIET COMPONENTS gobject)
+if(WITH_C_GLIB)
+    find_package(GLIB QUIET COMPONENTS gobject)
+endif()
 CMAKE_DEPENDENT_OPTION(BUILD_C_GLIB "Build C (GLib) library" ON
                        "BUILD_LIBRARIES;WITH_C_GLIB;GLIB_FOUND" OFF)
+
 # Java
 option(WITH_JAVA "Build Java Thrift library" ON)
 if(ANDROID)
diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake
old mode 100755
new mode 100644
diff --git a/build/docker/centos6/Dockerfile b/build/docker/centos6/Dockerfile
new file mode 100644
index 0000000..0e571c5
--- /dev/null
+++ b/build/docker/centos6/Dockerfile
@@ -0,0 +1,49 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Apache Thrift Docker build environment for Centos 6
+#
+# This file is intended for testing old packages that are not available for
+# latest Ubuntu LTS/Debian/CentOS. Currently, it is only used for Python 2.6.
+#
+
+FROM centos:6
+MAINTAINER Apache Thrift <dev@thrift.apache.org>
+
+RUN yum install -y \
+      autoconf \
+      bison \
+      bison-devel \
+      clang \
+      flex \
+      gcc \
+      gcc-c++ \
+      git \
+      libtool \
+      m4 \
+      make \
+      perl \
+      tar \
+      python-devel \
+      python-setuptools \
+      python-twisted-web \
+      python-six \
+    && yum clean all
+
+# CMake
+RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
+    cd cmake-3.4.1 && ./bootstrap && make -j4 && make install
+
+ENV THRIFT_ROOT /thrift
+RUN mkdir -p $THRIFT_ROOT/src
+COPY scripts $THRIFT_ROOT
+WORKDIR $THRIFT_ROOT/src
diff --git a/build/docker/centos6/scripts/keepit b/build/docker/centos6/scripts/keepit
new file mode 100644
index 0000000..cb885df
--- /dev/null
+++ b/build/docker/centos6/scripts/keepit
@@ -0,0 +1 @@
+keep it