Author: rinrab Date: Mon Jul 8 17:46:00 2024 New Revision: 1919039 URL: http://svn.apache.org/viewvc?rev=1919039&view=rev Log: On the 'cmake' branch: Filter error codes to prevent warning.
When using `./gen-make -t cmake` command on Windows, there was a warning related to error codes generation. The simplest solution is to filter-out some error codes as it is done in the gen-win generator. This is not the best solution, but there are no great alternative. In addition, the file with the error codes would be empty in the tar-ball, so it's okay for this code to contain checks for the platform. Note: I decided to use 'sys.platform' constant instead of 'os.name' (which was in the original patch [1]) for the code to be more like the the code from the errno.pyi file. The errno.pyi file is part of the Python standard library and it contains a list of error codes and it is used by the gen_base.py module. Suggested by Jun Omae on dev@ [1]. * build/generator/gen_cmake.py (imports): Import 'sys' module for sys.platform constant. (errno_filter): New function, that filters the error code. Override this function only when platform is Windows. [1] https://lists.apache.org/thread/6y0v5ozn2wmrp4vhxdf5h647rg9h5vmt Modified: subversion/branches/cmake/build/generator/gen_cmake.py Modified: subversion/branches/cmake/build/generator/gen_cmake.py URL: http://svn.apache.org/viewvc/subversion/branches/cmake/build/generator/gen_cmake.py?rev=1919039&r1=1919038&r2=1919039&view=diff ============================================================================== --- subversion/branches/cmake/build/generator/gen_cmake.py (original) +++ subversion/branches/cmake/build/generator/gen_cmake.py Mon Jul 8 17:46:00 2024 @@ -20,6 +20,7 @@ # import os +import sys from build.generator.gen_make import UnknownDependency import ezt import gen_base @@ -279,3 +280,8 @@ class Generator(gen_base.GeneratorBase): if isinstance(target, gen_base.TargetExe): if target.install == "bdb-test": return True + + if sys.platform == 'win32': + def errno_filter(self, codes): + """From errno_filter() in gen_win.py""" + return [code for code in codes if not (10000 <= code <= 10100)]
