[Python-Dev] [Python-checkins] cpython (3.1): Issue 11715: Build extension modules on multiarch Debian and Ubuntu by (original) (raw)

Éric Araujo merwok at netwok.org
Fri Apr 8 18:10:35 CEST 2011


Hi,

http://hg.python.org/cpython/rev/7582a78f573b branch: 3.1 user: Barry Warsaw <barry at python.org> summary: Issue 11715: Build extension modules on multiarch Debian and Ubuntu by extending search paths to include multiarch directories.

diff --git a/setup.py b/setup.py

+ if not os.path.exists(self.buildtemp): + os.makedirs(self.buildtemp)

Isn’t there a possible raise condition here? I think it’s recommended to follow EAFP for mkdir and makedirs.

+ ret = os.system( + 'dpkg-architecture -qDEBHOSTMULTIARCH > %s 2> /dev/null' % + tmpfile) + try: + if ret >> 8 == 0: + with open(tmpfile) as fp: + multiarchpathcomponent = fp.readline().strip() + adddirtolist(self.compiler.librarydirs, + '/usr/lib/' + multiarchpathcomponent) + adddirtolist(self.compiler.includedirs, + '/usr/include/' + multiarchpathcomponent) + finally: + os.unlink(tmpfile)

Is there a benefit in creating and reading a file rather than catching stdout?

Regards



More information about the Python-Dev mailing list