b7580a
diff -up Python-2.7.3/Modules/getpath.c.fix-for-usr-move Python-2.7.3/Modules/getpath.c
b7580a
--- Python-2.7.3/Modules/getpath.c.fix-for-usr-move	2013-03-06 14:25:32.801828698 -0500
b7580a
+++ Python-2.7.3/Modules/getpath.c	2013-03-06 15:59:30.872443168 -0500
b7580a
@@ -510,6 +510,24 @@ calculate_path(void)
b7580a
        MAXPATHLEN bytes long.
b7580a
     */
b7580a
 
b7580a
+    /*
b7580a
+      Workaround for rhbz#817554, where an empty argv0_path erroneously
b7580a
+      locates "prefix" as "/lib[64]/python2.7" due to it finding
b7580a
+      "/lib[64]/python2.7/os.py" via the /lib -> /usr/lib symlink for
b7580a
+      https://fedoraproject.org/wiki/Features/UsrMove
b7580a
+    */
b7580a
+    if (argv0_path[0] == '\0' && 0 == strcmp(prog, "cmpi_swig")) {
b7580a
+        /*
b7580a
+          We have an empty argv0_path, presumably because prog aka
b7580a
+          Py_GetProgramName() was not found on $PATH.
b7580a
+
b7580a
+          Set argv0_path to "/usr/" so that search_for_prefix() and
b7580a
+          search_for_exec_prefix() don't erroneously pick up
b7580a
+          on /lib/ via the UsrMove symlink:
b7580a
+        */
b7580a
+        strcpy(argv0_path, "/usr/");
b7580a
+    }
b7580a
+
b7580a
     if (!(pfound = search_for_prefix(argv0_path, home))) {
b7580a
         if (!Py_FrozenFlag)
b7580a
             fprintf(stderr,