[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: errno intersects APR error codes

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Sun, 2 Jun 2013 22:01:07 +0200

'On Fri, May 31, 2013 at 12:23 PM, Daniel Shahaf <danielsh_at_apache.org> wrote:
> On Fri, May 31, 2013 at 11:30:57AM +0200, Branko Čibej wrote:
>> I meant specifically the bit that prints that warning, which maybe shouldn't
>> be quite so platform-agnostic.
>
> Agreed. I don't have a windows box to test the following patch on:
>
> Index: build/generator/gen_base.py
> ===================================================================
> --- build/generator/gen_base.py (revision 1488101)
> +++ build/generator/gen_base.py (working copy)
> @@ -239,8 +239,7 @@ class GeneratorBase:
> except: pass
> os.rename(new_hdrfile, hdrfile)
>
> - @staticmethod
> - def write_errno_table():
> + def write_errno_table(self):
> # ### We generate errorcode.inc at autogen.sh time (here!).
> # ###
> # ### Currently it's only used by maintainer-mode builds. If this
> @@ -278,9 +277,12 @@ class GeneratorBase:
>
> ## sanity check
> intersection = set(errno.errorcode.keys()) & set(dict(aprerr).keys())
> - if intersection:
> + if self.errno_filter(intersection):
> print("WARNING: errno intersects APR error codes: %r" % intersection)
>
> + def errno_filter(self, codes):
> + return codes
> +
> class DependencyGraph:
> """Record dependencies between build items.
>
> Index: build/generator/gen_win.py
> ===================================================================
> --- build/generator/gen_win.py (revision 1488100)
> +++ build/generator/gen_win.py (working copy)
> @@ -337,6 +337,11 @@ class WinGeneratorBase(GeneratorBase):
> else:
> print("%s not found; skipping SWIG file generation..." % self.swig_exe)
>
> + def errno_filter(codes):
> + "Callback for gen_base.write_errno_table()."
> + # Filter out apr_errno.h SOC* codes, which alias the windows API names.
> + return set(filter(lambda code: not (10000 <= code <= 10100), codes))
> +
> def find_rootpath(self):
> "Gets the root path as understand by the project system"
> return os.path.relpath('.', self.projfilesdir) + "\\"

This yields an error:

Traceback (most recent call last):
  File "gen-make.py", line 324, in <module>
    main(conf, gentype, skip_depends=skip, other_options=rest.list)
  File "gen-make.py", line 67, in main
    generator.write_errno_table()
  File "build\generator\gen_base.py", line 280, in write_errno_table
    if self.errno_filter(intersection):
TypeError: errno_filter() takes exactly 1 argument (2 given)

If I add a 'self' parameter to the signature of errno_filter in
gen_win.py, it seems to work (i.e. no error / warning output anymore).
But I'm not sure if that's the right fix ... my Python knowledge is
not very advanced :-).

(thanks for the patch BTW)

--
Johan
Received on 2013-06-02 22:01:57 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.