From 98d9de6f92a98f57e531a63d00b2477a66661a62 Mon Sep 17 00:00:00 2001 From: Halldor Fannar Date: Sun, 18 Jan 2026 13:30:07 +0000 Subject: [PATCH] Monkey patch PROT_READ to enable docs build on Windows --- docs/source/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 05471e5..76d00c6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,6 +8,13 @@ import ctypes +# Monkey-patch PROT_READ into mmap if missing (Windows), so that we can +# import mss.linux.xshmgetimage while building the documentation. +import mmap + +if not hasattr(mmap, "PROT_READ"): + mmap.PROT_READ = 1 # type:ignore[attr-defined] + import mss # -- General configuration ------------------------------------------------ @@ -44,7 +51,6 @@ ctypes.WINFUNCTYPE = ctypes.CFUNCTYPE # type:ignore[attr-defined] ctypes.WinError = lambda _code=None, _descr=None: OSError() # type:ignore[attr-defined] - # -- Options for HTML output ---------------------------------------------- html_theme = "shibuya"