summaryrefslogtreecommitdiffstats
path: root/sphinx/distutils.rst
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2011-11-22 02:59:34 -0600
committerTimothy Pearson <[email protected]>2011-11-22 02:59:34 -0600
commit6c4cc3653e8dd7668295f3e659b7eb4dc571b67c (patch)
treea559fd71fc982e35a4f984d85a5c9d92b764ae8c /sphinx/distutils.rst
downloadsip4-tqt-6c4cc3653e8dd7668295f3e659b7eb4dc571b67c.tar.gz
sip4-tqt-6c4cc3653e8dd7668295f3e659b7eb4dc571b67c.zip
Initial import of SIP4 for Qt3
Diffstat (limited to 'sphinx/distutils.rst')
-rw-r--r--sphinx/distutils.rst41
1 files changed, 41 insertions, 0 deletions
diff --git a/sphinx/distutils.rst b/sphinx/distutils.rst
new file mode 100644
index 0000000..21a6b36
--- /dev/null
+++ b/sphinx/distutils.rst
@@ -0,0 +1,41 @@
+.. _ref-distutils:
+
+Building Your Extension with distutils
+======================================
+
+To build the example in :ref:`ref-simple-c++-example` using distutils, it is
+sufficient to create a standard ``setup.py``, listing ``word.sip`` among the
+files to build, and hook-up SIP into distutils::
+
+ from distutils.core import setup, Extension
+ import sipdistutils
+
+ setup(
+ name = 'word',
+ versione = '1.0',
+ ext_modules=[
+ Extension("word", ["word.sip", "word.cpp"]),
+ ],
+
+ cmdclass = {'build_ext': sipdistutils.build_ext}
+ )
+
+As we can see, the above is a normal distutils setup script, with just a
+special line which is needed so that SIP can see and process ``word.sip``.
+Then, running ``setup.py build`` will build our extension module.
+
+If you want to use any of sip's command-line options described in
+:ref:`ref-command-line`, there is a new option available for the
+``build_ext`` command in distutils: ``--sip-opts``. So you can either invoke
+distutils as follows::
+
+ $ python setup.py build_ext --sip-opts="-e -g" build
+
+or you can leverage distutils' config file support by creating a ``setup.cfg``
+file in the supported system or local paths (eg: in the same directory of
+``setup.py``) with these contents::
+
+ [build_ext]
+ sip-opts = -e -g
+
+and then run ``setup.py build`` as usual.