Concurrent installations can lose updates to easy-install.pth
An entry for a package in easy-install.pth can be lost if there is a concurrent installation process installing a different package.
The installation reads easy-install.pth, closes the file handle, updates it in-core, then reopens the file and writes out the updated data. If two processes read the file concurrently, one of the updates will be lost.
An approach would be to open the file read/write, take a lock on the file using (say) lockf, read the file, perform in-core updates, truncate the file, write the new contents, close the file handle.
This is causing build failures in our system image build process where we build full system images with many packages from scratch for installation on to read-only filesystems.