Skip to content

Commit 6030556

Browse files
authored
Fixes for Python 3.13 compatibility (#487)
* fixes for Python 3.13 compatibility - changed deprecated import to typing.BinaryIO (which is backwards compatible) - fixed invalid escape sequence warnings by using raw-strings fixes #486 * ci: use upload-artifact@v4 since v3 was deprecated and no longer works * dependencies: bumped max version constraint for av since it did no longer build on recent systems fixes #485
1 parent 7f766be commit 6030556

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
matrix:
3737
os: [ubuntu-22.04, ubuntu-20.04]
3838
# Lets try to keep testing an LTS python and latest python
39-
python-version: ['3.7', '3.12']
39+
python-version: ['3.7', '3.12', '3.13']
4040

4141
runs-on: ${{ matrix.os }}
4242
name: Ubuntu ${{ matrix.os }} with Python ${{ matrix.python-version }}
@@ -106,7 +106,7 @@ jobs:
106106
strategy:
107107
matrix:
108108
# Lets try to keep testing an LTS python and latest python
109-
python-version: ['3.7', '3.12']
109+
python-version: ['3.7', '3.12', '3.13']
110110

111111
name: Windows with Python ${{ matrix.python-version }}
112112
steps:

.github/workflows/wheels.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
# env:
3333
# CIBW_SOME_OPTION: value
3434

35-
- uses: actions/upload-artifact@v3
35+
- uses: actions/upload-artifact@v4
3636
with:
37+
name: pyrdp-wheel-${{ matrix.os }}
3738
path: ./wheelhouse/*.whl

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ classifiers = [
3131
"Programming Language :: Python :: 3.10",
3232
"Programming Language :: Python :: 3.11",
3333
"Programming Language :: Python :: 3.12",
34+
"Programming Language :: Python :: 3.13",
3435
"Topic :: Communications",
3536
"Topic :: Security",
3637
"Topic :: Software Development :: Libraries",
@@ -54,7 +55,7 @@ dependencies = [
5455
[project.optional-dependencies]
5556
full = [
5657
'wheel>=0.34.2',
57-
'av>=8,<12',
58+
'av>=8,<15',
5859
'PySide6>=6.3,<7',
5960
'qimage2ndarray>=1.6,<2',
6061
'py-notifier>=0.5.0',

pyrdp/mitm/DeviceRedirectionMITM.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def sendForgedFileRead(self, deviceID: int, path: str) -> int:
312312
return completionID
313313

314314
def sendForgedDirectoryListing(self, deviceID: int, path: str) -> int:
315-
"""
315+
r"""
316316
Send a forged directory listing request. Returns a request ID that can be used by the caller to keep track of which
317317
file belongs to which directory. Results are sent by using the DeviceRedirectionMITMObserver interface.
318318
:param deviceID: ID of the target device.

pyrdp/mitm/FileMapping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import hashlib
88
import os
99
import tempfile
10+
import typing
1011
from logging import LoggerAdapter
1112
from pathlib import Path
12-
from typing import io
1313

1414

1515
class FileMapping:
@@ -18,7 +18,7 @@ class FileMapping:
1818
transferred over RDP.
1919
"""
2020

21-
def __init__(self, file: io.BinaryIO, dataPath: Path, filesystemPath: Path, filesystemDir: Path, log: LoggerAdapter):
21+
def __init__(self, file: typing.BinaryIO, dataPath: Path, filesystemPath: Path, filesystemDir: Path, log: LoggerAdapter):
2222
"""
2323
:param file: the file handle for dataPath
2424
:param dataPath: path where the file is actually saved

pyrdp/ui/qt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ def RDPBitmapToQtImage(width: int, height: int, bitsPerPixel: int, isCompressed:
4949
"""
5050
image = None
5151
buf = None
52-
52+
5353
if bitsPerPixel == 15:
5454
if isCompressed:
5555
buf = rle.bitmap_decompress(data, width, height, 2)
5656
image = QImage(buf, width, height, QImage.Format_RGB555)
5757
else:
5858
buf = data
5959
image = QImage(buf, width, height, QImage.Format_RGB555).transformed(QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0))
60-
60+
6161
elif bitsPerPixel == 16:
6262
if isCompressed:
6363
buf = rle.bitmap_decompress(data, width, height, 2)
6464
image = QImage(buf, width, height, QImage.Format_RGB16)
6565
else:
6666
buf = data
6767
image = QImage(buf, width, height, QImage.Format_RGB16).transformed(QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0))
68-
68+
6969
elif bitsPerPixel == 24:
7070
if isCompressed:
7171
buf = rle.bitmap_decompress(data, width, height, 3)
@@ -83,7 +83,7 @@ def RDPBitmapToQtImage(width: int, height: int, bitsPerPixel: int, isCompressed:
8383
else:
8484
buf = data
8585
image = QImage(buf, width, height, QImage.Format_RGB888).transformed(QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0))
86-
86+
8787
elif bitsPerPixel == 32:
8888
if isCompressed:
8989
buf = rle.bitmap_decompress(data, width, height, 4)
@@ -106,7 +106,7 @@ def RDPBitmapToQtImage(width: int, height: int, bitsPerPixel: int, isCompressed:
106106

107107

108108
def convert8bppTo16bpp(buf: bytes):
109-
"""
109+
r"""
110110
WARNING: The actual 8bpp images work by using a color palette, which this method does not use.
111111
This method instead tries to transform indices into colors. This results in a weird looking image,
112112
but it can still be useful to see whats happening ¯\_(ツ)_/¯

0 commit comments

Comments
 (0)