Browse Source

Getting ready for 1.3.0

Josh Yelon 19 years ago
parent
commit
989af98143

+ 2 - 2
direct/src/directbase/ppython.cxx

@@ -23,13 +23,13 @@
 
 
 #ifdef BUILDING_GENPYCODE
 #ifdef BUILDING_GENPYCODE
 #define LINK_SOURCE "\\bin\\genpycode.exe"
 #define LINK_SOURCE "\\bin\\genpycode.exe"
-#define LINK_TARGET "\\bin\\ppython.exe"
+#define LINK_TARGET "\\python\\ppython.exe"
 #define GENPYCODE 1
 #define GENPYCODE 1
 #endif
 #endif
 
 
 #ifdef BUILDING_PACKPANDA
 #ifdef BUILDING_PACKPANDA
 #define LINK_SOURCE "\\bin\\packpanda.exe"
 #define LINK_SOURCE "\\bin\\packpanda.exe"
-#define LINK_TARGET "\\bin\\ppython.exe"
+#define LINK_TARGET "\\python\\ppython.exe"
 #define PACKPANDA 1
 #define PACKPANDA 1
 #endif
 #endif
 
 

+ 164 - 14
direct/src/directscripts/packpanda.nsi

@@ -97,6 +97,8 @@ Section "${SMDIRECTORY}" SecCore
         File "${PANDA}\direct\__init__.py"
         File "${PANDA}\direct\__init__.py"
         SetOutPath $INSTDIR\pandac
         SetOutPath $INSTDIR\pandac
         File /r "${PANDA}\pandac\*.py"
         File /r "${PANDA}\pandac\*.py"
+        SetOutPath $INSTDIR\python
+        File /r "${PANDA}\python\*"
 
 
         RMDir /r "$SMPROGRAMS\${SMDIRECTORY}"
         RMDir /r "$SMPROGRAMS\${SMDIRECTORY}"
         CreateDirectory "$SMPROGRAMS\${SMDIRECTORY}"
         CreateDirectory "$SMPROGRAMS\${SMDIRECTORY}"
@@ -107,10 +109,9 @@ Section "${SMDIRECTORY}" SecCore
             File /r /x CVS "${PANDA}\models\audio\*"
             File /r /x CVS "${PANDA}\models\audio\*"
             SetOutPath $INSTDIR\bin
             SetOutPath $INSTDIR\bin
             File /r "${PANDA}\bin\pzip.exe"
             File /r "${PANDA}\bin\pzip.exe"
-            File /r "${PANDA}\bin\ppython.exe"
             SetOutpath $INSTDIR\game
             SetOutpath $INSTDIR\game
             File /r "${PPGAME}\*"
             File /r "${PPGAME}\*"
-            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Play ${NAME}.lnk" "$INSTDIR\bin\ppython.exe" "${PPMAIN}" "$INSTDIR\${PPICON}" 0 SW_SHOWMINIMIZED "" "Play ${NAME}"
+            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Play ${NAME}.lnk" "$INSTDIR\python\ppython.exe" "${PPMAIN}" "$INSTDIR\${PPICON}" 0 SW_SHOWMINIMIZED "" "Play ${NAME}"
 
 
         !else
         !else
 
 
@@ -136,7 +137,7 @@ Section "${SMDIRECTORY}" SecCore
             SetOutPath $INSTDIR
             SetOutPath $INSTDIR
             File /r /x CVS "${PANDA}\ReleaseNotes"
             File /r /x CVS "${PANDA}\ReleaseNotes"
             !ifdef PYEXTRAS
             !ifdef PYEXTRAS
-            SetOutPath $INSTDIR\bin\lib
+            SetOutPath $INSTDIR\python\lib
             File /nonfatal /r "${PYEXTRAS}\*"
             File /nonfatal /r "${PYEXTRAS}\*"
             !endif
             !endif
             SetOutPath $INSTDIR\models
             SetOutPath $INSTDIR\models
@@ -148,10 +149,10 @@ Section "${SMDIRECTORY}" SecCore
             WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "http://panda3d.etc.cmu.edu/"
             WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "http://panda3d.etc.cmu.edu/"
             WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "http://panda3d.etc.cmu.edu/wiki/index.php"
             WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "http://panda3d.etc.cmu.edu/wiki/index.php"
             SetOutPath $INSTDIR\samples\GreetingCard
             SetOutPath $INSTDIR\samples\GreetingCard
