Skip to content

Commit

Permalink
#3978 cythonize more
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Sep 20, 2023
1 parent 037c1b5 commit c9d0c6d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
37 changes: 35 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def pkg_config_version(req_version, pkgname):
client_ENABLED = DEFAULT
scripts_ENABLED = not WIN32
cython_ENABLED = DEFAULT
cythonize_more_ENABLED = False
cython_tracing_ENABLED = False
modules_ENABLED = DEFAULT
data_ENABLED = DEFAULT
Expand Down Expand Up @@ -318,7 +319,7 @@ def has_header_file(name, isdir=False):
"csc_cython", "csc_libyuv", "gstreamer",
]
SWITCHES = [
"cython", "cython_tracing",
"cython", "cython_tracing", "cythonize_more",
"modules", "data",
"codecs",
] + CODEC_SWITCHES + [
Expand Down Expand Up @@ -678,7 +679,10 @@ def ace(modnames="xpra.x11.bindings.xxx", pkgconfig_names="", optimize=None, **k
src = modnames.split(",")
modname = src[0]
if not src[0].endswith(".pyx"):
src[0] = src[0].replace(".", "/")+".pyx"
for ext in ("pyx", "py"):
filename = src[0].replace(".", "/")+"."+ext
if os.path.exists(filename):
src[0] = filename
if isinstance(pkgconfig_names, str):
pkgconfig_names = [x for x in pkgconfig_names.split(",") if x]
pkgc = pkgconfig(*pkgconfig_names, optimize=optimize)
Expand Down Expand Up @@ -2267,6 +2271,35 @@ def bundle_tests():
toggle_packages(lz4_ENABLED, "xpra.net.lz4")
tace(lz4_ENABLED, "xpra.net.lz4.lz4", "liblz4")

if cythonize_more_ENABLED:
if client_ENABLED and gtk3_ENABLED:
ace("xpra.client.gtk3.cairo_backing")
ace("xpra.client.gtk3.client")
ace("xpra.client.gtk3.client_window")
ace("xpra.client.gui.window_backing_base")
ace("xpra.client.gui.window_base")
if codecs_ENABLED:
ace("xpra.codecs.image_wrapper")
ace("xpra.codecs.rgb_transform")
if http_ENABLED:
ace("xpra.net.http.http_handler")
ace("xpra.net.protocol.header")
ace("xpra.net.protocol.socket_handler")
if websockets_ENABLED:
ace("xpra.net.websockets.common")
ace("xpra.net.websockets.handler")
ace("xpra.net.websockets.header")
ace("xpra.net.websockets.protocol")
ace("xpra.net.bytestreams")
ace("xpra.net.crypto")
ace("xpra.net.digest")
ace("xpra.net.file_transfer")
ace("xpra.net.mmap_pipe")
ace("xpra.net.packet_encoding")
ace("xpra.net.subprocess_wrapper")
ace("xpra.server.window.window_source")
ace("xpra.server.window.window_video_source")


if ext_modules:
from Cython.Build import cythonize
Expand Down
3 changes: 3 additions & 0 deletions xpra/codecs/image_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def get_sub_image(self, x : int, y : int, w : int, h : int):
def __del__(self) -> None:
self.free()

def __dealloc__(self):
self.free()

def free(self) -> None:
if not self.freed:
self.freed = True
Expand Down

0 comments on commit c9d0c6d

Please sign in to comment.