You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/09/04 09:50:35 UTC

[08/10] thrift git commit: THRIFT-3910 Do not invoke pip as part of build process

THRIFT-3910 Do not invoke pip as part of build process

This closes #1073


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/bf9fa905
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/bf9fa905
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/bf9fa905

Branch: refs/heads/master
Commit: bf9fa905d22d2714670b5d492a319daf26f5a32c
Parents: 21b6d92
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Sun Sep 4 18:49:21 2016 +0900
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Sun Sep 4 18:49:21 2016 +0900

----------------------------------------------------------------------
 appveyor.yml                       |  1 +
 build/cmake/DefineOptions.cmake    |  3 +--
 build/cmake/FindPip.cmake          | 30 ------------------------------
 build/docker/centos/Dockerfile     |  6 ++++--
 build/docker/centos6/Dockerfile    |  3 +++
 build/docker/debian/Dockerfile     |  4 ++++
 build/docker/ubuntu/Dockerfile     |  4 ++++
 configure.ac                       | 26 ++++++++++++++++++--------
 lib/py/CMakeLists.txt              |  1 -
 lib/py/Makefile.am                 |  4 ----
 lib/py/requirements.txt            |  3 ---
 lib/py/setup.py                    | 14 ++++++++++++++
 lib/py/src/transport/TSSLSocket.py |  2 +-
 test/Makefile.am                   |  4 +++-
 test/py.twisted/Makefile.am        |  1 +
 15 files changed, 54 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index ffd5334..d68d3e3 100755
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -71,6 +71,7 @@ build_script:
 # - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin
 # - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin
 - set PATH=C:\Python27-x64\scripts;C:\Python27-x64;%PATH%
+- pip install ipaddress backports.ssl_match_hostname tornado twisted
 - mkdir cmake-build
 - cd cmake-build
 - cmake -G "Visual Studio 14 2015 Win64" -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=C:\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=C:\zlib-1.2.8 -DZLIB_LIBRARY=C:\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/build/cmake/DefineOptions.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index 01dae35..6dd59e0 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -103,9 +103,8 @@ endif()
 option(WITH_PYTHON "Build Python Thrift library" ON)
 find_package(PythonInterp QUIET) # for Python executable
 find_package(PythonLibs QUIET) # for Python.h
-find_package(Pip QUIET)
 CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build Python library" ON
-                       "BUILD_LIBRARIES;WITH_PYTHON;PYTHONLIBS_FOUND;PIP_FOUND" OFF)
+                       "BUILD_LIBRARIES;WITH_PYTHON;PYTHONLIBS_FOUND" OFF)
 
 # Haskell
 option(WITH_HASKELL "Build Haskell Thrift library" ON)

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/build/cmake/FindPip.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/FindPip.cmake b/build/cmake/FindPip.cmake
deleted file mode 100644
index 45fdb99..0000000
--- a/build/cmake/FindPip.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-
-
-#  PIP_FOUND - system has pip
-#  PIP_EXECUTABLE - the pip executable
-#
-# It will search the PATH environment variable
-
-include(FindPackageHandleStandardArgs)
-
-find_program(PIP_EXECUTABLE NAMES pip)
-find_package_handle_standard_args(PIP DEFAULT_MSG PIP_EXECUTABLE)
-mark_as_advanced(PIP_EXECUTABLE)

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/build/docker/centos/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/centos/Dockerfile b/build/docker/centos/Dockerfile
index f544a24..a31492b 100644
--- a/build/docker/centos/Dockerfile
+++ b/build/docker/centos/Dockerfile
@@ -56,9 +56,11 @@ RUN yum install -y \
 # Python Dependencies
 RUN yum install -y \
       python-devel \
+      python-pip \
       python-setuptools \
-      python-twisted-web \
-      python-pip
+      python-six \
+      python-twisted-web && \
+    pip install -U backports.ssl_match_hostname ipaddress tornado
 
 # Ruby Dependencies
 RUN yum install -y \

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/build/docker/centos6/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/centos6/Dockerfile b/build/docker/centos6/Dockerfile
index d0dc51a..4df75de 100644
--- a/build/docker/centos6/Dockerfile
+++ b/build/docker/centos6/Dockerfile
@@ -40,6 +40,9 @@ RUN yum install -y epel-release && \
       python-pip \
     && yum clean all
 
+# optional dependencies
+RUN pip install ipaddress backports.ssl_match_hostname tornado
+
 # 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 && \

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/build/docker/debian/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/debian/Dockerfile b/build/docker/debian/Dockerfile
index 22dd3b5..285c85b 100644
--- a/build/docker/debian/Dockerfile
+++ b/build/docker/debian/Dockerfile
@@ -145,6 +145,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
 # Ruby
 RUN gem install bundler --no-ri --no-rdoc
 