-            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Greeting Card.lnk" "$INSTDIR\bin\ppython.exe" 'GreetingCard.py "$SMPROGRAMS\${SMDIRECTORY}"' "$INSTDIR\bin\pzip.exe" 0 SW_SHOWMINIMIZED "" "Panda Greeting Card"
+            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Greeting Card.lnk" "$INSTDIR\python\ppython.exe" 'GreetingCard.py "$SMPROGRAMS\${SMDIRECTORY}"' "$INSTDIR\bin\pzip.exe" 0 SW_SHOWMINIMIZED "" "Panda Greeting Card"
             SetOutPath $INSTDIR
             SetOutPath $INSTDIR
-            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\bin\ppython.exe" 0 "" "" "Panda Manual"
-            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\bin\ppython.exe" 0 "" "" "Panda Website"
+            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\python\ppython.exe" 0 "" "" "Panda Manual"
+            CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\Panda Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\python\ppython.exe" 0 "" "" "Panda Website"
 
 
             FindFirst $0 $1 $INSTDIR\samples\*--*
             FindFirst $0 $1 $INSTDIR\samples\*--*
             loop:
             loop:
@@ -179,8 +180,8 @@ Section "${SMDIRECTORY}" SecCore
                     Call StrRep
                     Call StrRep
                     Pop $R0
                     Pop $R0
                     StrCpy $TUTNAME $R0
                     StrCpy $TUTNAME $R0
-                    CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\$READABLE\Run $TUTNAME.lnk" "$INSTDIR\bin\ppython.exe" "$3" "$INSTDIR\bin\pzip.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME"
-                    CreateShortCut "$INSTDIR\samples\$1\Run $TUTNAME.lnk" "$INSTDIR\bin\ppython.exe" "$3" "$INSTDIR\bin\pzip.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME"
+                    CreateShortCut "$SMPROGRAMS\${SMDIRECTORY}\$READABLE\Run $TUTNAME.lnk" "$INSTDIR\python\ppython.exe" "$3" "$INSTDIR\bin\pzip.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME"
+                    CreateShortCut "$INSTDIR\samples\$1\Run $TUTNAME.lnk" "$INSTDIR\python\ppython.exe" "$3" "$INSTDIR\bin\pzip.exe" 0 SW_SHOWMINIMIZED "" "Run $TUTNAME"
                     FindNext $2 $3
                     FindNext $2 $3
                     goto iloop
                     goto iloop
                 idone:
                 idone:
@@ -199,15 +200,31 @@ Section -post
 
 
         !ifndef PPGAME
         !ifndef PPGAME
         # Add the "bin" directory to the PATH.
         # Add the "bin" directory to the PATH.
+        Push "$INSTDIR\python"
+        Call RemoveFromPath
+        Push "$INSTDIR\bin"
+        Call RemoveFromPath
+        Push "$INSTDIR\python"
+        Call AddToPath
         Push "$INSTDIR\bin"
         Push "$INSTDIR\bin"
         Call AddToPath
         Call AddToPath
-        !endif
 
 
-        DetailPrint "Registering Helix Preferences..."
-        WriteRegStr HKLM "Software\Helix\HelixSDK\10.0\Preferences\UseOverlay" "" "0"
-        WriteRegStr HKLM "Software\Helix\HelixSDK\10.0\Preferences\UseWinDraw" "" "0"
-        WriteRegStr HKCU "Software\Helix\HelixSDK\10.0\Preferences\UseOverlay" "" "0"
-        WriteRegStr HKCU "Software\Helix\HelixSDK\10.0\Preferences\UseWinDraw" "" "0"
+        ReadRegStr $0 HKLM "Software\Python\PythonCore\2.4\InstallPath" ""
+        StrCmp $0 "$INSTDIR\python" RegPath 0
+        StrCmp $0 "" RegPath 0
+
+        MessageBox MB_YESNO|MB_ICONQUESTION \
+                "Python add-on installers use a registry key to locate the Python directory.  The registry key is already pointing to a copy of Python.  Do you want to change the registry key to point to Panda's copy?" \
+                IDNO SkipRegPath
+
+        RegPath:
+        DetailPrint "Adding registry keys for python..."
+        WriteRegStr HKLM "Software\Python\PythonCore\2.4\InstallPath" "" "$INSTDIR\python"
+        WriteRegStr HKLM "Software\Python\PythonCore\2.4\Help" "" ""
+        WriteRegStr HKLM "Software\Python\PythonCore\2.4\Help\Main Python Documentation" "" "$INSTDIR\python\Doc\Python24.chm"
+        WriteRegStr HKLM "Software\Python\PythonCore\2.4\Help\Pythonwin Reference" "" "$INSTDIR\python\Lib\site-packages\PyWin32.chm"
+        SkipRegPath:
+        !endif
 
 
         DetailPrint "Adding the uninstaller ..."
         DetailPrint "Adding the uninstaller ..."
         Delete "$INSTDIR\uninst.exe"
         Delete "$INSTDIR\uninst.exe"
@@ -221,8 +238,19 @@ SectionEnd
 Section Uninstall
 Section Uninstall
 
 
         !ifndef PPGAME
         !ifndef PPGAME
+        Push "$INSTDIR\python"
+        Call un.RemoveFromPath
+        Push "$INSTDIR\python"
+        Call un.RemoveFromPath
+        Push "$INSTDIR\bin"
+        Call un.RemoveFromPath
         Push "$INSTDIR\bin"
         Push "$INSTDIR\bin"
         Call un.RemoveFromPath
         Call un.RemoveFromPath
+
+        ReadRegStr $0 HKLM "Software\Python\PythonCore\2.4\InstallPath" ""
+        StrCmp $0 "$INSTDIR\python" 0 SkipUnReg
+        DeleteRegKey HKLM "Software\Python\PythonCore\2.4"
+        SkipUnReg:
         !endif
         !endif
 
 
         Delete "$INSTDIR\uninst.exe"
         Delete "$INSTDIR\uninst.exe"
@@ -264,6 +292,40 @@ Function un.IsNT
                 Push 1
                 Push 1
 FunctionEnd
 FunctionEnd
 
 
+; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
+Function StrStr
+        Push $0
+        Exch
+        Pop $0 ; $0 now have the string to find
+        Push $1
+        Exch 2
+        Pop $1 ; $1 now have the string to find in
+        Exch
+        Push $2
+        Push $3
+        Push $4
+        Push $5
+        StrCpy $2 -1
+        StrLen $3 $0
+        StrLen $4 $1
+        IntOp $4 $4 - $3
+        unStrStr_loop:
+                IntOp $2 $2 + 1
+                IntCmp $2 $4 0 0 unStrStrReturn_notFound
+                StrCpy $5 $1 $3 $2
+                StrCmp $5 $0 unStrStr_done unStrStr_loop
+        unStrStrReturn_notFound:
+                StrCpy $2 -1
+        unStrStr_done:
+                Pop $5
+                Pop $4
+                Pop $3
+                Exch $2
+                Exch 2
+                Pop $0
+                Pop $1
+FunctionEnd
+
 ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
 ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
 Function un.StrStr
 Function un.StrStr
         Push $0
         Push $0
@@ -358,6 +420,94 @@ Function AddToPath
                 Pop $0
                 Pop $0
 FunctionEnd
 FunctionEnd
 
 
+; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
+Function RemoveFromPath
+        Exch $0
+        Push $1
+        Push $2
+        Push $3
+        Push $4
+        Push $5
+        Call IsNT
+        Pop $1
+        StrCmp $1 1 unRemoveFromPath_NT
+                ; Not on NT
+                StrCpy $1 $WINDIR 2
+                FileOpen $1 "$1\autoexec.bat" r
+                GetTempFileName $4
+                FileOpen $2 $4 w
+                GetFullPathName /SHORT $0 $0
+                StrCpy $0 "SET PATH=%PATH%;$0"
+                SetRebootFlag true
+                Goto unRemoveFromPath_dosLoop
+
+                unRemoveFromPath_dosLoop:
+                        FileRead $1 $3
+                        StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
+                        StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
+                        StrCmp $3 "$0" unRemoveFromPath_dosLoop
+                        StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+                        FileWrite $2 $3
+                        Goto unRemoveFromPath_dosLoop
+
+                unRemoveFromPath_dosLoopEnd:
+                        FileClose $2
+                        FileClose $1
+                        StrCpy $1 $WINDIR 2
+                        Delete "$1\autoexec.bat"
+                        CopyFiles /SILENT $4 "$1\autoexec.bat"
+                        Delete $4
+                        Goto unRemoveFromPath_done
+
+                unRemoveFromPath_NT:
+                        StrLen $2 $0
+                        Call IsUserAdmin
+                        Pop $5
+                        StrCmp $5 1 0 NotAdmin
+                                ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+                                Push $1
+                                Push $0
+                                Call StrStr ; Find $0 in $1
+                                Pop $0 ; pos of our dir
+                                IntCmp $0 -1 unRemoveFromPath_done
+                                        ; else, it is in path
+                                        StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
+                                        IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
+                                        IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
+                                        StrLen $0 $1
+                                        StrCpy $1 $1 $0 $2
+                                        StrCpy $3 "$3$1"
+                                        WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
+                                        SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+                                        Goto unRemoveFromPath_done
+                        
+                        
+                        NotAdmin:               
+                                ReadRegStr $1 HKCU "Environment" "PATH"
+                                Push $1
+                                Push $0
+                                Call StrStr ; Find $0 in $1
+                                Pop $0 ; pos of our dir
+                                IntCmp $0 -1 unRemoveFromPath_done
+                                        ; else, it is in path
+                                        StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
+                                        IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
+                                        IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
+                                        StrLen $0 $1
+                                        StrCpy $1 $1 $0 $2
+                                        StrCpy $3 "$3$1"
+                                        WriteRegExpandStr HKCU "Environment" "PATH" $3
+                                        SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+                unRemoveFromPath_done:
+                        Pop $5
+                        Pop $4
+                        Pop $3
+                        Pop $2
+                        Pop $1
+                        Pop $0
+FunctionEnd
+
 ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
 ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
 Function un.RemoveFromPath
 Function un.RemoveFromPath
         Exch $0
         Exch $0

