You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/09/19 03:33:53 UTC

[qpid-proton] branch master updated (07c25e0 -> 1a7d32b)

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git.


    from 07c25e0  PROTON-2099: [Python] Fix example test runner script
     new 8c66a85  PROTON-2096: [Python] Update compatible versions of python
     new 29964e7  PROTON-2102: [Python] Work on proton build and python setup to build better python packages - Now rely on setuptools   This gives us bdist_wheel - Slim down source pacakge add swigged files to sources - Never try to swig at build/install time only use source package swig files
     new 2551b78  PROTON-2102: [Python] Build python source and binary packages - This is gated on the presence of the setuptools and/or the   wheel python packages
     new 1a7d32b  PROTON-2102: [Python] Alter CI configurations to allow building python package(s)

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .appveyor.yml             |   2 +
 .travis.yml               |   2 +-
 azure-pipelines/steps.yml |   4 ++
 python/CMakeLists.txt     |  36 ++++++++++++++-
 python/setup.py.in        | 113 ++++++++++++++++------------------------------
 5 files changed, 81 insertions(+), 76 deletions(-)


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


[qpid-proton] 03/04: PROTON-2102: [Python] Build python source and binary packages - This is gated on the presence of the setuptools and/or the wheel python packages

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 2551b78145cd643761ce8b50534fcdfa267e40b5
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Mon Sep 16 15:57:21 2019 -0400

    PROTON-2102: [Python] Build python source and binary packages
    - This is gated on the presence of the setuptools and/or the
      wheel python packages
---
 python/CMakeLists.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 6414a31..e076e0e 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -205,6 +205,22 @@ add_custom_command(TARGET py_src_dist
                    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} "${py_dist_dir}/${file}")
 endforeach()
 
+# Make python source and binary packages if we have prerequisistes
+check_python_module("setuptools" SETUPTOOLS_MODULE_FOUND)
+check_python_module("wheel" WHEEL_MODULE_FOUND)
+if (SETUPTOOLS_MODULE_FOUND)
+  add_custom_target(py_pkg_src ALL
+                     WORKING_DIRECTORY dist
+                     DEPENDS py_src_dist
+                     COMMAND ${PYTHON_EXECUTABLE} setup.py sdist --dist-dir ${CMAKE_CURRENT_BINARY_DIR}/pkgs)
+  if (WHEEL_MODULE_FOUND)
+    add_custom_target(py_pkg_wheel ALL
+                       WORKING_DIRECTORY dist
+                       DEPENDS py_pkg_src
+                       COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir ${CMAKE_CURRENT_BINARY_DIR}/pkgs)
+  endif ()
+endif ()
+
 # python test: python/tests/proton-test
 set (py_src "${CMAKE_CURRENT_SOURCE_DIR}")
 set (py_bin "${CMAKE_CURRENT_BINARY_DIR}")


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


[qpid-proton] 04/04: PROTON-2102: [Python] Alter CI configurations to allow building python package(s)

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 1a7d32b85c5d89a6f3f1b25cf9b18e7868987f73
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Wed Sep 18 18:43:17 2019 -0400

    PROTON-2102: [Python] Alter CI configurations to allow building python package(s)
---
 .appveyor.yml             | 2 ++
 .travis.yml               | 2 +-
 azure-pipelines/steps.yml | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.appveyor.yml b/.appveyor.yml
index dc8d069..116e881 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -16,6 +16,8 @@ install:
 - vcpkg install jsoncpp:x86-windows
 - vcpkg install jsoncpp:x64-windows
 - vcpkg integrate install
+- pip install --user --upgrade pip
+- pip install --user setuptools tox
 cache:
 - C:\ProgramData\chocolatey\bin -> .appveyor.yml
 - C:\ProgramData\chocolatey\lib -> .appveyor.yml
diff --git a/.travis.yml b/.travis.yml
index 56ff50a..a7bb2a5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -74,7 +74,7 @@ addons:
 
 install:
 - python -m pip install --user --upgrade pip
-- python -m pip install --user coverage tox
+- python -m pip install --user coverage setuptools wheel tox
 - gem install minitest
 
 before_script:
diff --git a/azure-pipelines/steps.yml b/azure-pipelines/steps.yml
index 9f88e4b..ec481d6 100644
--- a/azure-pipelines/steps.yml
+++ b/azure-pipelines/steps.yml
@@ -5,6 +5,10 @@ steps:
     versionSpec: $(PythonVersion)
     addToPath: true
     architecture: $(PythonArch)
+- script: |
+    python -m pip install --user --upgrade pip
+    python -m pip install --user setuptools wheel tox
+  name: InstallPythonModules
 - task: CMake@1
   name: CMakeConfigure
   inputs:


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


[qpid-proton] 02/04: PROTON-2102: [Python] Work on proton build and python setup to build better python packages - Now rely on setuptools This gives us bdist_wheel - Slim down source pacakge add swigged files to sources - Never try to swig at build/install time only use source package swig files

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 29964e785c1cf2ffca3af763d9cb37534affd18b
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Sep 13 18:16:46 2019 -0400

    PROTON-2102: [Python] Work on proton build and python setup to build better python packages
    - Now rely on setuptools
      This gives us bdist_wheel
    - Slim down source pacakge add swigged files to sources
    - Never try to swig at build/install time only use source package swig files
---
 python/CMakeLists.txt |  20 +++++++++-
 python/setup.py.in    | 107 +++++++++++++++++---------------------------------
 2 files changed, 55 insertions(+), 72 deletions(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index aacb665..6414a31 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -174,7 +174,25 @@ add_custom_command(TARGET py_src_dist
                    COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_INCLUDE_DIR} "${py_dist_dir}/include")
 
 add_custom_command(TARGET py_src_dist
-                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_SOURCE_DIR} "${py_dist_dir}/src")
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_SOURCE_DIR}/core "${py_dist_dir}/src/core")
+
+add_custom_command(TARGET py_src_dist
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_SOURCE_DIR}/compiler "${py_dist_dir}/src/compiler")
+
+add_custom_command(TARGET py_src_dist
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_SOURCE_DIR}/platform "${py_dist_dir}/src/platform")
+
+add_custom_command(TARGET py_src_dist
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_SOURCE_DIR}/ssl "${py_dist_dir}/src/ssl")
+
+add_custom_command(TARGET py_src_dist
+                   COMMAND ${CMAKE_COMMAND} -E copy_directory ${PN_C_SOURCE_DIR}/sasl "${py_dist_dir}/src/sasl")
+
+add_custom_command(TARGET py_src_dist
+                   COMMAND ${CMAKE_COMMAND} -E copy ${PN_C_SOURCE_DIR}/encodings.h "${py_dist_dir}/src")
+
+add_custom_command(TARGET py_src_dist
+                   COMMAND ${CMAKE_COMMAND} -E copy ${PN_C_SOURCE_DIR}/protocol.h "${py_dist_dir}/src")
 
 add_custom_command(TARGET py_src_dist
                    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/README.rst "${py_dist_dir}")
diff --git a/python/setup.py.in b/python/setup.py.in
index 16fff1b..c5e1bbb 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -45,13 +45,13 @@ of monkey patching.
 import os
 import shutil
 
+from setuptools import setup, Extension
+from setuptools.command.sdist import sdist
+from setuptools.command.build_ext import build_ext
+from setuptools.command.build_py import build_py
+
 import distutils.sysconfig as ds_sys
 from distutils.ccompiler import new_compiler, get_default_compiler
-from distutils.core import setup, Extension
-from distutils.command.build import build
-from distutils.command.build_ext import build_ext
-from distutils.command.sdist import sdist
-from distutils import errors
 
 from setuputils import log
 from setuputils import misc