+# Python optional dependencies
+RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
+RUN pip3 install -U backports.ssl_match_hostname tornado
+
 # Go
 RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
 ENV PATH /usr/local/go/bin:$PATH

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/build/docker/ubuntu/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu/Dockerfile b/build/docker/ubuntu/Dockerfile
index 99f0a8f..2797a1c 100644
--- a/build/docker/ubuntu/Dockerfile
+++ b/build/docker/ubuntu/Dockerfile
@@ -163,6 +163,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
 # Ruby
 RUN gem install bundler --no-ri --no-rdoc
 
+# Python optional dependencies
+RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
+RUN pip3 install -U backports.ssl_match_hostname tornado
+
 # Go
 RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
 ENV PATH /usr/local/go/bin:$PATH

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index fb22699..b79094c 100755
--- a/configure.ac
+++ b/configure.ac
@@ -280,20 +280,25 @@ AM_CONDITIONAL(WITH_LUA, [test "$have_lua" = "yes"])
 AM_PATH_PYTHON(2.6,, :)
 AX_THRIFT_LIB(python, [Python], yes)
 if test "$with_python" = "yes";  then
-  AC_PATH_PROG([PIP], [pip])
-  AC_PATH_PROG([TRIAL], [trial])
-  if test -n "$TRIAL" && test "x$PYTHON" != "x" && test "x$PYTHON" != "x:" ; then
+  if test -n "$PYTHON"; then
     have_python="yes"
   fi
+  AC_PATH_PROG([TRIAL], [trial])
+  if test -n "$TRIAL"; then
+    have_trial="yes"
+  fi
 fi
 AM_CONDITIONAL(WITH_PYTHON, [test "$have_python" = "yes"])
+AM_CONDITIONAL(WITH_TWISTED_TEST, [test "$have_trial" = "yes"])
 
 # Find "python3" executable.
 # It's distro specific and far from ideal but needed to cross test py2-3 at once.
-AC_PATH_PROG([PYTHON3], [python3])
-AC_PATH_PROG([PIP3], [pip3])
-if test "x$PYTHON3" != "x" && test "x$PYTHON3" != "x:" && test "x$PIP3" != "x" ; then
-  have_py3="yes"
+# TODO: find "python2" if it's 3.x
+if python --version 2>&1 | grep -q "Python 2"; then
+  AC_PATH_PROGS([PYTHON3], [python3 python3.5 python35 python3.4 python34])
+  if test -n "$PYTHON3"; then
+    have_py3="yes"
+  fi
 fi
 AM_CONDITIONAL(WITH_PY3, [test "$have_py3" = "yes"])
 
@@ -859,7 +864,12 @@ if test "$have_python" = "yes" ; then
   echo
   echo "Python Library:"
   echo "   Using Python .............. : $PYTHON"
-  echo "   Using Trial ............... : $TRIAL"
+  if test "$have_py3" = "yes" ; then
+  echo "   Using Python3 ............. : $PYTHON3"
+  fi
+  if test "$have_trial" = "yes"; then
+  echo "   Using trial ............... : $TRIAL"
+  fi
 fi
 if test "$have_php" = "yes" ; then
   echo

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/lib/py/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/lib/py/CMakeLists.txt b/lib/py/CMakeLists.txt
index 2ec8b56..7bb91fe 100644
--- a/lib/py/CMakeLists.txt
+++ b/lib/py/CMakeLists.txt
@@ -20,7 +20,6 @@
 include_directories(${PYTHON_INCLUDE_DIRS})
 
 add_custom_target(python_build ALL
-    COMMAND ${PIP_EXECUTABLE} install -r requirements.txt || ${PIP_EXECUTABLE} install --user -r requirements.txt
     COMMAND ${PYTHON_EXECUTABLE} setup.py build
     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
     COMMENT "Building Python library"

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/lib/py/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/py/Makefile.am b/lib/py/Makefile.am
index f324715..fd9ce25 100644
--- a/lib/py/Makefile.am
+++ b/lib/py/Makefile.am
@@ -21,7 +21,6 @@ DESTDIR ?= /
 
 if WITH_PY3
 py3-build:
-	$(PIP3) install -r requirements.txt || $(PIP3) install --user -r requirements.txt
 	$(PYTHON3) setup.py build
 py3-test: py3-build
 	$(PYTHON3) test/thrift_json.py
@@ -32,7 +31,6 @@ py3-test:
 endif
 
 all-local: py3-build
-	$(PIP) install -r requirements.txt || $(PIP) install --user -r requirements.txt
 	$(PYTHON) setup.py build
 
 # We're ignoring prefix here because site-packages seems to be
@@ -40,7 +38,6 @@ all-local: py3-build
 # Old version (can't put inline because it's not portable).
 #$(PYTHON) setup.py install --prefix=$(prefix) --root=$(DESTDIR) $(PYTHON_SETUPUTIL_ARGS)
 install-exec-hook:
-	$(PIP) install -r requirements.txt
 	$(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PY_PREFIX) $(PYTHON_SETUPUTIL_ARGS)
 
 clean-local:
@@ -54,7 +51,6 @@ EXTRA_DIST = \
 	CMakeLists.txt \
 	coding_standards.md \
 	compat \
-	requirements.txt \
 	setup.py \
 	setup.cfg \
 	src \

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/lib/py/requirements.txt
----------------------------------------------------------------------
diff --git a/lib/py/requirements.txt b/lib/py/requirements.txt
deleted file mode 100644
index 2254a28..0000000
--- a/lib/py/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-six
-backports.ssl_match_hostname >= 3.5
-ipaddress

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/lib/py/setup.py
----------------------------------------------------------------------
diff --git a/lib/py/setup.py b/lib/py/setup.py
index ca10096..99b7172 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -78,6 +78,14 @@ def run_setup(with_binary):
     else:
         extensions = dict()
 
+    ssl_deps = []
+    if sys.version_info[0] == 2:
+        ssl_deps.append('ipaddress')
+    if sys.hexversion < 0x03050000:
+        ssl_deps.append('backports.ssl_match_hostname>=3.5')
+    tornado_deps = ['tornado>=4.0']
+    twisted_deps = ['twisted']
+
     setup(name='thrift',
           version='1.0.0-dev',
           description='Python bindings for the Apache Thrift RPC system',
@@ -86,6 +94,12 @@ def run_setup(with_binary):
           url='http://thrift.apache.org',
           license='Apache License 2.0',
           install_requires=['six>=1.7.2'],
+          extras_require={
+              'ssl': ssl_deps,
+              'tornado': tornado_deps,
+              'twisted': twisted_deps,
+              'all': ssl_deps + tornado_deps + twisted_deps,
+          },
           packages=[
               'thrift',
               'thrift.protocol',

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/lib/py/src/transport/TSSLSocket.py
----------------------------------------------------------------------
diff --git a/lib/py/src/transport/TSSLSocket.py b/lib/py/src/transport/TSSLSocket.py
index 12bc356..0f7d45e 100644
--- a/lib/py/src/transport/TSSLSocket.py
+++ b/lib/py/src/transport/TSSLSocket.py
@@ -346,7 +346,7 @@ class TSSLServerSocket(TSocket.TServerSocket, TSSLBase):
         TSSLBase.__init__(self, True, None, kwargs)
         TSocket.TServerSocket.__init__(self, host, port, unix_socket)
         if self._should_verify and not _match_has_ipaddress:
-            raise ValueError('Need ipaddress and backports.ssl_match_hostname'
+            raise ValueError('Need ipaddress and backports.ssl_match_hostname '
                              'module to verify client certificate')
 
     def setCertfile(self, certfile):

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/test/Makefile.am
----------------------------------------------------------------------
diff --git a/test/Makefile.am b/test/Makefile.am
index fb39a12..1a1bf47 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -53,8 +53,10 @@ endif
 if WITH_PYTHON
 SUBDIRS += py
 PRECROSS_TARGET += precross-py
-SUBDIRS += py.twisted
 SUBDIRS += py.tornado
+if WITH_TWISTED_TEST
+SUBDIRS += py.twisted
+endif
 endif
 
 if WITH_RUBY

http://git-wip-us.apache.org/repos/asf/thrift/blob/bf9fa905/test/py.twisted/Makefile.am
----------------------------------------------------------------------
diff --git a/test/py.twisted/Makefile.am b/test/py.twisted/Makefile.am
index 5020215..78cde22 100644
--- a/test/py.twisted/Makefile.am
+++ b/test/py.twisted/Makefile.am
@@ -18,6 +18,7 @@
 #
 
 THRIFT = $(top_builddir)/compiler/cpp/thrift
+TRIAL ?= trial
 
 stubs: ../ThriftTest.thrift ../SmallTest.thrift
 	$(THRIFT) --gen py:twisted ../ThriftTest.thrift