root/camellia/trunk/camellia.py

リビジョン 21, 2.0 kB (コミッタ: sgk, コミット時期: 3 年 前)

sys.modules[name] = modにより、モジュール自体を入れ替えるようにした。

Line 
1 '''
2 camellia.py v 0.0
3
4 http://omake.accense.com/wiki/PythonCamellia
5
6 Copyright (c) 2006, Accense Technology, Inc.
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
11
12 o Redistributions of source code must retain the above copyright notice,
13   this list of conditions and the following disclaimer.
14 o Redistributions in binary form must reproduce the above copyright notice,
15   this list of conditions and the following disclaimer in the documentation
16   and/or other materials provided with the distribution.
17 o Neither the name of the Accense Technology, Inc. nor the names of its
18   contributors may be used to endorse or promote products derived from this
19   software without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE.
32 '''
33
34 #
35 # Try to import C version or Python version
36 #
37 try:
38   import ccamellia as mod
39 except:
40   import pycamellia as mod
41
42 #
43 # Copy the __doc__ string above if the imported module doesn't have it.
44 #
45 import sys
46 try:
47   if not mod.__doc__:
48     mod.__doc__ = __doc__
49 except:
50   setattr(mod, '__doc__', __doc__)
51
52 #
53 # Replace the module registration with the C or Python version.
54 #
55 sys.modules[__name__] = mod
56
57 #
58 # Delete unwanted variables.
59 #
60 del mod, sys
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。