11import glob
2+ import os
3+ import platform
24import re
35import shutil
46import subprocess
5- import os
67
78from setuptools import setup , Extension
89import setuptools .command .build_py
1819BOOST_BASE = os .environ .get ("BOOST_BASE" , "" )
1920XERCES_C_BASE = os .environ .get ("XERCES_C_BASE" , "" )
2021
22+
2123class BuildPyCommand (setuptools .command .build_py .build_py ):
2224 """Custom build command."""
2325
@@ -57,6 +59,14 @@ def run(self):
5759 # run actual build command
5860 setuptools .command .build_py .build_py .run (self )
5961
62+
63+ def get_extra_link_args ():
64+ extra_link_args = []
65+ if platform .system () == "Darwin" :
66+ extra_link_args .append ("-Wl,-headerpad_max_install_names" ) # macos install_name_tool issues
67+ return extra_link_args
68+
69+
6070tmTable_ext = Extension (
6171 name = "_tmTable" ,
6272 define_macros = [("SWIG" , "1" ), ("DNDEBUG" , "1" )],
@@ -74,7 +84,8 @@ def run(self):
7484 os .path .join (UTM_BASE , "lib" ),
7585 ],
7686 libraries = ["xerces-c" , "tmutil" , "tmxsd" , "tmtable" ],
77- extra_compile_args = ["-std=c++11" , "-O2" ]
87+ extra_compile_args = ["-std=c++11" , "-O2" ],
88+ extra_link_args = get_extra_link_args ()
7889)
7990
8091setup (
0 commit comments