db/sqlite3/src/sqlite-version.py

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 # This Source Code Form is subject to the terms of the Mozilla Public
     2 # License, v. 2.0. If a copy of the MPL was not distributed with this
     3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 import sys
     6 import re
     8 # Define RegEx for finding and breaking apart SQLITE_VERSION string
     9 versionString = "^#define SQLITE_VERSION\D*(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?\D*"
    11 #Use command line argument pointing to sqlite3.h to open the file and use
    12 #the RegEx to search for the line #define SQLITE_VERSION. When the RegEx
    13 #matches and the line is found, print the version strings to the console
    14 #with #definey goodness.
    15 for line in open(sys.argv[1]):
    16     result = re.search(versionString, line)
    17     if result is not None:    #If RegEx matches, print version numbers and stop
    18         splitVersion = list(result.groups())
    19         if splitVersion[3] is None:       #Make 4th list element 0 if undefined
    20             splitVersion[3:] = ['0']
    21         print "#define SQLITE_VERSION_MAJOR " + splitVersion[0]
    22         print "#define SQLITE_VERSION_MINOR " + splitVersion[1]
    23         print "#define SQLITE_VERSION_PATCH " + splitVersion[2]
    24         print "#define SQLITE_VERSION_SUBPATCH " + splitVersion[3]
    25         break

mercurial