Browse Source

Fixed an RPM uninstall problem

Josh Yelon 21 years ago
parent
commit
8bd6db44da
1 changed files with 32 additions and 6 deletions
  1. 32 6
      doc/makepanda/maketarball.py

+ 32 - 6
doc/makepanda/maketarball.py

@@ -51,6 +51,28 @@ if ((os.path.exists(os.path.join(PANDASOURCE,"makepanda/makepanda.py"))==0) or
 
 
 os.chdir(PANDASOURCE)
 os.chdir(PANDASOURCE)
 
 
+########################################################################
+##
+## Locate the Python SDK
+##
+########################################################################
+
+if sys.platform == "win32":
+    PythonSDK="python2.2"
+    if 0: # Needs testing:
+        if   (os.path.isdir("C:/Python22")): PythonSDK = "C:/Python22"
+        elif (os.path.isdir("C:/Python23")): PythonSDK = "C:/Python23"
+        elif (os.path.isdir("C:/Python24")): PythonSDK = "C:/Python24"
+        elif (os.path.isdir("C:/Python25")): PythonSDK = "C:/Python25"
+        else: sys.exit("Cannot find the python SDK")
+else:
+    if   (os.path.isdir("/usr/include/python2.5")): PythonSDK = "/usr/include/python2.5"
+    elif (os.path.isdir("/usr/include/python2.4")): PythonSDK = "/usr/include/python2.4"
+    elif (os.path.isdir("/usr/include/python2.3")): PythonSDK = "/usr/include/python2.3"
+    elif (os.path.isdir("/usr/include/python2.2")): PythonSDK = "/usr/include/python2.2"
+    else: sys.exit("Cannot find the python SDK")
+    # this is so that the user can find out which version of python was used.
+
 ########################################################################
 ########################################################################
 ##
 ##
 ## Read the default version number from dtool/PandaVersion.pp
 ## Read the default version number from dtool/PandaVersion.pp
@@ -100,14 +122,13 @@ The Panda3D engine.
 %build
 %build
 makepanda/makepanda.py --version VERSION --everything MOREARGUMENTS
 makepanda/makepanda.py --version VERSION --everything MOREARGUMENTS
 %install
 %install
-PYTHONV=`cat built/tmp/pythonversion`
 rm -rf $RPM_BUILD_ROOT
 rm -rf $RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT/usr/bin
 mkdir -p $RPM_BUILD_ROOT/usr/bin
 mkdir -p $RPM_BUILD_ROOT/usr/include
 mkdir -p $RPM_BUILD_ROOT/usr/include
 mkdir -p $RPM_BUILD_ROOT/usr/lib
 mkdir -p $RPM_BUILD_ROOT/usr/lib
 mkdir -p $RPM_BUILD_ROOT/usr/share/panda3d
 mkdir -p $RPM_BUILD_ROOT/usr/share/panda3d
-mkdir -p $RPM_BUILD_ROOT/usr/lib/$PYTHONV/lib-dynload
-mkdir -p $RPM_BUILD_ROOT/usr/lib/$PYTHONV/site-packages
+mkdir -p $RPM_BUILD_ROOT/usr/lib/PYTHONV/lib-dynload
+mkdir -p $RPM_BUILD_ROOT/usr/lib/PYTHONV/site-packages
 mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
 mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
 mkdir -p $RPM_BUILD_ROOT/usr/bin
 mkdir -p $RPM_BUILD_ROOT/usr/bin
 
 
@@ -130,12 +151,12 @@ cp doc/LICENSE               $RPM_BUILD_ROOT/usr/lib/panda3d/LICENSE
 cp doc/LICENSE               $RPM_BUILD_ROOT/usr/share/panda3d/LICENSE
 cp doc/LICENSE               $RPM_BUILD_ROOT/usr/share/panda3d/LICENSE
 cp doc/LICENSE               $RPM_BUILD_ROOT/usr/include/panda3d/LICENSE
 cp doc/LICENSE               $RPM_BUILD_ROOT/usr/include/panda3d/LICENSE
 echo "/usr/lib/panda3d" >    $RPM_BUILD_ROOT/etc/ld.so.conf.d/panda3d.conf
 echo "/usr/lib/panda3d" >    $RPM_BUILD_ROOT/etc/ld.so.conf.d/panda3d.conf
-echo "/usr/share/panda3d" >  $RPM_BUILD_ROOT/usr/lib/$PYTHONV/site-packages/panda3d.pth
+echo "/usr/share/panda3d" >  $RPM_BUILD_ROOT/usr/lib/PYTHONV/site-packages/panda3d.pth
 cp built/bin/*               $RPM_BUILD_ROOT/usr/bin/
 cp built/bin/*               $RPM_BUILD_ROOT/usr/bin/
 
 
 for x in built/lib/* ; do
 for x in built/lib/* ; do
   base=`basename $x`
   base=`basename $x`
-  ln -sf /usr/lib/panda3d/$base $RPM_BUILD_ROOT/usr/lib/$PYTHONV/lib-dynload/$base
+  ln -sf /usr/lib/panda3d/$base $RPM_BUILD_ROOT/usr/lib/PYTHONV/lib-dynload/$base
 done
 done
 for x in $RPM_BUILD_ROOT/usr/share/panda3d/direct/src/* ; do
 for x in $RPM_BUILD_ROOT/usr/share/panda3d/direct/src/* ; do
   if [ `basename $x` != extensions ] ; then
   if [ `basename $x` != extensions ] ; then
@@ -143,8 +164,12 @@ for x in $RPM_BUILD_ROOT/usr/share/panda3d/direct/src/* ; do
   fi
   fi
 done
 done
 
 
+chmod -R 555 $RPM_BUILD_ROOT/usr/share/panda3d
+
 %post
 %post
 /sbin/ldconfig
 /sbin/ldconfig
+rm -rf /usr/lib/PYTHONV/direct
+rm -rf /usr/lib/PYTHONV/SceneEditor
 %postun
 %postun
 /sbin/ldconfig
 /sbin/ldconfig
 %clean
 %clean
@@ -164,7 +189,8 @@ MORE=''
 for x in sys.argv[2:]: MORE=MORE+x+' '
 for x in sys.argv[2:]: MORE=MORE+x+' '
 SPEC=SPEC.replace("VERSION",str(VERSION))
 SPEC=SPEC.replace("VERSION",str(VERSION))
 SPEC=SPEC.replace("MOREARGUMENTS",MORE)
 SPEC=SPEC.replace("MOREARGUMENTS",MORE)
-                  
+SPEC=SPEC.replace("PYTHONV",os.path.basename(PythonSDK))
+
 ########################################################################
 ########################################################################
 ##
 ##
 ## Build the Zip-file and Tar-File
 ## Build the Zip-file and Tar-File