You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2014/11/22 12:06:22 UTC

[4/6] qpid-proton git commit: Revert "PROTON-630: add setup.py for python bindings"

Revert "PROTON-630: add setup.py for python bindings"

This reverts commit 4252758bd3772470bd255d034d3abea157429504.


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

Branch: refs/heads/master
Commit: f5cbab5eafeae5bf9e713db1c897c77b2022bfdc
Parents: 2276c09
Author: Rafael Schloming <rh...@alum.mit.edu>
Authored: Fri Nov 21 22:32:34 2014 -0500
Committer: Rafael Schloming <rh...@alum.mit.edu>
Committed: Sat Nov 22 06:03:01 2014 -0500

----------------------------------------------------------------------
 proton-c/bindings/python/CMakeLists.txt |  79 +++++++++-----------
 proton-c/bindings/python/setup.py.in    | 107 ---------------------------
 2 files changed, 34 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f5cbab5e/proton-c/bindings/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/CMakeLists.txt b/proton-c/bindings/python/CMakeLists.txt
index b8cdb57..c7eb4aa 100644
--- a/proton-c/bindings/python/CMakeLists.txt
+++ b/proton-c/bindings/python/CMakeLists.txt
@@ -17,8 +17,8 @@
 # under the License.
 #
 
-# NB For python the SWIG module name must have the same name as the
-# input .i file for CMake to generate the correct dependencies
+# NB For python the SWIG module name must have the same name as the input .i file for CMake to generate the
+# correct dependencies
 
 set(CMAKE_SWIG_FLAGS "-threads")
 
@@ -39,15 +39,27 @@ set_target_properties(${SWIG_MODULE_cproton_REAL_NAME}
 
 find_package(PythonInterp REQUIRED)
 
-# configure the files needed for generating Pypi packages. Packages
-# can be generated by running "python setup.py" from the build
-# directory.
-get_filename_component(PN_SWIG_PYTHON_C_WRAPPER
-                       ${swig_generated_file_fullname} NAME)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/proton.py
-               ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in
-               ${CMAKE_CURRENT_BINARY_DIR}/setup.py @ONLY)
+if (CHECK_SYSINSTALL_PYTHON)
+  execute_process(COMMAND ${PYTHON_EXECUTABLE}
+    -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True)"
+    OUTPUT_VARIABLE PYTHON_SITEARCH_PACKAGES_DEFAULT
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+else ()
+  set (PYTHON_SITEARCH_PACKAGES_DEFAULT ${BINDINGS_DIR}/python)
+endif ()
+
+if (NOT PYTHON_SITEARCH_PACKAGES)
+  set (PYTHON_SITEARCH_PACKAGES ${PYTHON_SITEARCH_PACKAGES_DEFAULT})
+endif()
+
+install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile cproton.py
+                              WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
+install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile cproton.py
+                              WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
+install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile proton.py
+                              WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
+install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile proton.py
+                              WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
 
 find_program(EPYDOC_EXE epydoc)
 mark_as_advanced (EPYDOC_EXE)
@@ -63,37 +75,14 @@ if (EPYDOC_EXE)
            ${OPTIONAL_ARG})
 endif (EPYDOC_EXE)
 
