From fd1a64dccd636626fce236c9a6b9c2a995ede43b Mon Sep 17 00:00:00 2001 From: Alex Clark Date: Tue, 31 May 2011 11:24:38 -0400 Subject: [PATCH] Kludge fix for multiarch support --- setup.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/setup.py b/setup.py index c8d183ad4..f9848ee8d 100644 --- a/setup.py +++ b/setup.py @@ -121,6 +121,13 @@ class pil_build_ext(build_ext): _add_directory(library_dirs, "/lib64") _add_directory(library_dirs, "/usr/lib64") _add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu") + else: + _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") + + # XXX Kludge. Above /\ we brute force support multiarch. Here we + # try Barry's more general approach. Afterward, something should + # work ;-) + self.add_multiarch_paths() _add_directory(library_dirs, "/usr/local/lib") # FIXME: check /opt/stuff directories here? @@ -419,6 +426,23 @@ class pil_build_ext(build_ext): if m.group(1) < "1.2.3": return m.group(1) + # http://hg.python.org/users/barry/rev/7e8deab93d5a + def add_multiarch_paths(self): + # Debian/Ubuntu multiarch support. + # https://wiki.ubuntu.com/MultiarchSpec + # self.build_temp + 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' % + tmpfile) + ret = os.system( + 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' % + tmpfile) + try: + if ret >> 8 == 0: + with open(tmpfile) as fp: + setup( name=NAME, version=VERSION,