Philipp Hörist pushed to branch pyproject at gajim / python-nbxmpp
Commits: 7ae72c8d by Philipp Hörist at 2023-01-10T18:45:27+01:00 fix: HTTP: Parse uri with correct flags
- - - - - 50c8c1cd by Philipp Hörist at 2023-01-13T22:38:32+01:00 release: 4.0.1
- - - - - 3e4fee24 by Philipp Hörist at 2023-01-17T14:05:44+01:00 fix: Handle race condition when cancelling request
Fixes #136
- - - - - 06a96b24 by Philipp Hörist at 2023-01-17T16:46:55+01:00 change: Port package to pyproject.toml
- - - - -
9 changed files:
- .gitlab-ci.yml - ChangeLog - debian/control - nbxmpp/__init__.py - nbxmpp/http.py - pyproject.toml - scripts/bump_version.py - − setup.cfg - − setup.py
Changes:
===================================== .gitlab-ci.yml ===================================== @@ -24,7 +24,8 @@ build-linux: stage: build dependencies: [] script: - - python3 setup.py sdist bdist_wheel + - pip install build + - python3 -m build - python3 .ci/debian_build.py "$(find dist/nbxmpp-*.tar.gz)" 1 --pkgprefix=python3-
artifacts:
===================================== ChangeLog ===================================== @@ -1,3 +1,9 @@ +nbxmpp 4.0.1 (10 Jan 2023) + + Bug Fixes + + * HTTP: Parse uri with correct flags + nbxmpp 4.0.0 (06 Jan 2023)
New
===================================== debian/control ===================================== @@ -1,18 +1,17 @@ Source: python3-nbxmpp-nightly -Section: net +Section: python Priority: optional Maintainer: Gajim Maintainers ci@gajim.org Build-Depends: debhelper-compat (= 13), dh-python, - libglib2.0-0 (>= 2.60), gir1.2-soup-3.0, python3-all, python3-gi, python3-idna, python3-packaging, python3-precis-i18n, - python3-setuptools, + python3-setuptools (>= 65.0.0), Standards-Version: 4.1.4 Rules-Requires-Root: no Homepage: https://dev.gajim.org/gajim/python-nbxmpp @@ -23,14 +22,10 @@ Package: python3-nbxmpp-nightly Architecture: all Depends: ${misc:Depends}, ${python3:Depends}, - libglib2.0-0 (>= 2.60), gir1.2-soup-3.0, python3-gi, - python3-idna, - python3-packaging, - python3-precis-i18n, Recommends: python3-gssapi, -Breaks: gajim (<< 1.4~) +Breaks: gajim (<< 1.6~) Description: Non blocking XMPP Python library python-nbxmpp is a Python library that provides a way for Python applications - to use the XMPP network. This library was initially a fork of xmpppy. \ No newline at end of file + to use the XMPP network. This library was initially a fork of xmpppy.
===================================== nbxmpp/__init__.py ===================================== @@ -3,4 +3,4 @@ gi.require_version('Soup', '3.0')
from .protocol import * # pylint: disable=wrong-import-position
-__version__: str = '4.0.0' +__version__: str = '4.0.1'
===================================== nbxmpp/http.py ===================================== @@ -252,7 +252,7 @@ class HTTPRequest(GObject.GObject): Gio.FileCreateFlags.REPLACE_DESTINATION, self._cancellable)
- uri = GLib.Uri.parse(uri_string, GLib.UriFlags.HAS_PASSWORD) + uri = GLib.Uri.parse(uri_string, GLib.UriFlags(Soup.HTTP_URI_FLAGS)) self._message.set_uri(uri)
if self._request_body_data is not None: @@ -449,6 +449,17 @@ class HTTPRequest(GObject.GObject): self._set_failed(HTTPRequestError.STATUS_NOT_OK) return
+ self._log.info('Request status: %s', Soup.Status.get_phrase(status)) + + if self._cancellable.is_cancelled(): + # It can happen that the message is finished before the + # response callback returns after calling cancel(). If + # we call complete, the response callback will also + # try to cleanup and will fail. + self._log.info('Skip setting message complete because ' + 'cancel is in progess') + return + self._set_complete()
def _set_failed(self, error: HTTPRequestError) -> None:
===================================== pyproject.toml ===================================== @@ -1,9 +1,44 @@ [build-system] -requires = [ - "setuptools >= 43.0.0", -] +requires = ["setuptools >= 65.0.0"] build-backend = "setuptools.build_meta"
+[project] +name = "nbxmpp" +description = "XMPP Library" +keywords = ["chat", "messaging", "im", "xmpp"] +readme = "README.md" +requires-python = ">=3.10" +license = {text = "GPL-3.0-or-later"} +authors = [ + {name = "Philipp Hörist", email = "philipp@hoerist.com"}, + {name = "Yann Leboulanger", email = "yann@leboulanger.org"}, +] +classifiers = [ + "Programming Language :: Python :: 3.10", +] +dependencies = [ + "precis-i18n>=1.0.0", + "packaging", + "idna", + "PyGObject", +] + +dynamic = ["version"] + +[project.optional-dependencies] +gssapi = ["gssapi"] + +[project.urls] +repository = "https://dev.gajim.org/gajim/python-nbxmpp" + +[tool.setuptools.packages.find] +include = ["nbxmpp*"] + +[tool.setuptools.package-data] +"nbxmpp" = ["py.typed"] + +[tool.setuptools.dynamic] +version = {attr = "nbxmpp.__version__"}
[tool.pyright] pythonVersion = "3.10"
===================================== scripts/bump_version.py ===================================== @@ -9,7 +9,6 @@ REPO_DIR = Path(__file__).resolve().parent.parent
INIT = REPO_DIR / 'nbxmpp' / '__init__.py' -CFG = REPO_DIR / 'setup.cfg' CHANGELOG = REPO_DIR / 'ChangeLog'
VERSION_RX = r'\d+.\d+.\d+' @@ -28,10 +27,6 @@ def bump_version(current_version: str, new_version: str) -> None: content = content.replace(current_version, new_version, 1) INIT.write_text(content, encoding='utf8')
- content = CFG.read_text(encoding='utf8') - content = content.replace(current_version, new_version, 1) - CFG.write_text(content, encoding='utf8') -
def make_changelog(new_version: str) -> None:
===================================== setup.cfg deleted ===================================== @@ -1,32 +0,0 @@ -[metadata] -name = nbxmpp -version = 4.0.0 -description = XMPP Library -author = Yann Leboulanger, Philipp Hoerist -author_email = gajim-devel@gajim.org -long_description = file: README.md -long_description_content_type = text/markdown -keywords = xmpp chat -url = https://dev.gajim.org/gajim/python-nbxmpp -license_file = COPYING -license = GPL v3 -classifiers = - Programming Language :: Python :: 3.10 - -[options] -python_requires = >=3.10 -packages = find: -install_requires = - precis-i18n>=1.0.0 - packaging - idna - -[options.extras_require] -gssapi = gssapi - -[options.packages.find] -exclude = - test* - -[options.package_data] -nbxmpp = py.typed
===================================== setup.py deleted ===================================== @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 - -from setuptools import setup - -setup()
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/1b054cc5a9b4753bb43cc459...