+ 18 - 1
direct/src/extensions_native/extension_native_helpers.py

@@ -1,6 +1,23 @@
 ###  Tools
 ###  Tools
-from libpandaexpress import *
+__all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod"]
+
+import sys,os
 
 
+# Make sure the panda DLL directory is first on the path.
+if (sys.platform == "win32"):
+    target = None
+    for dir in sys.path:
+        lib = os.path.join(dir,"libpandaexpress.dll")
+        if (os.path.exists(lib)):
+            target = dir
+    if (target == None):
+        print "Cannot find libpandaexpress. Exiting."
+        os.exit(1)
+    path=os.environ["PATH"]
+    if (path.startswith(target+";")==0):
+        os.environ["PATH"] = target+";"+path
+
+from libpandaexpress import *
 
 
 def Dtool_ObjectToDict(clas, name, obj):
 def Dtool_ObjectToDict(clas, name, obj):
     clas.DtoolClassDict[name] = obj;
     clas.DtoolClassDict[name] = obj;

+ 1 - 0
direct/src/ffi/DoGenPyCode.py

@@ -257,6 +257,7 @@ def generateNativeWrappers():
         moduleModulesFilename = os.path.join(outputCodeDir, '%sModules.py' % (moduleName))
         moduleModulesFilename = os.path.join(outputCodeDir, '%sModules.py' % (moduleName))
         moduleModules = open(moduleModulesFilename, 'w')
         moduleModules = open(moduleModulesFilename, 'w')
 
 
+        moduleModules.write('from extension_native_helpers import *\n')
         moduleModules.write('from %s import *\n\n' % (moduleName))
         moduleModules.write('from %s import *\n\n' % (moduleName))
 
 
         # Now look for extensions
         # Now look for extensions

+ 4 - 6
doc/makepanda/makepanda.py

@@ -1823,13 +1823,11 @@ for pkg in (PACKAGES + ["extras"]):
                 CopyAllFiles("built/lib/","thirdparty/linux-libs-a/"+pkg.lower()+"/lib/")
                 CopyAllFiles("built/lib/","thirdparty/linux-libs-a/"+pkg.lower()+"/lib/")
 if (sys.platform == "win32"):
 if (sys.platform == "win32"):
     if (OMIT.count("PYTHON")==0):
     if (OMIT.count("PYTHON")==0):
-        CopyFile('built/bin/ppython.exe',  'thirdparty/win-python/python.exe')
-        CopyFile('built/bin/ppythonw.exe', 'thirdparty/win-python/pythonw.exe')
         CopyFile('built/bin/python24.dll', 'thirdparty/win-python/python24.dll')
         CopyFile('built/bin/python24.dll', 'thirdparty/win-python/python24.dll')
-        CopyTree('built/bin/lib',  'thirdparty/win-python/lib')
-        CopyTree('built/bin/dlls', 'thirdparty/win-python/dlls')
-        CopyTree('built/bin/tcl',  'thirdparty/win-python/tcl')
-        ConditionalWriteFile('built/bin/panda.pth',"..\n")
+        CopyTree('built/python', 'thirdparty/win-python')
+        CopyFile('built/python/ppython.exe', 'thirdparty/win-python/python.exe')
+        CopyFile('built/python/ppythonw.exe', 'thirdparty/win-python/pythonw.exe')
+        ConditionalWriteFile('built/python/panda.pth',"..\n../bin\n")
 
 
 ########################################################################
 ########################################################################
 ##
 ##