From d7e698fca86657801a01ab7248cd34cba59b8e12 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 18 Nov 2022 17:36:14 +0800 Subject: [PATCH] python/setup.py.in: Improve Windows import patching Move up the altImport function so that we ensure that it can be referred to and streamline it a bit, since we no longer attempt to build the libxslt Python bits here, at least on Windows. --- python/setup.py.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/setup.py.in b/python/setup.py.in index 57505eb0..0628f54d 100755 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -45,6 +45,11 @@ icu_dlls = ['icuuc%s.dll' % icu_series_s, 'icudt%s.dll' % icu_series_s] # dlls must be found somewhere in the PATH at runtime. WITHDLLS = 1 and sys.platform.startswith('win') +if WITHDLLS: + def altImport(s): + s = s.replace("import libxml2mod","from libxmlmods import libxml2mod") + return s + def missing(file): if os.access(file, os.R_OK) == 0: return 1 @@ -182,11 +187,6 @@ if WITHDLLS: os.mkdir("libxmlmods") open("libxmlmods/__init__.py","w").close() - def altImport(s): - s = s.replace("import libxml2mod","from libxmlmods import libxml2mod") - s = s.replace("import libxsltmod","from libxmlmods import libxsltmod") - return s - packaged_dlls = [os.path.join(ROOT,'bin',dll) for dll in dlls] descr = "libxml2 package"