Mercurial > cpython-lru_cache-weakref
annotate PC/python32gen.py @ 71285:8bc9dbc61ba6 3.2
Issue #12326: document the recommended idiom for checking sys.platform on Unix systems.
Also, point to the various alternatives.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 09 Jul 2011 15:54:23 +0200 |
| parents | 1ea492ea40fd |
| children |
| rev | line source |
|---|---|
|
68253
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
1 # Generate python32stub.def out of python3.def |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
2 # The regular import library cannot be used, |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
3 # since it doesn't provide the right symbols for |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
4 # data forwarding |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
5 out = open("python32stub.def", "w") |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
6 out.write('LIBRARY "python32"\n') |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
7 out.write('EXPORTS\n') |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
8 |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
9 inp = open("python3.def") |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
10 inp.readline() |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
11 line = inp.readline() |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
12 assert line.strip()=='EXPORTS' |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
13 |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
14 for line in inp: |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
15 # SYM1=python32.SYM2[ DATA] |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
16 head, tail = line.split('.') |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
17 if 'DATA' in tail: |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
18 symbol, tail = tail.split(' ') |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
19 else: |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
20 symbol = tail.strip() |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
21 out.write(symbol+'\n') |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
22 |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
23 inp.close() |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
24 out.close() |
|
1ea492ea40fd
Add updated .hgeol file and fix newlines in the 3.2 branch.
Georg Brandl <georg@python.org>
parents:
66755
diff
changeset
|
25 |
