Skip to content

Commit 7c03f32

Browse files
committed
Fix on SPARC Solaris.
Use C++ only on Windows. Define ENDIAN macros from `sys.byteorder`.
1 parent bf4124f commit 7c03f32

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

setup.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
class Sdist(sdist):
3434
def __init__(self, *args, **kwargs):
3535
cy_opt = cython_compiler.default_options.copy()
36-
cy_opt['cplus'] = True
36+
#cy_opt['cplus'] = True
3737
for src in glob('msgpack/*.pyx'):
3838
cython_compiler.compile(glob('msgpack/*.pyx'), cy_opt)
3939
sdist.__init__(self, *args, **kwargs)
4040
else:
41-
sources = ['msgpack/_msgpack.cpp']
41+
sources = ['msgpack/_msgpack.c']
4242

4343
for f in sources:
4444
if not os.path.exists(f):
@@ -47,16 +47,24 @@ def __init__(self, *args, **kwargs):
4747
Sdist = sdist
4848

4949
libraries = []
50+
language = 'c'
5051
if sys.platform == 'win32':
5152
libraries.append('ws2_32')
53+
language = 'c++'
54+
55+
if sys.byteorder == 'big':
56+
macros = [('__BIG_ENDIAN__', '1')]
57+
else:
58+
macros = [('__LITTLE_ENDIAN__', '1')]
5259

5360
msgpack_mod = Extension('msgpack._msgpack',
5461
sources=sources,
5562
libraries=libraries,
5663
include_dirs=['.'],
57-
language='c++',
64+
language=language,
65+
define_macros=macros,
5866
)
59-
del sources, libraries
67+
del sources, libraries, language, macros
6068

6169

6270
desc = 'MessagePack (de)serializer.'
@@ -79,7 +87,6 @@ def __init__(self, *args, **kwargs):
7987
classifiers=[
8088
'Programming Language :: Python :: 2',
8189
'Programming Language :: Python :: 3',
82-
'Development Status :: 4 - Beta',
8390
'Intended Audience :: Developers',
8491
'License :: OSI Approved :: Apache Software License',
8592
]

0 commit comments

Comments
 (0)