annotate Resources/PostgreSQL/PrepareCMakeConfigurationFile.py @ 331:674bbb9d1c83

added OdbcEnvironment::GlobalInitialization()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Aug 2021 07:28:53 +0200
parents 8c7bb94adff7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/usr/bin/python
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 import re
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 import sys
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 if len(sys.argv) != 3:
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 raise Exception('Bad number of arguments')
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
172
8c7bb94adff7 trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
9 r = re.compile(r'^#undef ([a-zA-Z0-9_]+)$')
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 with open(sys.argv[1], 'r') as f:
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 with open(sys.argv[2], 'w') as g:
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 for l in f.readlines():
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 m = r.match(l)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 if m != None:
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 s = m.group(1)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 g.write('#cmakedefine %s @%s@\n' % (s, s))
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 else:
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 g.write(l)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20