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

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

commit 84570eca6967d6a938d83d330648b48016be8603
Author: Andrew Stitcher <[email protected]>
AuthorDate: Tue Apr 16 18:24:19 2024 -0400

    PROTON-2815: [Python] Use modern tooling to build python packages
    
    Also add license text to a bunch of Python files
---
 python/CMakeLists.txt | 12 ++-----
 python/MANIFEST.in    | 18 ++++++++++
 python/pyproject.toml | 97 ++++++++++++++++++++++++++++++---------------------
 python/setup.cfg      | 46 ++++++++++--------------
 python/setup.py       |  2 --
 5 files changed, 96 insertions(+), 79 deletions(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 8978c0b73..9f07b3a18 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -149,19 +149,13 @@ add_custom_command(OUTPUT ./tox.ini
 # Make python source and binary packages if we have prerequisites
 check_python_module("setuptools" SETUPTOOLS_MODULE_FOUND)
 check_python_module("wheel" WHEEL_MODULE_FOUND)
+check_python_module("build" BUILD_MODULE_FOUND)
 check_python_module("cffi" CFFI_MODULE_FOUND)
-if (SETUPTOOLS_MODULE_FOUND)
-  set (pydist_cmds sdist)
-  if (WHEEL_MODULE_FOUND AND CFFI_MODULE_FOUND)
-    set (pydist_cmds sdist bdist_wheel --py-limited-api=cp38)
-  endif()
-endif()
-
-if (pydist_cmds)
+if (BUILD_MODULE_FOUND AND SETUPTOOLS_MODULE_FOUND AND WHEEL_MODULE_FOUND AND 
CFFI_MODULE_FOUND)
   add_custom_command(OUTPUT .timestamp.dist
     DEPENDS pysrc_copied
     COMMAND ${CMAKE_COMMAND} -E remove -f .timestamp.dist
-    COMMAND ${Python_EXECUTABLE} setup.py ${pydist_cmds}
+    COMMAND ${Python_EXECUTABLE} -m build -n
     COMMAND ${CMAKE_COMMAND} -E touch .timestamp.dist)
   add_custom_target(pydist ALL DEPENDS .timestamp.dist)
 endif ()
diff --git a/python/MANIFEST.in b/python/MANIFEST.in
index 2c2e5af0b..605fc85c5 100644
--- a/python/MANIFEST.in
+++ b/python/MANIFEST.in
@@ -1,3 +1,21 @@
+#
+# 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.
+
 include VERSION.txt
 include ext_build.py
 include cproton.h
diff --git a/python/pyproject.toml b/python/pyproject.toml
index f8074913f..ae9d6f099 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -1,44 +1,61 @@
+#
+# 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.
+
 [build-system]
 requires = ["setuptools", "cffi>=1.0.0"]
 build-backend = "setuptools.build_meta"
 
-# Commented out for present because support is beta in setuptools so we should 
just use setup.cfg
-#[project]
-#name = "python-qpid-proton"
-#description = "An AMQP based messaging library."
-#readme = "README.rst"
-#license = {text = "Apache Software License"}
-#classifiers = [
-#  "License :: OSI Approved :: Apache Software License",
-#  "Intended Audience :: Developers",
-#  "Programming Language :: Python",
-#  "Programming Language :: Python :: 3",
-#  "Programming Language :: Python :: 3 :: Only",
-#  "Programming Language :: Python :: 3.6",
-#  "Programming Language :: Python :: 3.7",
-#  "Programming Language :: Python :: 3.8",
-#  "Programming Language :: Python :: 3.9",
-#  "Programming Language :: Python :: 3.10",
-#  "Programming Language :: Python :: 3.11"
-#]
-#dependencies = [
-#    "cffi>=1.0.0"
-#]
-#authors = [
-#    {name = "Apache Qpid", email = "[email protected]"}
-#]
-#dynamic = ["version"]
-#
-#[project.urls]
-#homepage = "http://qpid.apache.org/proton/";
-#
-#[project.optional-dependencies]
-#opentracing = ["opentracing", "jaeger_client"]
-#
-#[tool.setuptools]
-#packages = ["proton"]
-#py-modules = ["cproton"]
-## cffi-modules = "ext_build.py:ffibuilder"
-#
-#[tool.setuptools.dynamic]
-#version = {file = "VERSION.txt"}
+[project]
+name = "python-qpid-proton"
+description = "An AMQP based messaging library."
+readme = "README.rst"
+license = {text = "Apache Software License"}
+classifiers = [
+  "License :: OSI Approved :: Apache Software License",
+  "Intended Audience :: Developers",
+  "Programming Language :: Python",
+  "Programming Language :: Python :: 3",
+  "Programming Language :: Python :: 3 :: Only",
+  "Programming Language :: Python :: 3.6",
+  "Programming Language :: Python :: 3.7",
+  "Programming Language :: Python :: 3.8",
+  "Programming Language :: Python :: 3.9",
+  "Programming Language :: Python :: 3.10",
+  "Programming Language :: Python :: 3.11"
+]
+dependencies = [
+    "cffi>=1.0.0"
+]
+authors = [
+    {name = "Apache Qpid", email = "[email protected]"}
+]
+dynamic = ["version"]
+
+[project.urls]
+homepage = "http://qpid.apache.org/proton/";
+
+[project.optional-dependencies]
+opentracing = ["opentracing", "jaeger_client"]
+
+[tool.setuptools]
+packages = ["proton"]
+py-modules = ["cproton"]
+# cffi-modules = "ext_build.py:ffibuilder"
+
+[tool.setuptools.dynamic]
+version = {file = "VERSION.txt"}
diff --git a/python/setup.cfg b/python/setup.cfg
index 212a92025..8e5085d4c 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -1,31 +1,21 @@
-[metadata]
-name = python-qpid-proton
-version = file: VERSION.txt
-description = An AMQP based messaging library.
-long_description = file: README.rst
-author = Apache Qpid
-author_email = [email protected]
-url = http://qpid.apache.org/proton/
-license = Apache Software License
-classifiers =
-  License :: OSI Approved :: Apache Software License
-  Intended Audience :: Developers
-  Programming Language :: Python
-  Programming Language :: Python :: 3
-  Programming Language :: Python :: 3 :: Only
-  Programming Language :: Python :: 3.9
-  Programming Language :: Python :: 3.10
-  Programming Language :: Python :: 3.11
-  Programming Language :: Python :: 3.12
-
-[options]
-packages = proton
-py_modules = cproton
-setup_requires = cffi>=1.0.0
-install_requires = cffi>=1.0.0
-
-[options.extras_require]
-opentracing = opentracing; jaeger_client
+#
+# 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.
 
+# Only here to configure flake8
 [flake8]
 max-line-length = 125
diff --git a/python/setup.py b/python/setup.py
index c78fe6e7e..51976ace9 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -17,7 +16,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-
 from setuptools import setup
 
 setup(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to