Skip to content

Commit 27072af

Browse files
authored
Merge pull request #37 from manicmaniac/fix-build-on-windows
Fix build on Windows
2 parents c750463 + b825219 commit 27072af

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

arc4.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#endif /* __inline__ */
1515
#endif /* __STDC_VERSION__ < 199901L */
1616

17+
#ifndef Py_STRINGIFY
18+
#define ARC4_XSTRINGIFY(x) #x
19+
#define Py_STRINGIFY(x) ARC4_XSTRINGIFY(x)
20+
#endif
21+
1722
struct arc4_state {
1823
unsigned char x, y, s[256];
1924
};
@@ -313,7 +318,8 @@ PyInit_arc4(void)
313318
return NULL;
314319
}
315320
Py_INCREF(&arc4_ARC4Type);
316-
PyModule_AddStringConstant(module, "__version__", ARC4_VERSION);
321+
PyModule_AddStringConstant(module, "__version__",
322+
Py_STRINGIFY(ARC4_VERSION));
317323
PyModule_AddObject(module, "ARC4", (PyObject *)&arc4_ARC4Type);
318324
return module;
319325
}
@@ -331,7 +337,8 @@ initarc4(void)
331337
return;
332338
}
333339
Py_INCREF(&arc4_ARC4Type);
334-
PyModule_AddStringConstant(module, "__version__", ARC4_VERSION);
340+
PyModule_AddStringConstant(module, "__version__",
341+
Py_STRINGIFY(ARC4_VERSION));
335342
PyModule_AddObject(module, "ARC4", (PyObject *)&arc4_ARC4Type);
336343
}
337344
#endif /* PY_MAJOR_VERSION >= 3 */

setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
VERSION = '0.1.0'
88

99

10-
def c_quote(string):
11-
return '"{}"'.format(string)
12-
13-
1410
def read_file(path):
1511
with open(path) as f:
1612
return f.read()
@@ -31,7 +27,7 @@ def read_file(path):
3127
ext_modules=[
3228
Extension('arc4',
3329
sources=['arc4.c'],
34-
define_macros=[('ARC4_VERSION', c_quote(VERSION))]),
30+
define_macros=[('ARC4_VERSION', VERSION)]),
3531
],
3632
classifiers=[
3733
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)