|
| 1 | +--- setup.py.orig 2011-07-07 19:19:43.800122463 +0900 |
| 2 | ++++ setup.py 2011-07-07 19:25:04.548416377 +0900 |
| 3 | +@@ -13,6 +13,7 @@ |
| 4 | + from distutils.command.build_ext import build_ext |
| 5 | + from distutils.command.install import install |
| 6 | + from distutils.command.install_lib import install_lib |
| 7 | ++from distutils.spawn import find_executable |
| 8 | + |
| 9 | + # This global variable is used to hold the list of modules to be disabled. |
| 10 | + disabled_module_list = [] |
| 11 | +@@ -242,10 +243,34 @@ |
| 12 | + return platform |
| 13 | + return sys.platform |
| 14 | + |
| 15 | ++ def add_multiarch_paths(self): |
| 16 | ++ # Debian/Ubuntu multiarch support. |
| 17 | ++ # https://wiki.ubuntu.com/MultiarchSpec |
| 18 | ++ if not find_executable('dpkg-architecture'): |
| 19 | ++ return |
| 20 | ++ tmpfile = os.path.join(self.build_temp, 'multiarch') |
| 21 | ++ if not os.path.exists(self.build_temp): |
| 22 | ++ os.makedirs(self.build_temp) |
| 23 | ++ ret = os.system( |
| 24 | ++ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' % |
| 25 | ++ tmpfile) |
| 26 | ++ try: |
| 27 | ++ if ret >> 8 == 0: |
| 28 | ++ fp = open(tmpfile) |
| 29 | ++ multiarch_path_component = fp.readline().strip() |
| 30 | ++ fp.close() |
| 31 | ++ add_dir_to_list(self.compiler.library_dirs, |
| 32 | ++ '/usr/lib/' + multiarch_path_component) |
| 33 | ++ add_dir_to_list(self.compiler.include_dirs, |
| 34 | ++ '/usr/include/' + multiarch_path_component) |
| 35 | ++ finally: |
| 36 | ++ os.unlink(tmpfile) |
| 37 | ++ |
| 38 | + def detect_modules(self): |
| 39 | + # Ensure that /usr/local is always used |
| 40 | + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') |
| 41 | + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') |
| 42 | ++ self.add_multiarch_paths() |
| 43 | + |
| 44 | + # Add paths specified in the environment variables LDFLAGS and |
| 45 | + # CPPFLAGS for header and library files. |
0 commit comments