@@ -63,22 +63,26 @@ _PROTON_VERSION=(@PN_VERSION_MAJOR@,
 _PROTON_VERSION_STR = "%d.%d.%d" % _PROTON_VERSION
 
 
-class CheckSDist(sdist):
-
+class Swig(build_ext):
     def run(self):
-        self.distribution.run_command('configure')
+        """Run swig against the sources.  This will cause swig to compile the
+        cproton.i file into a .c file called cproton_wrap.c, and create
+        cproton.py.
+        """
+        ext = Extension('_cproton',
+                             sources=['cproton.i'],
+                             swig_opts=['-threads', '-Iinclude'])
 
-        # Append the source that was removed during
-        # the configuration step.
-        _cproton = self.distribution.ext_modules[-1]
-        _cproton.sources.append('cproton.i')
+        if 'SWIG' in os.environ:
+            self.swig = os.environ['SWIG']
+
+        self.swig_sources(ext.sources, ext)
 
-        try:
-            sdist.run(self)
-        finally:
-            for src in ['cproton.py', 'cproton_wrap.c']:
-                if os.path.exists(src):
-                    os.remove(src)
+
+class CheckSDist(sdist):
+    def run(self):
+        self.distribution.run_command('swig')
+        sdist.run(self)
 
 
 class Configure(build_ext):
@@ -94,30 +98,6 @@ class Configure(build_ext):
         else:
             return compiler.compiler_type
 
-    def prepare_swig_wrap(self):
-        """Run swig against the sources.  This will cause swig to compile the
-        cproton.i file into a .c file called cproton_wrap.c, and create
-        cproton.py.
-        """
-        ext = self.distribution.ext_modules[-1]
-
-        if 'SWIG' in os.environ:
-            self.swig = os.environ['SWIG']
-
-        try:
-            # This will actually call swig to generate the files
-            # and list the sources.
-            self.swig_sources(ext.sources, ext)
-        except (errors.DistutilsExecError, errors.DistutilsPlatformError) as e:
-            if not (os.path.exists('cproton_wrap.c') or
-                    os.path.exists('cproton.py')):
-                raise e
-
-        # now remove the cproton.i file from the source list so we don't run
-        # swig again.
-        ext.sources = ext.sources[1:]
-        ext.swig_opts = []
-
     def use_bundled_proton(self):
         """The proper version of libqpid-proton-core is not installed on the system,
         so use the included proton-c sources to build the extension
@@ -247,10 +227,6 @@ class Configure(build_ext):
         _cproton.include_dirs.append(build_include)
         _cproton.include_dirs.append(proton_include)
 
-        # swig will need to access the proton headers:
-        _cproton.swig_opts.append('-I%s' % build_include)
-        _cproton.swig_opts.append('-I%s' % proton_include)
-
         # lastly replace the libqpid-proton-core dependency with libraries required
         # by the Proton objects:
         _cproton.libraries=libraries
@@ -283,38 +259,22 @@ class Configure(build_ext):
         else:
             # Proton not installed or compatible, use bundled proton-c sources
             self.use_bundled_proton()
-        self.prepare_swig_wrap()
 
 
-class CustomBuildOrder(build):
-    # The sole purpose of this class is to re-order
-    # the commands execution so that `build_ext` is executed *before*
-    # build_py. We need this to make sure `cproton.py` is generated
-    # before the python modules are collected. Otherwise, it won't
-    # be installed.
-    sub_commands = [
-        ('build_ext', build.has_ext_modules),
-        ('build_py', build.has_pure_modules),
-        ('build_clib', build.has_c_libraries),
-        ('build_scripts', build.has_scripts),
-    ]
+class BuildExtFirst(build_py):
+    def run(self):
+        # Make sure swig runs first and adds file etc
+        self.distribution.run_command('build_ext')
+        build_py.run(self)
 
 
 class CheckingBuildExt(build_ext):
-    """Subclass build_ext to build qpid-proton using `cmake`"""
-
     def run(self):
-        # Discover qpid-proton in the system
+        # Discover qpid-proton and prerequisites in the system
         self.distribution.run_command('configure')
         build_ext.run(self)
 
 
-# Override `build_ext` and add `configure`
-cmdclass = {'configure': Configure,
-            'build': CustomBuildOrder,
-            'build_ext': CheckingBuildExt,
-            'sdist': CheckSDist}
-
 setup(name='python-qpid-proton',
       version=_PROTON_VERSION_STR + os.environ.get('PROTON_VERSION_SUFFIX', ''),
       description='An AMQP based messaging library.',
@@ -335,7 +295,13 @@ setup(name='python-qpid-proton',
                    "Programming Language :: Python :: 3.6",
                    "Programming Language :: Python :: 3.7",
                    "Programming Language :: Python :: 3.8"],
-      cmdclass=cmdclass,
+      cmdclass = {
+          'configure': Configure,
+          'swig': Swig,
+          'build_py': BuildExtFirst,
+          'build_ext': CheckingBuildExt,
+          'sdist': CheckSDist
+      },
       extras_require={
           'opentracing': ['opentracing', 'jaeger_client']
       },
@@ -343,7 +309,6 @@ setup(name='python-qpid-proton',
       # installation!  If you make changes below, you may need to update the
       # Configure class above
       ext_modules=[Extension('_cproton',
-                             sources=['cproton.i', 'cproton_wrap.c'],
-                             swig_opts=['-threads'],
+                             sources=['cproton_wrap.c'],
                              extra_compile_args=['-pthread'],
                              libraries=['qpid-proton-core'])])


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


[qpid-proton] 01/04: PROTON-2096: [Python] Update compatible versions of python

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 8c66a85d3198c2790b8ab8646d87bbfe409b7f77
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Wed Sep 18 16:20:50 2019 -0400

    PROTON-2096: [Python] Update compatible versions of python
---
 python/setup.py.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/python/setup.py.in b/python/setup.py.in
index ad7258c..16fff1b 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -331,10 +331,10 @@ setup(name='python-qpid-proton',
                    "Programming Language :: Python :: 2.6",
                    "Programming Language :: Python :: 2.7",
                    "Programming Language :: Python :: 3",
-                   "Programming Language :: Python :: 3.3",
-                   "Programming Language :: Python :: 3.4",
                    "Programming Language :: Python :: 3.5",
-                   "Programming Language :: Python :: 3.6"],
+                   "Programming Language :: Python :: 3.6",
+                   "Programming Language :: Python :: 3.7",
+                   "Programming Language :: Python :: 3.8"],
       cmdclass=cmdclass,
       extras_require={
           'opentracing': ['opentracing', 'jaeger_client']


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