[Fwd: [PyQt] mem error in windows]

Phil Thompson phil at riverbankcomputing.com
Wed May 7 14:21:20 BST 2008


On Tuesday 06 May 2008, Linos wrote:
> Phil do you have for download the source of the windows installer? this way
> i could compile to have an installer without that problem.
>
> Regards,
> Miguel Angel.

Attached is the installer source.

Phil
-------------- next part --------------
# PyQt4 NSIS installer script.
#
# @BS_LICENSE@


# These will change with different releases.
!define PYQT_VERSION        "@RM_LATEST@"
!define PYQT_INSTALLER      "1"
!define PYQT_LICENSE        "GPL"
!define PYQT_LICENSE_LC     "gpl"
!define PYQT_PYTHON_MINOR   "5"
!define PYQT_QT_VERSION     "4.4.0"
!define PYQT_QT_DOC_VERSION "4.4"

# These are all derived from the above.
!define PYQT_NAME           "PyQt ${PYQT_LICENSE} v${PYQT_VERSION}"
!define PYQT_FULL_NAME      "${PYQT_NAME}-${PYQT_INSTALLER}"
!define PYQT_FULL_VERSION   "${PYQT_VERSION}-${PYQT_INSTALLER}"
!define PYQT_INSTALLDIR     "C:\Python2${PYQT_PYTHON_MINOR}\"
!define PYQT_PYTHON_VERS    "2.${PYQT_PYTHON_MINOR}"
!define PYQT_PYTHON_HKLM    "Software\Python\PythonCore\${PYQT_PYTHON_VERS}\InstallPath"
!define PYQT_QT_DIR         "C:\Qt\${PYQT_QT_VERSION}-${PYQT_LICENSE_LC}-static"


# Tweak some of the standard pages.
!define MUI_WELCOMEPAGE_TEXT \
"This wizard will guide you through the installation of ${PYQT_FULL_NAME}.\r\n\
\r\n\
This copy of PyQt has been built against Python v${PYQT_PYTHON_VERS}.x and \
includes Qt v${PYQT_QT_VERSION}.\r\n\
\r\n\
Any code you write must be released under a license that is compatible with \
the GPL.\r\n\
\r\n\
Click Next to continue."

!define MUI_FINISHPAGE_LINK "Get the latest news of PyQt here"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.riverbankcomputing.com"


# Include the tools we use.
!include MUI.nsh
!include LogicLib.nsh


# Define the product name and installer executable.
Name "PyQt"
Caption "${PYQT_FULL_NAME} Setup"
OutFile "PyQt-Py2.${PYQT_PYTHON_MINOR}-${PYQT_LICENSE_LC}-${PYQT_FULL_VERSION}.exe"


# Set the install directory, from the registry if possible.
InstallDir "${PYQT_INSTALLDIR}"
InstallDirRegKey HKLM "${PYQT_PYTHON_HKLM}" ""


# The different installation types.  "Full" is everything.  "Minimal" is the
# runtime environment.
InstType "Full"
InstType "Minimal"


# Maximum compression.
SetCompressor /SOLID lzma


# We want the user to confirm they want to cancel.
!define MUI_ABORTWARNING


Function .onInit
    # Check the right version of Python has been installed.
    ReadRegStr $0 HKLM "${PYQT_PYTHON_HKLM}" ""

    ${If} $0 == ""
        MessageBox MB_YESNO|MB_ICONQUESTION \
"This copy of PyQt has been built against Python v${PYQT_PYTHON_VERS}.x which \
doesn't seem to be installed.$\r$\n\
$\r$\n\
Do you with to continue with the installation?" IDYES GotPython
            Abort
GotPython:
    ${Endif}
FunctionEnd


# Define the different pages.
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
  
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

  
# Other settings.
!insertmacro MUI_LANGUAGE "English"


# Installer sections.

Section "Extension modules" SecModules
    SectionIn 1 2 RO

    # Install the MSVC C++ runtime if it isn't already installed.
    SetOverwrite off
    SetOutPath $SYSDIR
    File C:\WINDOWS\system32\msvcp71.dll

    # Make sure this is clean and tidy.
    RMDir /r $PROGRAMFILES\PyQt4
    CreateDirectory $PROGRAMFILES\PyQt4

    SetOverwrite on

    # We have to take the SIP files from where they should have been installed.
    SetOutPath $INSTDIR\Lib\site-packages
    File "${PYQT_INSTALLDIR}Lib\site-packages\sip.pyd"

    SetOutPath $INSTDIR\Lib\site-packages\PyQt4
    File .\LICENSE
    File .\GPL_EXCEPTION.TXT
    File .\GPL_EXCEPTION_ADDENDUM.TXT
    File .\OPENSOURCE-NOTICE.TXT
    File .\__init__.py
    File .\_qt\_qt.pyd
    File .\phonon\phonon.pyd
    File .\Qt\Qt.pyd
    File .\QtAssistant\QtAssistant.pyd
    File .\QtCore\QtCore.pyd
    File .\QtGui\QtGui.pyd
    File .\QtHelp\QtHelp.pyd
    File .\QtNetwork\QtNetwork.pyd
    File .\QtOpenGL\QtOpenGL.pyd
    File .\QtScript\QtScript.pyd
    File .\QtSql\QtSql.pyd
    File .\QtSvg\QtSvg.pyd
    File .\QtTest\QtTest.pyd
    File .\QtWebKit\QtWebKit.pyd
    File .\QtXml\QtXml.pyd
    File .\QtXmlPatterns\QtXmlPatterns.pyd
    File .\Qsci\Qsci.pyd
    File /r .\pyuic\uic

    File /r .\PyQt4\Qwt5
    SetOutPath $INSTDIR\Lib\site-packages\PyQt4\Qwt5
    File .\Qwt5\Qwt.pyd

    # Other runtime files.
    SetOutPath $INSTDIR\PyQt4
    File /r .\PyQt4\translations
    File /r .\PyQt4\qsci

    # Write the Qt path file.
    FileOpen $0 $INSTDIR\qt.conf w
    FileWrite $0 "[Paths]$\r$\nPrefix = PyQt4$\r$\n"
    FileClose $0
SectionEnd

Section "Developer tools" SecTools
    SectionIn 1

    SetOverwrite on

    SetOutPath $INSTDIR
    File .\pylupdate\pylupdate4.exe
    File .\pyrcc\pyrcc4.exe
    File .\pyuic\pyuic4.bat

    File "${PYQT_QT_DIR}\bin\assistant.exe"
    File "${PYQT_QT_DIR}\bin\designer.exe"
    File "${PYQT_QT_DIR}\bin\linguist.exe"
    File "${PYQT_QT_DIR}\bin\lrelease.exe"
SectionEnd

Section "eric IDE" SecEric
    SectionIn 1

    SetOverwrite on

    SetOutPath $INSTDIR\Lib\site-packages
    File /r "${PYQT_INSTALLDIR}Lib\site-packages\eric4"
    File "${PYQT_INSTALLDIR}Lib\site-packages\eric4config.py"

    SetOutPath $INSTDIR
    File "${PYQT_INSTALLDIR}eric4.bat"
    File "${PYQT_INSTALLDIR}eric4-api.bat"
    File "${PYQT_INSTALLDIR}eric4-compare.bat"
    File "${PYQT_INSTALLDIR}eric4-configure.bat"
    File "${PYQT_INSTALLDIR}eric4-diff.bat"
    File "${PYQT_INSTALLDIR}eric4-doc.bat"
    File "${PYQT_INSTALLDIR}eric4-helpviewer.bat"
    File "${PYQT_INSTALLDIR}eric4-qregexp.bat"
    File "${PYQT_INSTALLDIR}eric4-re.bat"
    File "${PYQT_INSTALLDIR}eric4-tray.bat"
    File "${PYQT_INSTALLDIR}eric4-trpreviewer.bat"
    File "${PYQT_INSTALLDIR}eric4-uipreviewer.bat"
    File "${PYQT_INSTALLDIR}eric4-unittest.bat"
SectionEnd

Section "Documentation" SecDocumentation
    SectionIn 1

    SetOverwrite on

    SetOutPath $PROGRAMFILES\PyQt4
    File /r .\doc
SectionEnd

Section "Examples and tutorial" SecExamples
    SectionIn 1

    SetOverwrite on

    SetOutPath $PROGRAMFILES\PyQt4
    File /r .\examples
    File /r .\PyQt4\pyqwtexamples
SectionEnd

