Please change line 27 in the builder script to
from os.path import abspath, isdir, isfile, join, basename, relpath
and then the previously discussed line (145) to
'-Wl,-Map="%s"' % relpath(join(env.subst("$PROJECT_BUILD_DIR"), env.subst("$PIOENV") , basename(env.subst("${PROJECT_DIR}.map")))).replace(" ", "_")
Does it work now?