Author martin.panter
Recipients Arfrever, barry, koobs, martin.panter, serhiy.storchaka, vstinner
Date 2016-05-10.12:42:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462884163.73.0.407528192782.issue22636@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a possible patch for Python 2. One snag is that ctypes is currently supposed to be compatible with Python 2.3, but subprocess was added in 2.4. The patch assumes it is okay to lift that compatibility restriction.

The main differences are:

* shutil.which() does not exist in Python 2. In _findLib_gcc() and the Gnu version of _get_soname(), I restored the mini shell script that runs “type” to check if commands are available. However I pass the library and file names as proper arguments, rather than inserting them into the shell syntax.

* subprocess.DEVNULL does not exist. Manually opened os.devnull where necessary.

* There was an extra Popen conversion for the Gnu “ldconfig -p” call. In Python 3, this was already converted thanks to revision 19d9f0a177de (Issue 11258).

* No context manager support for Popen objects. Instead, use communicate() where appropriate, or manually close and wait.

Again, I tested the Python 2 patch on Linux, but with mock platform-specific commands to exercise each new Popen() call.
History
Date User Action Args
2016-05-10 12:42:44martin.pantersetrecipients: + martin.panter, barry, vstinner, Arfrever, serhiy.storchaka, koobs
2016-05-10 12:42:43martin.pantersetmessageid: <1462884163.73.0.407528192782.issue22636@psf.upfronthosting.co.za>
2016-05-10 12:42:43martin.panterlinkissue22636 messages
2016-05-10 12:42:43martin.pantercreate