Skip to content

Commit c7930ea

Browse files
committed
feat: python 3.12 support added
1 parent 627dfd5 commit c7930ea

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

examples/server/server_app_thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ def launch_server():
6161

6262
# stop server
6363
server_thread.join()
64-
print("Server stoped")
64+
print("Server stoped")

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pyrfc"
7-
version = "3.2"
7+
version = "3.3"
88
readme = "README.md"
99
license = { file = "LICENSES/Apache-2.0.txt" }
1010
description = "Python bindings for SAP NetWeaver RFC SDK"
@@ -26,6 +26,7 @@ classifiers = [
2626
"Programming Language :: Python :: 3.9",
2727
"Programming Language :: Python :: 3.10",
2828
"Programming Language :: Python :: 3.11",
29+
"Programming Language :: Python :: 3.12",
2930
"Programming Language :: Python :: 3 :: Only"
3031
]
3132
dependencies = []

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
import inspect
6-
import sys
76
import os
8-
from setuptools import setup, Extension
7+
import sys
98

9+
from setuptools import Extension, setup
1010

1111
PACKAGE_NAME = "pyrfc"
1212
MODULE_NAME = "_cyrfc"
@@ -17,8 +17,8 @@
1717
CMDCLASS = {}
1818
if build_cython:
1919
try:
20-
from Cython.Distutils import build_ext
2120
from Cython.Build import cythonize
21+
from Cython.Distutils import build_ext
2222
except ImportError:
2323
sys.exit("Cython not installed: https://cython.readthedocs.io/en/latest/src/quickstart/install.html")
2424
CMDCLASS = {"build_ext": build_ext}
@@ -189,7 +189,7 @@
189189
setup(
190190
name=PACKAGE_NAME,
191191
cmdclass=CMDCLASS, # type: ignore
192-
ext_modules=cythonize(PYRFC_EXT, annotate=True, compiler_directives={"language_level": "3"}) # type: ignore
192+
ext_modules=cythonize(PYRFC_EXT, annotate=True, compiler_directives={"language_level": "3", "embedsignature": True}) # type: ignore
193193
if build_cython
194194
else [PYRFC_EXT], # type: ignore
195195
test_suite="tests",

src/pyrfc/_cyrfc.pyx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ from decimal import Decimal
1414
from enum import Enum, auto
1515
from locale import localeconv
1616
from os.path import isfile, join
17-
from sys import exc_info, platform
17+
from sys import exc_info, platform, version_info
1818
from threading import Thread, Timer
1919

2020
from pyrfc.csapnwrfc cimport *
21-
2221
from pyrfc._exception import *
2322
from pyrfc._utils import enum_names, enum_values
2423

@@ -1530,7 +1529,11 @@ def default_auth_check(func_name=False, request_context = None):
15301529

15311530
def _server_log(origin, log_message):
15321531
if server_context["server_log"]:
1533-
print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'")
1532+
if version_info > (3, 12):
1533+
from datetime import UTC
1534+
print (f"[{datetime.now(UTC).replace(tzinfo=None)} UTC] {origin} '{log_message}'")
1535+
else:
1536+
print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'")
15341537

15351538

15361539
cdef RFC_RC metadataLookup(

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
description = "PyRFC Build"
33
minversion = 4.5
44
envlist =
5-
lint_format, docs, reuse, sdist, pack,
6-
py38, py39, py310, py311
5+
linter, docs, reuse, sdist, pack,
6+
py38, py39, py310, py311, py312
77
package = wheel
88
skip_missing_interpreters = false
99
isolated_build = true
@@ -26,7 +26,7 @@ commands =
2626
# unit test
2727
python -m pytest tests --testdox --html-report=./report {posargs}
2828

29-
[testenv:lint_format]
29+
[testenv:linter]
3030
description = Check linting
3131
platform = darwin
3232
basepython = python3.11

0 commit comments

Comments
 (0)