File 1_rpmroot.patch of Package pymol

--- setup2.py	2012-02-13 13:51:22.000000000 -0500
+++ setup2.py	2012-02-14 11:06:16.052599028 -0500
@@ -37,12 +37,19 @@
    uninstall = 0
    
 try:
+   import getopt
    
    if not (os.path.exists("data") and os.path.exists("LICENSE")):
       print ' Please run "python setup2.py" from the PyMOL source directory.'
    else:
+      rpm_root = ""
+      opts, args = getopt.gnu_getopt(sys.argv[1:], "r:", ["root="])
+      for opt, arg in opts:
+        if opt in ("-r", "--root"):
+          rpm_root = arg
       from setup3 import site_packages
       pymol_file = os.path.join(site_packages, 'pymol', '__init__.py')
+      inst_pymol_file = re.sub("^" + rpm_root,"",pymol_file)
       pymol_path = os.path.join(site_packages, 'pymol', 'pymol_path')
 
       if uninstall:
@@ -101,7 +108,7 @@
          if python_exe[0:2]=="./":
             python_exe=os.getcwd()+"/"+python_exe[2:]
          if sys.platform!='win32':
-            f.write(python_exe+" "+pymol_file+" \"$@\"\n")
+            f.write(python_exe+" "+inst_pymol_file+" \"$@\"\n")
          else:
             f.write('"%s" "%s" %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9\n'%(python_exe,pymol_file))
          f.close()
openSUSE Build Service is sponsored by