Skip to content
This repository was archived by the owner on Jun 14, 2019. It is now read-only.

Commit c7605b9

Browse files
committed
Fix link error on Mac
1 parent 6d156ae commit c7605b9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

setup.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import print_function, with_statement
22

33
import ast
4+
import atexit
45
import distutils.cmd
56
import distutils.log
67
import distutils.sysconfig
@@ -93,6 +94,30 @@ def customize_compiler(compiler):
9394
flags.append(
9495
'-Wno-error=unused-command-line-argument-hard-error-in-future',
9596
)
97+
# Dirty workaround to avoid link error...
98+
# Python distutils doesn't provide any way to configure different
99+
# flags for each cc and c++.
100+
cencode_path = os.path.join(LIBSASS_DIR, 'cencode.c')
101+
cencode_body = ''
102+
with open(cencode_path) as f:
103+
cencode_body = f.read()
104+
with open(cencode_path, 'w') as f:
105+
f.write('''
106+
#ifdef __cplusplus
107+
extern "C" {
108+
#endif
109+
''')
110+
f.write(cencode_body)
111+
f.write('''
112+
#ifdef __cplusplus
113+
}
114+
#endif
115+
''')
116+
117+
@atexit.register
118+
def restore_cencode():
119+
with open(cencode_path, 'w') as f:
120+
f.write(cencode_body)
96121
link_flags = ['-fPIC', '-lstdc++']
97122

98123
sass_extension = Extension(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy