cython build can race on creation of CYTHON_BUILD_DIR
Noticed while building on arm64, but may apply elsewhere: Got this failure:
Traceback (most recent call last): File "./setup.py", line 47, in <module> ], build_dir=os.environ.get("CYTHON_BUILD_DIR", None)), File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 796, in cythonize os.makedirs(dir) File "/usr/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 17] File exists: '/tmp/buildd/ceph-10.1.0/src/build' Makefile:32318: recipe for target 'rados-pybind-all' failed
The issue is that /tmp/buildd/ceph-10.1.0/src/build, which is CYTHON_BUILD_DIR, is used for all three pybind builds, and if they're executing simultaneously, they can race on "is directory present, if not, create it".
Josh says that top-of-tree Cython now has a 'safe_makedirs' call there, but at least with this version (0.23.4-0ubuntu5 on arm64/xenial) it's still an issue.
Josh also suggests that doing the mkdir before calling setup.py would be a workaround, and that seems low-cost.