--- a/buildlibxml.py	2026-10-27 06:46:54
+++ b/buildlibxml.py	2026-10-27 06:46:55
@@ -61,6 +61,23 @@
     def build_libzip_name(libname, version):
         return f"{libname}-{version}.{arch}.zip"
 
+    # Local archives only: if destdir holds exactly one archive per library
+    # for this architecture, use them without any download. This allows
+    # rebuilding lxml with modified (e.g. relinked) libraries.
+    if os.path.isdir(destdir):
+        present = sorted(os.listdir(destdir))
+        local = {
+            libname: [fn for fn in present
+                      if fn.startswith(libname + '-') and fn.endswith(f'.{arch}.zip')]
+            for libname in ['libxml2', 'libxslt', 'zlib', 'iconv']
+        }
+        if all(len(found) == 1 for found in local.values()):
+            print(f'Using local library archives in "{destdir}" only')
+            return {
+                libname: unpack_zipfile(os.path.join(destdir, found[0]), destdir)
+                for libname, found in local.items()
+            }
+
     def read_latest_release():
         url = "https://api.github.com/repos/lxml/libxml2-win-binaries/releases?per_page=5"
         releases, _ = read_url(
