Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
>>> Any chance of some documentation?
>>>> Within sipref.txt? Sure, I can write something if you agree on getting
>> this
>> included.
>> Thanks,
OK, this is the documentation patch and the updated sipdistutils.py which
uses sipconfig to find out the name of the SIP executable. You'll still need
to make sure sipdistutils.py is installed when SIP is installed. Please, let
me know when it gets in.
Thanks!
--
Giovanni Bajo
-------------- next part --------------
# Subclasses disutils.command.build_ext,
# replacing it with a SIP version that compiles .sip -> .cpp
# before calling the original build_ext command.
# Written by Giovanni Bajo <rasky at develer dot com>
# Based on Pyrex.Distutils, written by Graham Fawcett and Darrel Gallion.
import distutils.command.build_ext
from distutils.dep_util import newer
import os
import sys
def replace_suffix(path, new_suffix):
return os.path.splitext(path)[0] + new_suffix
class build_ext (distutils.command.build_ext.build_ext):
description = "Compiler SIP descriptions, then build C/C++ extensions (compile/link to build directory)"
def _get_sip_output_list(self, sbf):
"""
Parse the sbf file specified to extract the name of the generated source
files. Make them absolute assuming they reside in the temp directory.
"""
for L in file(sbf):
key, value = L.split("=", 1)
if key.strip() == "sources":
out = []
for o in value.split():
out.append(os.path.join(self.build_temp, o))
return out
raise RuntimeError, "cannot parse SIP-generated '%s'" % sbf
def _find_sip(self):
import sipconfig
cfg = sipconfig.Configuration()
return cfg.sip_bin
def swig_sources (self, sources, extension=None):
if not self.extensions:
return
# Create the temporary directory if it does not exist already
if not os.path.isdir(self.build_temp):
os.makedirs(self.build_temp)
# Collect the names of the source (.sip) files
sip_sources = []
sip_sources = [source for source in sources if source.endswith('.sip')]
other_sources = [source for source in sources if not source.endswith('.sip')]
generated_sources = []
sip_bin = self._find_sip()
for sip in sip_sources:
# Use the sbf file as dependency check
sipbasename = os.path.basename(sip)
sbf = os.path.join(self.build_temp, replace_suffix(sipbasename, "sbf"))
if newer(sip, sbf) or self.force:
self._sip_compile(sip_bin, sip, sbf)
out = self._get_sip_output_list(sbf)
generated_sources.extend(out)
return generated_sources + other_sources
def _sip_compile(self, sip_bin, source, sbf):
self.spawn([sip_bin,
"-c", self.build_temp,
"-b", sbf,
source])
-------------- next part --------------
--- sipref-original.txt 2005-10-24 04:30:11.000000000 +0200
+++ sipref.txt 2005-10-27 16:21:04.490875000 +0200
@@ -99,7 +99,7 @@
- a sophisticated versioning system that allows the full lifetime of a C++
class library, including any platform specific or optional features, to
- be described in a single set of specification files
+ be described in a single set of specification files
- the ability to include documentation in the specification files which can
be extracted and subsequently processed by external tools
@@ -108,9 +108,7 @@
specification files that is automatically included in all generated
source code
- - a build system, written in Python, that you can extend to configure,
- compile and install your own bindings without worrying about platform
- specific issues
+ - support for building your extensions through distutils
- SIP, and the bindings it produces, runs under UNIX, Linux, Windows and
MacOS/X
@@ -153,7 +151,19 @@
provides them with some common utility functions. See also `Using the
SIP Module in Applications`_.
- - The SIP build system (``sipconfig.py``). This is a pure Python module
+ - The SIP distutils extension (``sipdistutils.py``). This is a distutils
+ extensions that can be used to build your extensions through distutils.
+ This is as simple as adding your .sip files to the list of files needed
+ to build the extension.
+
+.. sidebar:: Deprecation
+
+ **WARNING**: The SIP build system is deprecated and will be probably
+ removed from a future version of SIP. Use the SIP distutils extension
+ instead.
+..
+
+ - The SIP build system (``sipconfig.py``). This is a pure Python module
that is created when SIP is configured and encapsulates all the necessary
information about your system including relevant directory names,
compiler and linker flags, and version numbers. It also includes several
@@ -162,6 +172,8 @@
System`_.
+
+
Qt Support
----------
@@ -344,7 +356,7 @@
%End
public:
- Word(const char *w);
+ Word(const char *);
char *reverse() const;
};
@@ -374,7 +386,43 @@
However, that still leaves us with the task of compiling the generated code and
linking it against all the necessary libraries. It's much easier to use the
-SIP build system to do the whole thing.
+distutils extension to do the whole thing.
+
+
+Building your extension with distutils
+--------------------------------------
+
+To build the example above with distutils, it is sufficiente to create a
+standard ``setup.py``, listing ``word.sip`` among the files to build, and
+hook-up SIP into distutils::
+
+ #!/usr/bin/env python
+ 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} # Hook up SIP!
+ )
+
+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.
+
+
+Building your extension with the SIP Build System
+-------------------------------------------------
+
+.. sidebar:: Deprecation
+
+ **WARNING**: The SIP build system is deprecated and will be probably
+ removed from a future version of SIP. Use the SIP distutils extension
+ instead.
Using the SIP build system is simply a matter of writing a small Python script.
In this simple example we will assume that the ``word`` library we are wrapping
@@ -398,7 +446,7 @@
# Run SIP to generate the code.
os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "word.sip"]))
-
+
# Create the Makefile.
makefile = sipconfig.SIPModuleMakefile(config, build_file)
@@ -478,7 +526,7 @@
This tells SIP that a newly created structure is being returned and it is
owned by Python.
-The ``configure.py`` build system script described in the previous example can
+The ``setup.py`` distutils script described in the previous example can
be used for this example without change.
@@ -781,9 +829,9 @@
file is not generated.
-b file
The name of the build file to generate. This file contains the
- information about the module needed by the SIP build system to generate
- a platform and compiler specific Makefile for the module. By default
- the file is not generated.
+ information about the module needed by the SIP distutils extension
+ (or the SIP build system) to generate a platform and compiler specific
+ Makefile for the module. By default the file is not generated.
-c dir The name of the directory (which must exist) into which all of the
generated C or C++ code is placed. By default no code is generated.
-d file
@@ -1775,7 +1823,7 @@
==========
An Example
==========
-
+
This fragment of documentation is reStructuredText and will appear in the
module in which it is defined and all modules that %Import it.
%End
@@ -3298,7 +3346,7 @@
In the following description the first letter is the format character, the
entry in parentheses is the Python object type that the format character
will create, and the entry in brackets are the types of the C/C++ values
- to be passed.
+ to be passed.
``a`` (string) [char \*, int]
Convert a C/C++ character array and its length to a Python string. If
@@ -3600,7 +3648,7 @@
In the following description the first letter is the format character, the
entry in parentheses is the Python object type that the format character
will convert, and the entry in brackets are the types of the C/C++ values
- to be passed.
+ to be passed.
``a`` (string) [char \*\*, int \*]
Convert a Python string to a C/C++ character array and its length. If
@@ -3935,6 +3983,12 @@
The SIP Build System
====================
+.. sidebar:: Deprecation
+
+ **WARNING**: The SIP build system is deprecated and will be probably
+ removed from a future version of SIP. Use the SIP distutils extension
+ instead.
+
The purpose of the build system is to make it easy for you to write
configuration scripts in Python for your own bindings. The build system takes
care of the details of particular combinations of platform and compiler. It
@@ -3943,9 +3997,7 @@
The build system is implemented as a pure Python module called ``sipconfig``
that contains a number of classes and functions. Using this module you can
write bespoke configuration scripts (e.g. PyQt's ``configure.py``) or use it
-with other Python based build systems (e.g.
-`Distutils <http://www.python.org/sigs/distutils-sig/distutils.html>`_ and
-`SCons <http://www.scons.org>`_).
+with other Python based build systems (e.g. `SCons <http://www.scons.org>`_).
An important feature of SIP is the ability to generate bindings that are built
on top of existing bindings. For example, both
More information about the PyQt
mailing list
‘She has never mentioned her father to me. Was he—well, the sort of man whom the County Club would not have blackballed?’ "We walked by the side of our teams or behind the wagons, we slept on the ground at night, we did our own cooking, we washed our knives by sticking them into the ground rapidly a few times, and we washed our plates with sand and wisps of grass. When we stopped, we arranged our wagons in a circle, and thus formed a 'corral,' or yard, where we drove our oxen to yoke them up. And the corral was often very useful as a fort, or camp, for defending ourselves against the Indians. Do you see that little hollow down there?" he asked, pointing to a depression in the ground a short distance to the right of the train. "Well, in that hollow our wagon-train was kept three days and nights by the Indians. Three days and nights they stayed around, and made several attacks. Two of our men were killed and three were wounded by their arrows, and others had narrow escapes. One arrow hit me on the throat, but I was saved by the knot of my neckerchief, and the point only tore the skin a little. Since that time I have always had a fondness for large neckties. I don't know how many of the Indians we killed, as they carried off their dead and wounded, to save them from being scalped. Next to getting the scalps of their enemies, the most important thing with the Indians is to save their own. We had several fights during our journey, but that one was the worst. Once a little party of us were surrounded in a small 'wallow,' and had a tough time to defend ourselves successfully. Luckily for us, the Indians had no fire-arms then, and their bows and arrows were no match for our rifles. Nowadays they are well armed, but there are[Pg 41] not so many of them, and they are not inclined to trouble the railway trains. They used to do a great deal of mischief in the old times, and many a poor fellow has been killed by them." As dusk came on nearly the whole population of Maastricht, with all their temporary guests, formed an endless procession and went to invoke God's mercy by the Virgin Mary's intercession. They went to Our Lady's Church, in which stands the miraculous statue of Sancta Maria Stella Maris. The procession filled all the principal streets and squares of the town. I took my stand at the corner of the Vrijthof, where all marched past me, men, women, and children, all praying aloud, with loud voices beseeching: "Our Lady, Star of the Sea, pray for us ... pray for us ... pray for us ...!" It had not occurred to her for some hours after Mrs. Campbell had told her of Landor's death that she was free now to give herself to Cairness. She had gasped, indeed, when she did remember it, and had put the thought away, angrily and self-reproachfully. But it returned now, and she felt that she might cling to it. She had been grateful, and she had been faithful, too.[Pg 286] She remembered only that Landor had been kind to her, and forgot that for the last two years she had borne with much harsh coldness, and with a sort of contempt which she felt in her unanalyzing mind to have been entirely unmerited. Gradually she raised herself until she sat quite erect by the side of the mound, the old exultation of her half-wild girlhood shining in her face as she planned the future, which only a few minutes before had seemed so hopeless. After he had gloated over Sergeant Ramsey, Shorty got his men into the road ready to start. Si placed himself in front of the squad and deliberately loaded his musket in their sight. Shorty took his place in the rear, and gave out: The groups about each gun thinned out, as the shrieking fragments of shell mowed down man after man, but the rapidity of the fire did not slacken in the least. One of the Lieutenants turned and motioned with his saber to the riders seated on their horses in the line of limbers under the cover of the slope. One rider sprang from each team and ran up to take the place of men who had fallen. "As long as there's men and women in the world, the men 'ull be top and the women bottom." Then, in the house, the little girls were useful. Mrs. Backfield was not so energetic as she used to be. She had never been a robust woman, and though her husband's care had kept her well and strong, her frame was not equal to Reuben's demands; after fourteen years' hard labour, she suffered from rheumatism, which though seldom acute, was inclined to make her stiff and slow. It was here that Caro and Tilly came in, and Reuben began to appreciate his girls. After all, girls were needed in a house—and as for young men and marriage, their father could easily see that such follies did not spoil their usefulness or take them from him. Caro and Tilly helped their grandmother in all sorts of ways—they dusted, they watched pots, they shelled peas and peeled potatoes, they darned house-linen, they could even make a bed between them. HoME一级毛片视频免费公开
ENTER NUMBET 0018lizhanfu888.com.cn www.zjhd688.com.cn www.cndiyi.com.cn fxhe.com.cn xzon.com.cn www.duansx.com.cn jlins.com.cn www.nepci.com.cn fijf.com.cn www.whjcty.com.cn