2.3.1 Build on POSIX with setup.py

  1. Unpack PyQwt-4.0rc0.tar.gz and read README to check for minor bug fixes and upgrades.
  2. cd PyQwt-4.0
    
  3. Edit the file setup_cfg_posix as explained in its comments.
    # 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 (for sip-3.x) files.  It requires also the PyQt-*/sip/*/*.sip files used
    # to build PyQt.  To find out where the */*.sip files have been installed, type
    # the following line into the Python interpreter:
    #
    # >>> import pyqtconfig; print pyqtconfig.Configuration().pyqt_sip_dir
    #
    # If you get an ImportError you must rebuild sip and PyQt with the configure.py
    # script instead of the build.py script.
    #
    # If there are */*.sip files in pyqt_sip_dir, your PyQt installation is suited
    # to build PyQwt (assuming there is no version mismatch between the PyQt
    # extension module and the */*.sip files).
    # 
    # If you have no */*.sip files on your system, you have to install a a PyQt
    # development package or get the source code. Get EXACTLY the same version!
    #
    # To find out which version of PyQt is installed, type the the following line
    # into the Python interpreter:
    #
    # >>> import qt; print qt.PYQT_VERSION_STR
    #
    # If you have an RPM based system, you can get the matching PyQt-*.src.rpm and
    # run the command:
    #
    #       rpm2cpio PyQt-*.src.rpm | cpio --extract
    #
    # to extract all files from the RPM package, including the sources for PyQt.
    #
    # To use the PyQt*-3.10 sources next to PyQwt-4.0, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.10/sip
    # To use the PyQt*-3.11 sources next to PyQwt-4.0, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.11/sip
    # To use the PyQt*-3.12 sources next to PyQwt-4.0, uncomment:
    #sip_file_dirs=../PyQt-x11-gpl-3.12/sip
    #
    #
    # Some %ConvertToSubClassCode handwritten code uses 'dynamic_cast<>()' which is
    # not supported by all compilers and/or compiler options.
    # If this is not the case, exclude the feature 'CXX_DYNAMIC_CAST'
    # 
    # The option 'sip_x_features' indicates the 'run_sip' command whether to
    # disable a list of features (separated by ',').
    #sip_x_features=CXX_DYNAMIC_CAST
    sip_x_features=
    #
    # 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-4.0
    install_data=/usr/share/doc/PyQwt-4.0
    # 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 TMAKEPATH 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 are desperate, run:
make force
and mail the file LOG.force to the mailing list.

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.9/sip build
tries to build the extension, overruling any initialization of sip_file_dirs in the configuration file.