Section "Start Menu shortcuts" SecShortcuts
    SectionIn 1

    # Make sure this is clean and tidy.
    RMDir /r "$SMPROGRAMS\${PYQT_NAME}"
    CreateDirectory "$SMPROGRAMS\${PYQT_NAME}"

    IfFileExists "$INSTDIR\assistant.exe" 0 +4
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Qt Assistant.lnk" "$INSTDIR\assistant.exe"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Qt Designer.lnk" "$INSTDIR\designer.exe"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Qt Linguist.lnk" "$INSTDIR\Linguist.exe"

    IfFileExists "$INSTDIR\Lib\site-packages\eric4\eric4.pyw" 0 +1
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\eric IDE.lnk" "$INSTDIR\Lib\site-packages\eric4\eric4.pyw"

    IfFileExists "$PROGRAMFILES\PyQt4\doc" 0 +7
        CreateDirectory "$SMPROGRAMS\${PYQT_NAME}\Documentation"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Documentation\PyQt Documentation.lnk" "$PROGRAMFILES\PyQt4\doc\pyqt4ref.html"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Documentation\PyQt API Reference.lnk" "$PROGRAMFILES\PyQt4\doc\html\classes.html"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Documentation\Qt Documentation.lnk" "http://doc.trolltech.com/${PYQT_QT_DOC_VERSION}/"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Documentation\PyQwt Documentation.lnk" "http://pyqwt.sourceforge.net/doc5/pyqwt.html"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Documentation\Qwt Documentation.lnk" "http://qwt.sourceforge.net/"

    IfFileExists "$PROGRAMFILES\PyQt4\examples" 0 +7
        CreateDirectory "$SMPROGRAMS\${PYQT_NAME}\Examples"
	SetOutPath $PROGRAMFILES\PyQt4\examples\tools\qtdemo
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Examples\PyQt Examples and Demos.lnk" "$PROGRAMFILES\PyQt4\examples\tools\qtdemo\qtdemo.pyw"
	SetOutPath $INSTDIR
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Examples\PyQt Examples Source.lnk" "$PROGRAMFILES\PyQt4\examples"
        CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Examples\PyQwt Examples Source.lnk" "$PROGRAMFILES\PyQt4\pyqwtexamples"

    CreateDirectory "$SMPROGRAMS\${PYQT_NAME}\Links"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\PyQt Book.lnk" "http://www.qtrac.eu/pyqtbook.html"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\PyQt Homepage.lnk" "http://www.riverbankcomputing.com/software/pyqt/"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\Qt Homepage.lnk" "http://www.trolltech.com/"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\QScintilla Homepage.lnk" "http://www.riverbankcomputing.com/software/qscintilla/"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\PyQwt Homepage.lnk" "http://pyqwt.sourceforge.net/"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\Qwt Homepage.lnk" "http://qwt.sourceforge.net/"
    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Links\eric Homepage.lnk" "http://www.die-offenbachs.de/eric/index.html"

    CreateShortCut "$SMPROGRAMS\${PYQT_NAME}\Uninstall PyQt.lnk" "$PROGRAMFILES\PyQt4\Uninstall.exe"
SectionEnd

Section -post
    # Tell Windows about the package.
    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PyQt4" "UninstallString" '"$PROGRAMFILES\PyQt4\Uninstall.exe"'
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PyQt4" "DisplayName" "${PYQT_NAME}"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PyQt4" "DisplayVersion" "${PYQT_FULL_VERSION}"
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PyQt4" "NoModify" "1"
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PyQt4" "NoRepair" "1"

    # Save the installation directory for the uninstaller.
    WriteRegStr HKLM "Software\PyQt4" "" $INSTDIR

    # Create the uninstaller.
    WriteUninstaller "$PROGRAMFILES\PyQt4\Uninstall.exe"
SectionEnd


# Section description text.
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecModules} \
"The PyQt, PyQwt and QScintilla extension modules."
!insertmacro MUI_DESCRIPTION_TEXT ${SecTools} \
"The PyQt and Qt developer tools: QtAssistant, Qt Designer, Qt Linguist, \
pyuic4, pyrcc4 and pylupdate4."
!insertmacro MUI_DESCRIPTION_TEXT ${SecEric} \
"The eric IDE."
!insertmacro MUI_DESCRIPTION_TEXT ${SecDocumentation} \
"The PyQt and related documentation."
!insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} \
"Ports to Python of the standard Qt v4 examples and tutorial."
!insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} \
"This adds shortcuts to your Start Menu."
!insertmacro MUI_FUNCTION_DESCRIPTION_END


Section "Uninstall"
    # Get the install directory.
    ReadRegStr $INSTDIR HKLM "Software\PyQt4" ""

    # The modules section.
    Delete $INSTDIR\Lib\site-packages\sip.pyd
    RMDir /r $INSTDIR\Lib\site-packages\PyQt4
    RMDir /r $INSTDIR\PyQt4
    Delete $INSTDIR\qt.conf

    # The shortcuts section.
    RMDir /r "$SMPROGRAMS\${PYQT_NAME}"

    # The tools section.
    Delete $INSTDIR\pylupdate4.exe
    Delete $INSTDIR\pyrcc4.exe
    Delete $INSTDIR\pyuic4.bat

    Delete $INSTDIR\assistant.exe
    Delete $INSTDIR\designer.exe
    Delete $INSTDIR\linguist.exe
    Delete $INSTDIR\lrelease.exe

    # The eric section.
    Delete $INSTDIR\Lib\site-packages\eric4
    Delete $INSTDIR\Lib\site-packages\eric4config.py

    Delete $INSTDIR\eric4.bat
    Delete $INSTDIR\eric4-api.bat
    Delete $INSTDIR\eric4-compare.bat
    Delete $INSTDIR\eric4-configure.bat
    Delete $INSTDIR\eric4-diff.bat
    Delete $INSTDIR\eric4-doc.bat
    Delete $INSTDIR\eric4-helpviewer.bat
    Delete $INSTDIR\eric4-qregexp.bat
    Delete $INSTDIR\eric4-re.bat
    Delete $INSTDIR\eric4-tray.bat
    Delete $INSTDIR\eric4-trpreviewer.bat
    Delete $INSTDIR\eric4-uipreviewer.bat
    Delete $INSTDIR\eric4-unittest.bat

    # The examples section and the installer itself.
    RMDir /r "$PROGRAMFILES\PyQt4"

    # Clean the registry.
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PyQt4"
    DeleteRegKey HKLM "Software\PyQt4"
SectionEnd


More information about the PyQt mailing list