bpo-10496: distutils check_environ() handles getpwuid() error (GH-10931)

check_environ() of distutils.utils now catchs KeyError on calling
pwd.getpwuid(): don't create the HOME environment variable in this
case.
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 8368262..30a21e4 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -157,8 +157,13 @@
         return
 
     if os.name == 'posix' and 'HOME' not in os.environ:
-        import pwd
-        os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
+        try:
+            import pwd
+            os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
+        except (ImportError, KeyError):
+            # bpo-10496: if the current user identifier doesn't exist in the
+            # password database, do nothing
+            pass
 
     if 'PLAT' not in os.environ:
         os.environ['PLAT'] = get_platform()