db/sqlite3/src/sqlite-version.py

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial