makepackage: install pip as part of installer, using ensurepip

Fixes #690
This commit is contained in:
rdb 2019-08-13 17:45:06 +02:00
parent b141483b22
commit 6b3e6f9097

View File

@ -84,6 +84,7 @@ LangString DESC_SecTools ${LANG_ENGLISH} "Useful tools and model converters to h
LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D." LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D."
LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings." LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings."
LangString DESC_SecPython ${LANG_ENGLISH} "Contains a ${REGVIEW}-bit copy of Python ${INCLUDE_PYVER} preconfigured to make use of Panda3D." LangString DESC_SecPython ${LANG_ENGLISH} "Contains a ${REGVIEW}-bit copy of Python ${INCLUDE_PYVER} preconfigured to make use of Panda3D."
LangString DESC_SecEnsurePip ${LANG_ENGLISH} "Installs the pip package manager into the included Python installation."
LangString DESC_SecHeadersLibs ${LANG_ENGLISH} "Headers and libraries needed for C++ development with Panda3D." LangString DESC_SecHeadersLibs ${LANG_ENGLISH} "Headers and libraries needed for C++ development with Panda3D."
LangString DESC_SecSamples ${LANG_ENGLISH} "The sample programs demonstrate how to make Python applications with Panda3D." LangString DESC_SecSamples ${LANG_ENGLISH} "The sample programs demonstrate how to make Python applications with Panda3D."
LangString DESC_SecMaxPlugins ${LANG_ENGLISH} "Plug-ins for Autodesk 3ds Max (${REGVIEW}-bit) that can be used to export models to Panda3D." LangString DESC_SecMaxPlugins ${LANG_ENGLISH} "Plug-ins for Autodesk 3ds Max (${REGVIEW}-bit) that can be used to export models to Panda3D."
@ -477,6 +478,19 @@ Section "Python ${INCLUDE_PYVER}" SecPython
SkipRegPath: SkipRegPath:
SectionEnd SectionEnd
Section "Install pip" SecEnsurePip
SectionIn 1 2 3
SetDetailsPrint both
DetailPrint "Installing the pip package manager..."
SetDetailsPrint listonly
SetOutPath $INSTDIR
nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m ensurepip --default-pip'
Pop $0
DetailPrint "Command returned exit status $0"
SectionEnd
!endif !endif
!macro MaybeEnablePyBindingSection PYVER !macro MaybeEnablePyBindingSection PYVER
@ -537,6 +551,18 @@ Function .onSelChange
IntOp $R0 $R0 | ${SF_SELECTED} IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SecPyShared} $R0 SectionSetFlags ${SecPyShared} $R0
${EndIf} ${EndIf}
!ifdef INCLUDE_PYVER
${If} ${SectionIsSelected} ${SecPython}
!insertmacro SectionFlagIsSet ${SecEnsurePip} ${SF_RO} 0 SkipSelectEnsurePip
!insertmacro SelectSection ${SecEnsurePip}
SkipSelectEnsurePip:
!insertmacro ClearSectionFlag ${SecEnsurePip} ${SF_RO}
${Else}
!insertmacro UnselectSection ${SecEnsurePip}
!insertmacro SetSectionFlag ${SecEnsurePip} ${SF_RO}
${EndIf}
!endif
FunctionEnd FunctionEnd
!ifdef INCLUDE_PYVER !ifdef INCLUDE_PYVER
@ -917,6 +943,7 @@ SectionEnd
!endif !endif
!ifdef INCLUDE_PYVER !ifdef INCLUDE_PYVER
!insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython) !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython)
!insertmacro MUI_DESCRIPTION_TEXT ${SecEnsurePip} $(DESC_SecEnsurePip)
!endif !endif
!insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs) !insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs)
!ifdef HAVE_SAMPLES !ifdef HAVE_SAMPLES