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 ...?).

[[[
Index: build/generator/gen_win_dependencies.py
===================================================================
--- build/generator/gen_win_dependencies.py     (revision 1921096)
+++ 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+)(?:\.\d)?"',
                  txt, re.M)

     version = tuple(map(int, vermatch.groups()))
-    self.zlib_version = '%d.%d.%d' % version
+    self.zlib_version = '%d.%d' % version

     if version < minimal_zlib_version:
       sys.stderr.write("ERROR: ZLib %s or higher is required "
]]]

-- 
Johan

Reply via email to