Skip to content

Commit 94b9e25

Browse files
committed
Refactor Python version directives
Added Python37 definition, won't add interop until final release
1 parent 4f29801 commit 94b9e25

File tree

2 files changed

+35
-76
lines changed

2 files changed

+35
-76
lines changed

src/runtime/assemblyinfo.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@
1515
#if PYTHON27
1616
[assembly: AssemblyTitle("Python.Runtime for Python 2.7")]
1717
[assembly: AssemblyDescription("Python Runtime for Python 2.7")]
18-
#endif
19-
#if PYTHON33
18+
#elif PYTHON33
2019
[assembly: AssemblyTitle("Python.Runtime for Python 3.3")]
2120
[assembly: AssemblyDescription("Python Runtime for Python 3.3")]
22-
#endif
23-
#if PYTHON34
21+
#elif PYTHON34
2422
[assembly: AssemblyTitle("Python.Runtime for Python 3.4")]
2523
[assembly: AssemblyDescription("Python Runtime for Python 3.4")]
26-
#endif
27-
#if PYTHON35
24+
#elif PYTHON35
2825
[assembly: AssemblyTitle("Python.Runtime for Python 3.5")]
2926
[assembly: AssemblyDescription("Python Runtime for Python 3.5")]
30-
#endif
31-
#if PYTHON36
27+
#elif PYTHON36
3228
[assembly: AssemblyTitle("Python.Runtime for Python 3.6")]
3329
[assembly: AssemblyDescription("Python Runtime for Python 3.6")]
30+
#elif PYTHON37
31+
[assembly: AssemblyTitle("Python.Runtime for Python 3.7")]
32+
[assembly: AssemblyDescription("Python Runtime for Python 3.7")]
3433
#endif

src/runtime/runtime.cs

Lines changed: 28 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -103,96 +103,56 @@ public class Runtime
103103
#error You must define either UCS2 or UCS4!
104104
#endif
105105

106-
#if (PYTHON23)
107-
public const string pyversion = "2.3";
108-
public const int pyversionnumber = 23;
109-
#endif
110-
#if (PYTHON24)
111-
public const string pyversion = "2.4";
112-
public const int pyversionnumber = 24;
113-
#endif
114-
#if (PYTHON25)
115-
public const string pyversion = "2.5";
116-
public const int pyversionnumber = 25;
117-
#endif
118-
#if (PYTHON26)
119-
public const string pyversion = "2.6";
120-
public const int pyversionnumber = 26;
121-
#endif
122-
#if (PYTHON27)
106+
#if PYTHON27
123107
public const string pyversion = "2.7";
124108
public const int pyversionnumber = 27;
125-
#endif
126-
#if (PYTHON32)
127-
public const string pyversion = "3.2";
128-
public const int pyversionnumber = 32;
129-
#endif
130-
#if (PYTHON33)
109+
#elif PYTHON33
131110
public const string pyversion = "3.3";
132111
public const int pyversionnumber = 33;
133-
#endif
134-
#if (PYTHON34)
112+
#elif PYTHON34
135113
public const string pyversion = "3.4";
136114
public const int pyversionnumber = 34;
137-
#endif
138-
#if (PYTHON35)
115+
#elif PYTHON35
139116
public const string pyversion = "3.5";
140117
public const int pyversionnumber = 35;
141-
#endif
142-
#if (PYTHON36)
118+
#elif PYTHON36
143119
public const string pyversion = "3.6";
144120
public const int pyversionnumber = 36;
145-
#endif
146-
#if ! (PYTHON23 || PYTHON24 || PYTHON25 || PYTHON26 || PYTHON27 || PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36)
147-
#error You must define one of PYTHON23 to PYTHON36
121+
#elif PYTHON37
122+
// TODO: Add interop37 after Python3.7 is released
123+
public const string pyversion = "3.7";
124+
public const int pyversionnumber = 37;
125+
#else
126+
#error You must define one of PYTHON33 to PYTHON37 or PYTHON27
148127
#endif
149128

150-
#if (PYTHON23)
151-
internal const string dllBase = "python23";
152-
#endif
153-
#if (PYTHON24)
154-
internal const string dllBase = "python24";
155-
#endif
156-
#if (PYTHON25)
157-
internal const string dllBase = "python25";
158-
#endif
159-
#if (PYTHON26)
160-
internal const string dllBase = "python26";
161-
#endif
162-
#if (PYTHON27)
129+
#if MONO_LINUX || MONO_OSX
130+
#if PYTHON27
163131
internal const string dllBase = "python27";
164-
#endif
165-
#if (MONO_LINUX || MONO_OSX)
166-
#if (PYTHON32)
167-
internal const string dllBase = "python3.2";
168-
#endif
169-
#if (PYTHON33)
132+
#elif PYTHON33
170133
internal const string dllBase = "python3.3";
171-
#endif
172-
#if (PYTHON34)
134+
#elif PYTHON34
173135
internal const string dllBase = "python3.4";
174-
#endif
175-
#if (PYTHON35)
136+
#elif PYTHON35
176137
internal const string dllBase = "python3.5";
177-
#endif
178-
#if (PYTHON36)
138+
#elif PYTHON36
179139
internal const string dllBase = "python3.6";
140+
#elif PYTHON37
141+
internal const string dllBase = "python3.7";
180142
#endif
181-
#else
182-
#if (PYTHON32)
183-
internal const string dllBase = "python32";
184-
#endif
185-
#if (PYTHON33)
143+
#else // Windows
144+
#if PYTHON27
145+
internal const string dllBase = "python27";
146+
#elif PYTHON33
186147
internal const string dllBase = "python33";
187-
#endif
188-
#if (PYTHON34)
148+
#elif PYTHON34
189149
internal const string dllBase = "python34";
190-
#endif
191-
#if (PYTHON35)
150+
#elif PYTHON35
192151
internal const string dllBase = "python35";
193-
#endif
194-
#if (PYTHON36)
152+
#elif PYTHON36
195153
internal const string dllBase = "python36";
154+
#elif PYTHON37
155+
internal const string dllBase = "python37";
196156
#endif
197157
#endif
198158

0 commit comments

Comments
 (0)