-if (CHECK_SYSINSTALL_PYTHON)
-  # use the python-native install paths:
-
-  install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py sdist
-                                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
-  install(CODE "execute_process(COMMAND
-   ${PYTHON_EXECUTABLE} setup.py --proton-install-prefix ${CMAKE_INSTALL_PREFIX} install
-                          WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
-
-else ()
-  # install the bindings using the CMAKE path variables:
-  set (PYTHON_SITEARCH_PACKAGES ${BINDINGS_DIR}/python)
-
-  install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile cproton.py
-                                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
-  install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile cproton.py
-                                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
-  install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile proton.py
-                                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
-  install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile proton.py
-                                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
-
-  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cproton.py
-                ${CMAKE_CURRENT_BINARY_DIR}/cproton.pyc
-                ${CMAKE_CURRENT_BINARY_DIR}/cproton.pyo
-                ${CMAKE_CURRENT_SOURCE_DIR}/proton.py
-                ${CMAKE_CURRENT_SOURCE_DIR}/proton.pyc
-                ${CMAKE_CURRENT_SOURCE_DIR}/proton.pyo
-          DESTINATION ${PYTHON_SITEARCH_PACKAGES}
-          COMPONENT Python)
-  install(TARGETS ${SWIG_MODULE_cproton_REAL_NAME}
-          DESTINATION ${PYTHON_SITEARCH_PACKAGES}
-          COMPONENT Python)
-endif()
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cproton.py
+              ${CMAKE_CURRENT_BINARY_DIR}/cproton.pyc
+              ${CMAKE_CURRENT_BINARY_DIR}/cproton.pyo
+              ${CMAKE_CURRENT_SOURCE_DIR}/proton.py
+              ${CMAKE_CURRENT_SOURCE_DIR}/proton.pyc
+              ${CMAKE_CURRENT_SOURCE_DIR}/proton.pyo
+        DESTINATION ${PYTHON_SITEARCH_PACKAGES}
+        COMPONENT Python)
+install(TARGETS ${SWIG_MODULE_cproton_REAL_NAME}
+        DESTINATION ${PYTHON_SITEARCH_PACKAGES}
+        COMPONENT Python)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/f5cbab5e/proton-c/bindings/python/setup.py.in
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/setup.py.in b/proton-c/bindings/python/setup.py.in
deleted file mode 100644
index 94f3dfc..0000000
--- a/proton-c/bindings/python/setup.py.in
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/env python
-#
-# 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.
-#
-from distutils.core import setup, Extension
-import logging
-import os
-import sys
-
-_c_module = '@SWIG_MODULE_cproton_REAL_NAME@'
-_src_file = '@PN_SWIG_PYTHON_C_WRAPPER@'
-_version =  '@PN_VERSION@'
-_release = 0
-
-if "--proton-install-prefix" in sys.argv:
-    # special option used only if the python headers and library have been
-    # installed to a non-standard directory.  This can be done during 'make
-    # install' from the proton build tree by using the cmake option
-    # -DCMAKE_INSTALL_PREFIX.  The location of the headers and library must be
-    # specified so we can build the binding's C extension.
-    i = sys.argv.index("--proton-install-prefix") + 1
-    if i >= len(sys.argv):
-        raise ValueError("--proton-install-prefix requires a path parameter.")
-    _prefix = sys.argv[i]
-    # remove the proton arguments to they don't conflict with setup.py's other
-    # command arguments:
-    del sys.argv[i]
-    sys.argv.remove("--proton-install-prefix")
-    _destdir = os.environ.get("DESTDIR", "")
-    if _destdir and os.path.isabs(_prefix):
-        # DESTDIR may be used on unix systems to put the entire install tree
-        # under a particular directory.  However, if _prefix is an absolute
-        # path, os.path.join will discard DESTDIR, so strip off the leading
-        # separator
-        _prefix = _prefix.lstrip(os.path.sep)
-
-    _inc_dir = os.path.join(_destdir,
-                            _prefix,
-                            '@INCLUDE_INSTALL_DIR@')
-    _lib_dir = os.path.join(_destdir,
-                            _prefix,
-                            '@LIB_INSTALL_DIR@')
-
-    swig_ext = Extension(_c_module, [_src_file],
-                         libraries=['qpid-proton'],
-                         include_dirs=[_inc_dir],
-                         library_dirs=[_lib_dir])
-else:
-    swig_ext = Extension(_c_module, [_src_file],
-                         libraries=['qpid-proton'])
-
-_help_description = """Before you can build or install these bindings, you must
-first install version @PN_VERSION@ of the Proton development library
-(libqpid-proton) and its C header files. These files must be available in order
-to build this packages' C-based extension.
-
-Packages for the Proton development library may be provided by your system's
-distribution. For example, the qpid-proton-c-devel RPM is available for
-Centos/RHEL via EPEL.  A libqpid-proton2-dev deb file is available for Ubuntu
-via the Apache Qpid PPA (ppa:qpid/released).
-
-If your distribution does not make these packages available, you can download
-the Proton sources directly from the Apache Qpid project:
-
- http://qpid.apache.org
-
-This package is compatible with the @PN_VERSION@ release of the Proton
-development library.
-
-If you need additional help, see http://qpid.apache.org/discussion.html
-"""
-
-_long_description = """This package contains the Python bindings for the Apache
-QPID Proton library.\n%s""" % _help_description
-
-try:
-    setup(name="python-qpid-proton",
-          version="%s-%d" % (_version, _release),
-          author="Apache Qpid",
-          author_email="dev@qpid.apache.org",
-          py_modules=["proton", "cproton"],
-          url="http://qpid.apache.org/",
-          description="Python bindings for the Proton library",
-          long_description=_long_description,
-          license="Apache Software License",
-          classifiers=["License :: OSI Approved :: Apache Software License",
-                       "Intended Audience :: Developers",
-                       "Programming Language :: Python"],
-          ext_modules=[swig_ext])
-except:
-    logging.error("setup failed!\n%s", _help_description)
-    raise


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org