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

[PATCH] v3.2 Fixed gen_win.py to display Serf library version#

From: Edmund Wong <ed_at_kdtc.net>
Date: Mon, 14 Sep 2009 11:30:11 +0800

Hi,

After going over the review by arfrever for v3 patch, I've made a
minor tweak to the previous v3 patch. Defined a minimal_serf
constant to be compared with the actual serf version found.

Edmund

Log:

[[[

Fixed gen_win.py such that it checks for the presence of the
Serf library (which it does prior to this patch) and also
outputs the library version (which is what this patch does).
It also checks if the serf version >= 0.3.0. If not, ra_serf
is not built.

* build/generator/gen_win.py
      (_get_serf_version): New function to return the serf library
        version.
      (_find_serf): Added a version check and if a valid version
        is found, ra_serf is built; otherwise, it isn't. If the
        version cannot be determined, ra_serf will still be built.
        The user is the informed of the results.

Patch by: Edmund Wong <ed at kdtc.net>
Suggested by: danielsh
Review by: arfrever
            lgo
            rhuijben
            danielsh
            rdonch

]]]

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2394424

Index: build/generator/gen_win.py
===================================================================
--- build/generator/gen_win.py (revision 39236)
+++ build/generator/gen_win.py (working copy)
@@ -1318,13 +1318,55 @@
 
     sys.stderr.write(msg)
 
+ def _get_serf_version(self):
+ "Retrieves the serf version from serf.h"
+
+ ver_maj = -1
+ ver_min = -1
+ ver_patch = -1
+
+ if self.serf_path and os.path.exists(self.serf_path):
+ if (os.path.exists(os.path.join(self.serf_path, 'serf.h'))):
+ fp = open(os.path.join(self.serf_path, 'serf.h'))
+ txt = fp.read()
+ maj_t = re.compile(r'SERF_MAJOR_VERSION\s+(\d+)')
+ min_t = re.compile(r'SERF_MINOR_VERSION\s+(\d+)')
+ patch_t = re.compile(r'SERF_PATCH_VERSION\s+(\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 = int(ver_maj_re.groups()[0])
+ if ver_min_re:
+ ver_min = int(ver_min_re.groups()[0])
+ if ver_patch_re:
+ ver_patch = int(ver_patch_re.groups()[0])
+
+ return (ver_maj, ver_min, ver_patch)
+
   def _find_serf(self):
     "Check if serf and its dependencies are available"
-
+
+ minimal_serf_version = (0, 3, 0)
     self.serf_lib = None
     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 = str(version[0]) +"."+str(version[1]) + "." + \
+ str(version[2])
+ if version < minimal_serf_version:
+ sys.stderr.write('Serf version >= 0.3.0 required. Found %s' \
+ % self.serf_ver)
+ self.sef_lib = None
+ msg = 'Unsupported Serf version found. ra_serf will not be built.\n'
+ else:
+ msg = 'Found serf version %s\n' % self.serf_ver
+ else:
+ msg = 'Unknown serf version found; but, will try to build'+\
+ 'ra_serf.\n'
+ sys.stderr.write(msg)
       else:
         sys.stderr.write('openssl not found, ra_serf will not be built\n')
     else:
Received on 2009-09-14 05:37:20 CEST

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