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

RE: [PATCH] Fixed gen_win.py to display Serf library version#

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Sun, 13 Sep 2009 17:41:47 +0200

> -----Original Message-----
> From: Arfrever Frehtes Taifersar Arahesis
> [mailto:Arfrever.FTA_at_GMail.Com]
> Sent: zaterdag 12 september 2009 18:41
> To: Edmund Wong; dev_at_subversion.tigris.org
> Subject: Re: [PATCH] Fixed gen_win.py to display Serf library version#
>
> 2009-09-11 11:06:08 Edmund Wong napisaƂ(a):
> > Index: build/generator/gen_win.py
> > ===================================================================
> > --- build/generator/gen_win.py (revision 39236)
> > +++ build/generator/gen_win.py (working copy)
> > @@ -1318,6 +1318,38 @@
> >
> > sys.stderr.write(msg)
> >
> > + def _get_serf_version(self):
> > + "Retrieves the serf version from serf.h"
> > +
>
> Please don't add trailing whitespace here and in other places.
>
> > + ver_maj = -1
> > + ver_min = -1
> > + ver_patch = -1
> > +
> > + if self.serf_path and os.path.exists(self.serf_path):
> > + fp = open(os.path.join(self.serf_path, 'serf.h'))

The path is checked for existance), but serf.h isn't. Does this error if the path exists but the .h doesn't?

        Bert

> > + txt = fp.read()
> > + maj_t = re.compile(r'SERF_MAJOR_VERSION (\d+)')
> > + min_t = re.compile(r'SERF_MINOR_VERSION (\d+)')
> > + patch_t = re.compile(r'SERF_PATCH_VERSION (\d+)')
> > + ver_maj_re = maj_t.search(txt)
> > + ver_min_re = min_t.search(txt)
> > + ver_patch_re = patch_t.search(txt)
> > +
> > + if ver_maj_re:
> > + ver_maj_ray = map(int, ver_maj_re.groups())
>
> map() is deprecated. List comprehensions should be used instead of
> map().
>
> > + ver_maj = ver_maj_ray[0]
> > +
> > + if ver_min_re:
> > + ver_min_ray = map(int, ver_min_re.groups())
> > + ver_min = ver_min_ray[0]
> > +
> > + if ver_patch_re:
> > + ver_patch_ray = map(int, ver_patch_re.groups())
> > + ver_patch = ver_patch_ray[0]
> > +
> > + return ([ver_maj, ver_min, ver_patch])
> > +
> > +
> > def _find_serf(self):
> > "Check if serf and its dependencies are available"
> >
> > @@ -1325,6 +1357,14 @@
> > if self.serf_path and os.path.exists(self.serf_path):
> > if self.openssl_path and os.path.exists(self.openssl_path):
> > self.serf_lib = 'serf'
> > + version = self._get_serf_version()
> > + if version[0] != -1:
> > + self.serf_ver = `version[0]` +"."+`version[1]` +
> "."+`version[2]`
>
> `` is deprecated. repr() or str() should be used.
>
> > + msg = 'Found serf version %s\n' % self.serf_ver
> > + else:
> > + msg = 'Could not determine version, ra_serf will not be
> built\n'
> > + self.serf_lib = None
> > + sys.stderr.write(msg)
> > else:
> > sys.stderr.write('openssl not found, ra_serf will not be
> built\n')
> > else:
>
> --
> Arfrever Frehtes Taifersar Arahesis
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageI
> d=2394078

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2394308
Received on 2009-09-13 17:42:08 CEST

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