Oops. there's an error with the listdir code in that patch, attaching a slightly better one :)
Various macOS fixes for setup_configure.py