diff options
author | Barry Warsaw <barry@python.org> | 2011-04-06 19:19:05 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2011-04-06 19:19:05 (GMT) |
commit | 3178b7dee17bf535b08421a7fe39965ff792c2c7 (patch) | |
tree | 4eb79d70975a58937c68197db3c15e8de1420ef1 /setup.py | |
parent | c5c147289556d9941876bb4b209412ad52731eb0 (diff) | |
parent | 5ca305a599d487beba642903914f0a55259f9d52 (diff) | |
download | cpython-3178b7dee17bf535b08421a7fe39965ff792c2c7.zip cpython-3178b7dee17bf535b08421a7fe39965ff792c2c7.tar.gz cpython-3178b7dee17bf535b08421a7fe39965ff792c2c7.tar.bz2 |
Issue 11715: Merge multiarch fix from 3.1 branch.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -370,12 +370,33 @@ class PyBuildExt(build_ext): return platform return sys.platform + def add_multiarch_paths(self): + # Debian/Ubuntu multiarch support. + # https://wiki.ubuntu.com/MultiarchSpec + tmpfile = os.path.join(self.build_temp, 'multiarch') + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) + ret = os.system( + 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' % + tmpfile) + try: + if ret >> 8 == 0: + with open(tmpfile) as fp: + multiarch_path_component = fp.readline().strip() + add_dir_to_list(self.compiler.library_dirs, + '/usr/lib/' + multiarch_path_component) + add_dir_to_list(self.compiler.include_dirs, + '/usr/include/' + multiarch_path_component) + finally: + os.unlink(tmpfile) + def detect_modules(self): # Ensure that /usr/local is always used, but the local build # directories (i.e. '.' and 'Include') must be first. See issue # 10520. add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + self.add_multiarch_paths() # Add paths specified in the environment variables LDFLAGS and # CPPFLAGS for header and library files. |