On 2024/10/04 3:54, Johan Corveleyn wrote: > Hi, > > I ran into a small issue when building trunk on Windows with zlib 1.3. > Not a big deal, I could work around it. But I don't have time right > now to come up with a proper patch, so I thought I'd just mention it > here already. > > When trying to build on Windows with zlib 1.3, gen_make.py (actually > gen_win_dependencies.py) bails out with: > > [[[ > python gen-make.py ... > --with-zlib=C:\research\svn\dev\deps64\zlib-1.3 --vsnet-version=2019 > -t vcproj > Generating for Visual Studio 2019 > > Traceback (most recent call last): > File "C:\research\svn\dev\trunk\gen-make.py", line 331, in <module> > main(conf, gentype, skip_depends=skip, other_options=rest.list) > File "C:\research\svn\dev\trunk\gen-make.py", line 62, in main > generator = gen_module.Generator(fname, verfname, other_options) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "C:\research\svn\dev\trunk\build\generator\gen_vcnet_vcproj.py", > line 35, in __init__ > gen_win.WinGeneratorBase.__init__(self, fname, verfname, options, > File "C:\research\svn\dev\trunk\build\generator\gen_win.py", line > 78, in __init__ > self.find_libraries(True) > File "C:\research\svn\dev\trunk\build\generator\gen_win_dependencies.py", > line 332, in find_libraries > self._find_zlib() > File "C:\research\svn\dev\trunk\build\generator\gen_win_dependencies.py", > line 775, in _find_zlib > version = tuple(map(int, vermatch.groups())) > ^^^^^^^^^^^^^^^ > AttributeError: 'NoneType' object has no attribute 'groups' > ]]] > > The problem seems to be the two digit version number 1.3, instead of > three digits like 1.2.11. > > A patch like this fixes it for me, but it's obviously not correct, > because now it only supports 2-digit version numbers, and no longer > 3-digits (maybe a proper fix would be to first test if the 3-digit > form matches, then an if-else block for 3 or 2 digits? Or if there is > a more elegant way ...?).
Please try the following patch: [[[ Index: build/generator/gen_win_dependencies.py =================================================================== --- build/generator/gen_win_dependencies.py (revision 1921101) +++ build/generator/gen_win_dependencies.py (working copy) @@ -769,11 +769,11 @@ txt = open(version_file_path).read() vermatch = re.search( - r'^\s*#define\s+ZLIB_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:\.\d)?"', + r'^\s*#define\s+ZLIB_VERSION\s+"(\d+(?:\.\d+){1,3})(?:-\w+)?"', txt, re.M) - version = tuple(map(int, vermatch.groups())) - self.zlib_version = '%d.%d.%d' % version + version = tuple(map(int, vermatch.group(1).split('.'))) + self.zlib_version = '.'.join(map(str, version)) if version < minimal_zlib_version: sys.stderr.write("ERROR: ZLib %s or higher is required " ]]] [[[ Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> minimal_zlib_version = (1, 2, 5) >>> (1, 2) < minimal_zlib_version True >>> (1, 2, 4) < minimal_zlib_version True >>> (1, 2, 4, 1) < minimal_zlib_version True >>> (1, 2, 5) < minimal_zlib_version False >>> (1, 3) < minimal_zlib_version False >>> (1, 3, 1) < minimal_zlib_version False >>> (1, 3, 1, 1) < minimal_zlib_version False ]]] -- Jun Omae <jun6...@gmail.com> (大前 潤)