2.2.2 Build on POSIX

Warning: This documentation is for the future PyQwt-3.8. Check the download page for the latest releases.

  1. Unpack PyQwt-3.8.tar.gz and read README to check minor bug fixes and upgrades.
  2. cd PyQwt-3.8
    
  3. Edit the file setup_cfg_posix as explained in its comments. Initialize sip_file_dirs correctly!.
    # Start of 'setup_cfg_posix'.
    # A line starting with '#' is a comment
    #
    [run_sip]
    # The 'run_sip' command transforms the sip/*.sip files into
    # *.cpp, *.h and *.py files.
    # It requires also the PyQt-*/sip/*.sip files that have been
    # used to build PyQt.
    # The option 'sip_file_dirs' indicates the command 'run_sip'
    # where to find the PyQt-*/sip/*.sip files.
    #
    # If you cannot find those files on your system, you have to
    # get the source code that has been used to build PyQt.
    # Get EXACTLY the same version!
    #
    # To determine which version of PyQt is installed, run
    # python -c 'import qt; print qt.PYQT_VERSION'
    # or
    # python -c 'import qt; print qt.PYQT_VERSION_STR'
    #
    # Handy TIP for an RPM based system:
    # Get the matching PyQt-*.src.rpm (Mandrake, Red Hat) or
    # PyQt-*.spm (SuSE) and run the command:
    #
    #       rpm2cpio PyQt-*.src.rpm | cpio --extract
    #
    # to extract all files from the RPM package, including the
    # sources for PyQt.
    #
    # I install PyQt's sip files in /usr/share/sip/qt. 
    sip_file_dirs=/usr/share/sip/qt
    # To use the PyQt*-3.8.1 sources next to PyQwt-3.8, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.8.1/sip
    # To use the PyQt*-3.7 sources next to PyQwt-3.8, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.7/sip
    # To use the PyQt*-3.6 sources next to PyQwt-3.8, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.6/sip
    # To use the PyQt*-3.5 sources next to PyQwt-3.8, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.5/sip
    # To use the PyQt*-3.4 sources next to PyQwt-3.8, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.4/sip
    #
    # To speed up compilation, concatenate the *.cpp files made by sip.
    # The option 'concatenate' indicates the 'run_sip' command whether
    # to concatenate or not.
    concatenate=0
    #concatenate=1
    #
    # For development, using the ccache program (http://ccache.samba.org)
    # is better than concatenating. See the 'build_ext' command.
    #
    #
    [build_ext]
    # The option 'ccache' indicates the command 'build_ext' to use
    # the compiler cache program, if found.
    # Purist may want to set 'ccache=0', if the Gnu C/C++-compilers
    # are symbolic links to ccache (man ccache), but invokations like
    # 'ccache ccache g++' are working fine.
    #ccache=0
    ccache=1
    #
    #
    [bdist_rpm]
    # The 'use_rpm_opt_flags' option indicates the 'bdist_rpm' command
    # whether to use RPM_OPT_FLAGS or not. It is safer to use the compiler
    # flags which have been used to build Qt.
    use_rpm_opt_flags=0
    #
    #
    [install]
    # The option 'install-data' indicates the command 'install'
    # where to install the documentation and examples.
    # I want it in /usr/share/doc/PyQwt-3.8
    install_data=/usr/share/doc/PyQwt-3.8
    # If you prefer another directory, uncomment and edit: 
    #install_data=/2000/light/years/from/home
    #
    # Local Variables: ***
    # mode: sh ***
    # End: ***
    
  4. The environment variable QTDIR must be set to the Qt directory containing the sub-directories bin, lib and include. You may even try to install PyQwt on Qt installations with a non-standard directory layout, if you set either QTBINDIR and/or QTINCDIR and/or QTLIBDIR.
  5. If you use Qt-2.3.x, the environment variable TMAKESPEC must be set to the directory containing the file tmake.conf for your compiler. If you use Qt-3.x, you may have to set the environment variable QMAKESPEC.
  6. Run
    python setup.py build
    
    to build the PyQwt extension.
  7. Play with the *.py files in the examples directory. If everything works, you are ready to install.
  8. After the removal of all files of previous installations of PyQwt in your Python library tree, you have the choice between installing:
    python setup.py install
    
    or anticipating future removal of your new PyQwt installation:

Note: The PyQtDistutils scripts will guide you in setting the environment variable QTDIR (and TMAKEPATH or QMAKESPEC, if required).

Note: If you get a message:
sip: Unable to find file "qtmod.sip"
error: command '/usr/bin/sip' failed with exit status 1
the initialization of sip_file_dirs is wrong.

Note: If you are desperate, run:
make force
and mail the file LOG.force to me.

Note: Look at the Makefile for examples how to use
python setup.py command --options
For example, the command:
python setup.py run_sip --sip-file-dirs=../PyQt-x11-gpl-3.8/sip build
tries to build the extension, overruling any initialization of sip_file_dirs in the configuration file.