Skip to content

Commit 62ae624

Browse files
committed
makepanda: installer uses registry to add Panda3D to Python path
1 parent b37cfd6 commit 62ae624

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

makepanda/installer.nsi

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,26 +385,36 @@ SectionGroup "Python support"
385385
SetRegView ${REGVIEW}
386386
!endif
387387

388-
; Check for a system-wide Python installation.
389-
; We could check for a user installation of Python as well, but there
390-
; is no distinction between 64-bit and 32-bit regviews in HKCU, so we
391-
; can't guess whether it might be a compatible version.
388+
; Check for a non-Panda3D system-wide Python installation.
392389
ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
390+
StrCmp $0 "$INSTDIR\python" UserExternalPthCheck 0
391+
StrCmp $0 "" UserExternalPthCheck 0
392+
IfFileExists "$0\ppython.exe" UserExternalPthCheck 0
393+
IfFileExists "$0\python.exe" AskExternalPth UserExternalPthCheck
394+
395+
; Check for a non-Panda3D user installation of Python.
396+
UserExternalPthCheck:
397+
ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\InstallPath" ""
393398
StrCmp $0 "$INSTDIR\python" SkipExternalPth 0
394399
StrCmp $0 "" SkipExternalPth 0
395400
IfFileExists "$0\ppython.exe" SkipExternalPth 0
396-
IfFileExists "$0\python.exe" 0 SkipExternalPth
401+
IfFileExists "$0\python.exe" AskExternalPth SkipExternalPth
397402

398403
; We're pretty sure this Python build is of the right architecture.
404+
AskExternalPth:
399405
MessageBox MB_YESNO|MB_ICONQUESTION \
400406
"Your system already has a copy of Python ${PYVER} installed in:$\r$\n$0$\r$\nWould you like to configure it to be able to use the Panda3D libraries?$\r$\nIf you choose no, you will only be able to use Panda3D's own copy of Python." \
401407
IDYES WriteExternalPth IDNO SkipExternalPth
402408

403409
WriteExternalPth:
404-
FileOpen $1 "$0\Lib\site-packages\panda.pth" w
405-
FileWrite $1 "$INSTDIR$\r$\n"
406-
FileWrite $1 "$INSTDIR\bin$\r$\n"
407-
FileClose $1
410+
;FileOpen $1 "$0\Lib\site-packages\panda.pth" w
411+
;FileWrite $1 "$INSTDIR$\r$\n"
412+
;FileWrite $1 "$INSTDIR\bin$\r$\n"
413+
;FileClose $1
414+
415+
; Actually, it looks like we can just do this instead:
416+
WriteRegStr HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" "" "$INSTDIR"
417+
408418
SkipExternalPth:
409419
SectionEnd
410420

@@ -736,6 +746,10 @@ Section Uninstall
736746
StrCmp $0 "$INSTDIR\python" 0 +2
737747
DeleteRegKey HKCU "Software\Python\PythonCore\${PYVER}"
738748

749+
ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" ""
750+
StrCmp $0 "$INSTDIR" 0 +2
751+
DeleteRegKey HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D"
752+
739753
SetDetailsPrint both
740754
DetailPrint "Deleting files..."
741755
SetDetailsPrint listonly

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy