Merge pull request #8004 from podsvirov/python-jsonrpc-server-new-package

python-jsonrpc-server: New package
This commit is contained in:
Christoph Reiter
2021-02-21 12:28:09 +01:00
committed by GitHub
3 changed files with 113 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
--- python-jsonrpc-server-0.4.0.orig/versioneer.py 2020-09-08 00:24:04.000000000 +0300
+++ python-jsonrpc-server-0.4.0/versioneer.py 2021-02-20 19:57:17.676076600 +0300
@@ -1404,6 +1404,15 @@
Returns dict with two keys: 'version' and 'full'.
"""
+
+ override = os.getenv("VERSIONEER_OVERRIDE")
+ if override:
+ if verbose:
+ print(f"got version from environment variable (VERSIONEER_OVERRIDE={override})")
+ return {"version": override, "dirty": False, "error": None,
+ "full-revisionid": None,
+ "date": None}
+
if "versioneer" in sys.modules:
# see the discussion in cmdclass.py:get_cmdclass()
del sys.modules["versioneer"]

View File

@@ -0,0 +1,37 @@
--- python-jsonrpc-server-0.4.0.orig/test/test_streams.py 2020-09-08 00:24:04.000000000 +0300
+++ python-jsonrpc-server-0.4.0/test/test_streams.py 2021-02-20 19:49:18.937960400 +0300
@@ -81,20 +81,12 @@
'params': {}
})
- if os.name == 'nt':
- assert wfile.getvalue() == (
- b'Content-Length: 49\r\n'
- b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
- b'\r\n'
- b'{"id": "hello", "method": "method", "params": {}}'
- )
- else:
- assert wfile.getvalue() == (
- b'Content-Length: 44\r\n'
- b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
- b'\r\n'
- b'{"id":"hello","method":"method","params":{}}'
- )
+ assert wfile.getvalue() == (
+ b'Content-Length: 44\r\n'
+ b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
+ b'\r\n'
+ b'{"id":"hello","method":"method","params":{}}'
+ )
class JsonDatetime(datetime.datetime):
@@ -119,6 +111,7 @@
hour=1,
minute=1,
second=1,
+ tzinfo=datetime.timezone.utc
))
assert wfile.getvalue() in [

View File

@@ -0,0 +1,58 @@
# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>
_realname=jsonrpc-server
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.4.0
pkgrel=1
pkgdesc="Python library implementing asynchronous JSON RPC server (mingw-w64)"
arch=('any')
url="https://github.com/palantir/python-jsonrpc-server"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-python-future"
"${MINGW_PACKAGE_PREFIX}-python-ujson")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-coverage"
"${MINGW_PACKAGE_PREFIX}-python-pytest"
"${MINGW_PACKAGE_PREFIX}-python-pytest-runner"
"${MINGW_PACKAGE_PREFIX}-python-pytest-cov"
"${MINGW_PACKAGE_PREFIX}-python-pyflakes"
"${MINGW_PACKAGE_PREFIX}-python-mock")
source=("python-${_realname}-${pkgver}.tar.gz"::"${url}/archive/${pkgver}.tar.gz"
"001-python-jsonrpc-server-0.4.0-fix-versioneer.patch"
"002-python-jsonrpc-server-0.4.0-fix-test.patch")
sha256sums=('d2ca9d2fa0ae5f3872f1362670509d8ee5e73cad0592c3c23390c4d521b30b8b'
'816e9fc00654e21a9086a57797ddaf0c0056ca74bc32653d3b42a9152b94117a'
'417deed5e3bf6c04868bb7c567f664c40be8a400dabc6594d593d803d292a7ce')
prepare() {
cd "${srcdir}"
rm -rf "python-build-${CARCH}" | true
cp -r "python-${_realname}-${pkgver}" "python-build-${CARCH}"
cd "python-build-${CARCH}"
patch -p1 -i "${srcdir}/001-python-jsonrpc-server-0.4.0-fix-versioneer.patch"
patch -p1 -i "${srcdir}/002-python-jsonrpc-server-0.4.0-fix-test.patch"
}
build() {
msg "Python build for ${CARCH}"
cd "${srcdir}/python-build-${CARCH}"
VERSIONEER_OVERRIDE=${pkgver} \
${MINGW_PREFIX}/bin/python setup.py build
}
check() {
cd "${srcdir}/python-build-${CARCH}"
PYTHONPATH="build/lib" pytest
}
package() {
cd "${srcdir}/python-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
VERSIONEER_OVERRIDE=${pkgver} \
${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1 --skip-build
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
# vim: ts=2 sw=2 et: