Whitespace normalization.
This commit is contained in:
parent
b31c8142d5
commit
e8d09e5818
|
@ -76,13 +76,13 @@ def c_buffer(init, size=None):
|
|||
_c_functype_cache = {}
|
||||
def CFUNCTYPE(restype, *argtypes):
|
||||
"""CFUNCTYPE(restype, *argtypes) -> function prototype.
|
||||
|
||||
|
||||
restype: the result type
|
||||
argtypes: a sequence specifying the argument types
|
||||
|
||||
|
||||
The function prototype can be called in three ways to create a
|
||||
callable object:
|
||||
|
||||
|
||||
prototype(funct) - returns a C callable function calling funct
|
||||
prototype(vtbl_index, method_name[, paramflags]) - a Python callable that calls a COM method
|
||||
prototype(funct_name, dll[, paramflags]) - a Python callable that calls an exported function in a dll
|
||||
|
@ -139,7 +139,7 @@ class c_long(_SimpleCData):
|
|||
|
||||
class c_ulong(_SimpleCData):
|
||||
_type_ = "L"
|
||||
|
||||
|
||||
if _calcsize("i") == _calcsize("l"):
|
||||
# if int and long have the same size, make c_int an alias for c_long
|
||||
c_int = c_long
|
||||
|
@ -153,7 +153,7 @@ else:
|
|||
|
||||
class c_float(_SimpleCData):
|
||||
_type_ = "f"
|
||||
|
||||
|
||||
class c_double(_SimpleCData):
|
||||
_type_ = "d"
|
||||
|
||||
|
@ -327,7 +327,7 @@ class PyDLL(CDLL):
|
|||
_restype_ = c_int # default, can be overridden in instances
|
||||
|
||||
if _os.name in ("nt", "ce"):
|
||||
|
||||
|
||||
class WinDLL(CDLL):
|
||||
"""This class represents a dll exporting functions using the
|
||||
Windows stdcall calling convention.
|
||||
|
@ -351,7 +351,7 @@ if _os.name in ("nt", "ce"):
|
|||
# doesn't have a way to raise an exception in the caller's
|
||||
# frame).
|
||||
_check_retval_ = _check_HRESULT
|
||||
|
||||
|
||||
class OleDLL(CDLL):
|
||||
"""This class represents a dll exporting functions using the
|
||||
Windows stdcall calling convention, and returning HRESULT.
|
||||
|
@ -424,7 +424,7 @@ else:
|
|||
|
||||
Return the string at addr."""
|
||||
return _wstring_at(ptr, size)
|
||||
|
||||
|
||||
|
||||
if _os.name == "nt": # COM stuff
|
||||
def DllGetClassObject(rclsid, riid, ppv):
|
||||
|
|
|
@ -55,4 +55,3 @@ elif sys.byteorder == "big":
|
|||
|
||||
else:
|
||||
raise RuntimeError("Invalid byteorder")
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ class LibraryLoader(object):
|
|||
except ValueError:
|
||||
raise OSError("Library %s could not be found" % libname)
|
||||
return self.load_library(pathname, mode)
|
||||
|
||||
|
||||
elif os.name == "posix":
|
||||
# Posix
|
||||
def _plat_load_version(self, name, version, mode):
|
||||
|
|
|
@ -83,7 +83,7 @@ def test_with_refcounts(runner, verbosity, testcase):
|
|||
ptc = ctypes._pointer_type_cache.copy()
|
||||
cfc = ctypes._c_functype_cache.copy()
|
||||
wfc = ctypes._win_functype_cache.copy()
|
||||
|
||||
|
||||
# when searching for refcount leaks, we have to manually reset any
|
||||
# caches that ctypes has.
|
||||
def cleanup():
|
||||
|
|
|
@ -8,7 +8,7 @@ def dump(obj):
|
|||
# between the bytes.
|
||||
h = hexlify(buffer(obj))
|
||||
return re.sub(r"(..)", r"\1-", h)[:-1]
|
||||
|
||||
|
||||
|
||||
class Value(Structure):
|
||||
_fields_ = [("val", c_byte)]
|
||||
|
|
|
@ -15,7 +15,7 @@ class BITS(Structure):
|
|||
("G", c_int, 7),
|
||||
("H", c_int, 8),
|
||||
("I", c_int, 9),
|
||||
|
||||
|
||||
("M", c_short, 1),
|
||||
("N", c_short, 2),
|
||||
("O", c_short, 3),
|
||||
|
@ -62,7 +62,7 @@ class BitFieldTest(unittest.TestCase):
|
|||
x = X()
|
||||
x.a, x.b, x.c = -1, 7, -1
|
||||
self.failUnlessEqual((x.a, x.b, x.c), (-1, 7, -1))
|
||||
|
||||
|
||||
def test_ulonglong(self):
|
||||
class X(Structure):
|
||||
_fields_ = [("a", c_ulonglong, 1),
|
||||
|
@ -79,7 +79,7 @@ class BitFieldTest(unittest.TestCase):
|
|||
for c_typ in signed_int_types:
|
||||
class X(Structure):
|
||||
_fields_ = [("dummy", c_typ),
|
||||
("a", c_typ, 3),
|
||||
("a", c_typ, 3),
|
||||
("b", c_typ, 3),
|
||||
("c", c_typ, 1)]
|
||||
self.failUnlessEqual(sizeof(X), sizeof(c_typ)*2)
|
||||
|
|
|
@ -8,14 +8,14 @@ class StringBufferTestCase(unittest.TestCase):
|
|||
self.failUnlessEqual(len(b), 32)
|
||||
self.failUnlessEqual(sizeof(b), 32 * sizeof(c_char))
|
||||
self.failUnless(type(b[0]) is str)
|
||||
|
||||
|
||||
b = create_string_buffer("abc")
|
||||
self.failUnlessEqual(len(b), 4) # trailing nul char
|
||||
self.failUnlessEqual(sizeof(b), 4 * sizeof(c_char))
|
||||
self.failUnless(type(b[0]) is str)
|
||||
self.failUnlessEqual(b[0], "a")
|
||||
self.failUnlessEqual(b[:], "abc\0")
|
||||
|
||||
|
||||
def test_string_conversion(self):
|
||||
b = create_string_buffer(u"abc")
|
||||
self.failUnlessEqual(len(b), 4) # trailing nul char
|
||||
|
|
|
@ -11,7 +11,7 @@ def bin(s):
|
|||
# byte order, and a __ctype_le__ attribute that is the same type in
|
||||
# LITTLE ENDIAN byte order.
|
||||
#
|
||||
# For Structures and Unions, these types are created on demand.
|
||||
# For Structures and Unions, these types are created on demand.
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
def X_test(self):
|
||||
|
|
|
@ -3,7 +3,7 @@ from ctypes import *
|
|||
import _ctypes_test
|
||||
|
||||
class Callbacks(unittest.TestCase):
|
||||
functype = CFUNCTYPE
|
||||
functype = CFUNCTYPE
|
||||
|
||||
## def tearDown(self):
|
||||
## import gc
|
||||
|
@ -130,7 +130,7 @@ class SampleCallbacksTestCase(unittest.TestCase):
|
|||
|
||||
result = integrate(0.0, 1.0, CALLBACK(func), 10)
|
||||
diff = abs(result - 1./3.)
|
||||
|
||||
|
||||
self.failUnless(diff < 0.01, "%s not less than 0.01" % diff)
|
||||
|
||||
################################################################
|
||||
|
|
|
@ -122,6 +122,6 @@ class CFuncPtrTestCase(unittest.TestCase):
|
|||
self.failUnlessEqual(strtok(None, "\n"), "b")
|
||||
self.failUnlessEqual(strtok(None, "\n"), "c")
|
||||
self.failUnlessEqual(strtok(None, "\n"), None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -28,14 +28,14 @@ class FunctionTestCase(unittest.TestCase):
|
|||
# But in early versions of _ctypes.c, the result of tp_new
|
||||
# wasn't checked, and it even crashed Python.
|
||||
# Found by Greg Chapman.
|
||||
|
||||
|
||||
try:
|
||||
class X(object, Array):
|
||||
_length_ = 5
|
||||
_type_ = "i"
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
from _ctypes import _Pointer
|
||||
try:
|
||||
|
@ -105,7 +105,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
result = f(1, 2, 3, 4, 5.0, 6.0)
|
||||
self.failUnlessEqual(result, 21)
|
||||
self.failUnlessEqual(type(result), int)
|
||||
|
||||
|
||||
result = f(1, 2, 3, 0x10004, 5.0, 6.0)
|
||||
self.failUnlessEqual(result, 21)
|
||||
self.failUnlessEqual(type(result), int)
|
||||
|
@ -124,7 +124,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
result = f(-1, -2, -3, -4, -5.0, -6.0)
|
||||
self.failUnlessEqual(result, -21)
|
||||
self.failUnlessEqual(type(result), float)
|
||||
|
||||
|
||||
def test_doubleresult(self):
|
||||
f = dll._testfunc_d_bhilfd
|
||||
f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double]
|
||||
|
@ -136,7 +136,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
result = f(-1, -2, -3, -4, -5.0, -6.0)
|
||||
self.failUnlessEqual(result, -21)
|
||||
self.failUnlessEqual(type(result), float)
|
||||
|
||||
|
||||
def test_longlongresult(self):
|
||||
try:
|
||||
c_longlong
|
||||
|
@ -226,7 +226,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
self.failUnlessEqual(args, expected)
|
||||
|
||||
################################################################
|
||||
|
||||
|
||||
|
||||
def test_callbacks(self):
|
||||
f = dll._testfunc_callback_i_if
|
||||
|
@ -237,7 +237,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
def callback(value):
|
||||
#print "called back with", value
|
||||
return value
|
||||
|
||||
|
||||
cb = MyCallback(callback)
|
||||
result = f(-10, cb)
|
||||
self.failUnlessEqual(result, -18)
|
||||
|
@ -247,7 +247,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
cb = MyCallback(callback)
|
||||
result = f(-10, cb)
|
||||
self.failUnlessEqual(result, -18)
|
||||
|
||||
|
||||
AnotherCallback = WINFUNCTYPE(c_int, c_int, c_int, c_int, c_int)
|
||||
|
||||
# check that the prototype works: we call f with wrong
|
||||
|
@ -271,7 +271,7 @@ class FunctionTestCase(unittest.TestCase):
|
|||
#print "called back with", value
|
||||
self.failUnlessEqual(type(value), int)
|
||||
return value
|
||||
|
||||
|
||||
cb = MyCallback(callback)
|
||||
result = f(-10, cb)
|
||||
self.failUnlessEqual(result, -18)
|
||||
|
|
|
@ -130,7 +130,7 @@ class PointerToStructure(unittest.TestCase):
|
|||
("b", POINTER(POINT))]
|
||||
r = RECT()
|
||||
p1 = POINT(1, 2)
|
||||
|
||||
|
||||
r.a = pointer(p1)
|
||||
r.b = pointer(p1)
|
||||
## from pprint import pprint as pp
|
||||
|
|
|
@ -36,13 +36,13 @@ It'll have output like this:
|
|||
from ctypes.macholib.dyld import dyld_find
|
||||
|
||||
def find_lib(name):
|
||||
possible = ['lib'+name+'.dylib', name+'.dylib', name+'.framework/'+name]
|
||||
for dylib in possible:
|
||||
try:
|
||||
return os.path.realpath(dyld_find(dylib))
|
||||
except ValueError:
|
||||
pass
|
||||
raise ValueError, "%s not found" % (name,)
|
||||
possible = ['lib'+name+'.dylib', name+'.dylib', name+'.framework/'+name]
|
||||
for dylib in possible:
|
||||
try:
|
||||
return os.path.realpath(dyld_find(dylib))
|
||||
except ValueError:
|
||||
pass
|
||||
raise ValueError, "%s not found" % (name,)
|
||||
|
||||
class MachOTest(unittest.TestCase):
|
||||
if sys.platform == "darwin":
|
||||
|
|
|
@ -34,14 +34,14 @@ except NameError:
|
|||
else:
|
||||
unsigned_types.append(c_ulonglong)
|
||||
signed_types.append(c_longlong)
|
||||
|
||||
|
||||
unsigned_ranges = valid_ranges(*unsigned_types)
|
||||
signed_ranges = valid_ranges(*signed_types)
|
||||
|
||||
################################################################
|
||||
|
||||
class NumberTestCase(unittest.TestCase):
|
||||
|
||||
|
||||
def test_default_init(self):
|
||||
# default values are set to zero
|
||||
for t in signed_types + unsigned_types + float_types:
|
||||
|
@ -132,7 +132,7 @@ class NumberTestCase(unittest.TestCase):
|
|||
# and alignment of an instance
|
||||
self.failUnlessEqual((code, alignment(t())),
|
||||
(code, align))
|
||||
|
||||
|
||||
def test_int_from_address(self):
|
||||
from array import array
|
||||
for t in signed_types + unsigned_types:
|
||||
|
@ -152,7 +152,7 @@ class NumberTestCase(unittest.TestCase):
|
|||
# changing the value at the memory location changes v's value also
|
||||
a[0] = 42
|
||||
self.failUnlessEqual(v.value, a[0])
|
||||
|
||||
|
||||
|
||||
def test_float_from_address(self):
|
||||
from array import array
|
||||
|
@ -168,7 +168,7 @@ class NumberTestCase(unittest.TestCase):
|
|||
def test_char_from_address(self):
|
||||
from ctypes import c_char
|
||||
from array import array
|
||||
|
||||
|
||||
a = array('c', 'x')
|
||||
v = c_char.from_address(a.buffer_info()[0])
|
||||
self.failUnlessEqual(v.value, a[0])
|
||||
|
@ -185,7 +185,7 @@ class NumberTestCase(unittest.TestCase):
|
|||
|
||||
## def test_perf(self):
|
||||
## check_perf()
|
||||
|
||||
|
||||
from ctypes import _SimpleCData
|
||||
class c_int_S(_SimpleCData):
|
||||
_type_ = "i"
|
||||
|
@ -227,7 +227,7 @@ def check_perf():
|
|||
# c_int(): 3.35 us
|
||||
# c_int(999): 3.34 us
|
||||
# c_int_S(): 3.23 us
|
||||
# c_int_S(999): 3.24 us
|
||||
# c_int_S(999): 3.24 us
|
||||
|
||||
# Python 2.2 -OO, win2k, P4 700 MHz:
|
||||
#
|
||||
|
|
|
@ -18,7 +18,7 @@ class SimpleTypesTestCase(unittest.TestCase):
|
|||
pass
|
||||
else:
|
||||
set_conversion_mode(*self.prev_conv_mode)
|
||||
|
||||
|
||||
|
||||
def test_subclasses(self):
|
||||
from ctypes import c_void_p, c_char_p
|
||||
|
|
|
@ -11,7 +11,7 @@ python_types = [int, int, int, int, int, long,
|
|||
class PointersTestCase(unittest.TestCase):
|
||||
|
||||
def test_pointer_crash(self):
|
||||
|
||||
|
||||
class A(POINTER(c_ulong)):
|
||||
pass
|
||||
|
||||
|
@ -84,7 +84,7 @@ class PointersTestCase(unittest.TestCase):
|
|||
## print self.result
|
||||
doit(callback)
|
||||
## print self.result
|
||||
|
||||
|
||||
def test_basics(self):
|
||||
from operator import delitem
|
||||
for ct, pt in zip(ctype_types, python_types):
|
||||
|
@ -132,7 +132,7 @@ class PointersTestCase(unittest.TestCase):
|
|||
self.assertRaises(TypeError, len, p)
|
||||
self.failUnlessEqual(p[0], 42)
|
||||
self.failUnlessEqual(p.contents.value, 42)
|
||||
|
||||
|
||||
def test_incomplete(self):
|
||||
lpcell = POINTER("cell")
|
||||
class cell(Structure):
|
||||
|
@ -166,6 +166,6 @@ class PointersTestCase(unittest.TestCase):
|
|||
result = func( byref(argc), argv )
|
||||
assert result == 'world', result
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -10,7 +10,7 @@ if os.name == "posix" and sys.platform == "linux2":
|
|||
def test_GL(self):
|
||||
cdll.load('libGL.so', mode=RTLD_GLOBAL)
|
||||
cdll.load('libGLU.so')
|
||||
|
||||
|
||||
##if os.name == "posix" and sys.platform != "darwin":
|
||||
|
||||
## # On platforms where the default shared library suffix is '.so',
|
||||
|
|
|
@ -44,7 +44,7 @@ class CharPointersTestCase(unittest.TestCase):
|
|||
|
||||
func.argtypes = POINTER(c_int),
|
||||
self.failUnlessEqual(addressof(ci), func(byref(ci)))
|
||||
|
||||
|
||||
func.argtypes = c_char_p,
|
||||
self.assertRaises(ArgumentError, func, byref(ci))
|
||||
|
||||
|
@ -73,7 +73,7 @@ class CharPointersTestCase(unittest.TestCase):
|
|||
func = testdll._testfunc_p_p
|
||||
func.restype = c_char_p
|
||||
func.argtypes = c_char_p,
|
||||
|
||||
|
||||
self.failUnlessEqual(None, func(None))
|
||||
self.failUnlessEqual("123", func("123"))
|
||||
self.failUnlessEqual(None, func(c_char_p(None)))
|
||||
|
|
|
@ -48,7 +48,7 @@ class RefcountTestCase(unittest.TestCase):
|
|||
# and may release it again
|
||||
del f
|
||||
self.failUnless(grc(func) >= 2)
|
||||
|
||||
|
||||
# but now it must be gone
|
||||
gc.collect()
|
||||
self.failUnless(grc(func) == 2)
|
||||
|
@ -57,14 +57,14 @@ class RefcountTestCase(unittest.TestCase):
|
|||
_fields_ = [("a", OtherCallback)]
|
||||
x = X()
|
||||
x.a = OtherCallback(func)
|
||||
|
||||
|
||||
# the CFuncPtr instance holds atr least one refcount on func:
|
||||
self.failUnless(grc(func) > 2)
|
||||
|
||||
# and may release it again
|
||||
del x
|
||||
self.failUnless(grc(func) >= 2)
|
||||
|
||||
|
||||
# and now it must be gone again
|
||||
gc.collect()
|
||||
self.failUnlessEqual(grc(func), 2)
|
||||
|
@ -80,7 +80,7 @@ class RefcountTestCase(unittest.TestCase):
|
|||
del f
|
||||
gc.collect()
|
||||
self.failUnlessEqual(grc(func), 2)
|
||||
|
||||
|
||||
class AnotherLeak(unittest.TestCase):
|
||||
def test_callback(self):
|
||||
import sys
|
||||
|
@ -89,7 +89,7 @@ class AnotherLeak(unittest.TestCase):
|
|||
def func(a, b):
|
||||
return a * b * 2
|
||||
f = proto(func)
|
||||
|
||||
|
||||
a = sys.getrefcount(ctypes.c_int)
|
||||
f(1, 2)
|
||||
self.failUnlessEqual(sys.getrefcount(ctypes.c_int), a)
|
||||
|
|
|
@ -16,7 +16,7 @@ class ReturnFuncPtrTestCase(unittest.TestCase):
|
|||
self.failUnlessEqual(strchr("abcdef", "x"), None)
|
||||
self.assertRaises(ArgumentError, strchr, "abcdef", 3)
|
||||
self.assertRaises(TypeError, strchr, "abcdef")
|
||||
|
||||
|
||||
def test_without_prototype(self):
|
||||
dll = cdll.load(_ctypes_test.__file__)
|
||||
get_strchr = dll.get_strchr
|
||||
|
|
|
@ -46,7 +46,7 @@ class StringArrayTestCase(unittest.TestCase):
|
|||
BUF = c_char * 4
|
||||
buf = BUF()
|
||||
## print c_char_p.from_param(buf)
|
||||
|
||||
|
||||
def test_param_2(self):
|
||||
BUF = c_char * 4
|
||||
buf = BUF()
|
||||
|
@ -103,9 +103,9 @@ class StringTestCase(unittest.TestCase):
|
|||
|
||||
def XX_test_sized_strings(self):
|
||||
|
||||
# New in releases later than 0.4.0:
|
||||
# New in releases later than 0.4.0:
|
||||
self.assertRaises(TypeError, c_string, None)
|
||||
|
||||
|
||||
# New in releases later than 0.4.0:
|
||||
# c_string(number) returns an empty string of size number
|
||||
self.failUnless(len(c_string(32).raw) == 32)
|
||||
|
@ -181,7 +181,7 @@ else:
|
|||
# One char too long values:
|
||||
self.assertRaises(ValueError, setattr, cs, "value", u"1234567")
|
||||
|
||||
|
||||
|
||||
def run_test(rep, msg, func, arg):
|
||||
items = range(rep)
|
||||
from time import clock
|
||||
|
|
|
@ -56,7 +56,7 @@ class StructureTestCase(unittest.TestCase):
|
|||
"f": c_float,
|
||||
"d": c_double,
|
||||
}
|
||||
|
||||
|
||||
def test_simple_structs(self):
|
||||
for code, tp in self.formats.items():
|
||||
class X(Structure):
|
||||
|
@ -90,7 +90,7 @@ class StructureTestCase(unittest.TestCase):
|
|||
("b", Y)]
|
||||
self.failUnlessEqual(alignment(SI), max(alignment(Y), alignment(X)))
|
||||
self.failUnlessEqual(sizeof(SI), calcsize("3s0i 3si 0i"))
|
||||
|
||||
|
||||
class IS(Structure):
|
||||
_fields_ = [("b", Y),
|
||||
("a", X)]
|
||||
|
@ -215,7 +215,7 @@ class StructureTestCase(unittest.TestCase):
|
|||
# too long
|
||||
self.assertRaises(ValueError, Person, "1234567", 5)
|
||||
|
||||
|
||||
|
||||
def test_keyword_initializers(self):
|
||||
class POINT(Structure):
|
||||
_fields_ = [("x", c_int), ("y", c_int)]
|
||||
|
@ -315,7 +315,7 @@ class StructureTestCase(unittest.TestCase):
|
|||
func(*args)
|
||||
except Exception, detail:
|
||||
return detail.__class__, str(detail)
|
||||
|
||||
|
||||
|
||||
## def test_subclass_creation(self):
|
||||
## meta = type(Structure)
|
||||
|
@ -373,4 +373,3 @@ class PointerMemberTestCase(unittest.TestCase):
|
|||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
|
|
@ -43,22 +43,22 @@ if sys.platform == "win32":
|
|||
|
||||
class Structures(unittest.TestCase):
|
||||
|
||||
def test_struct_by_value(self):
|
||||
class POINT(Structure):
|
||||
_fields_ = [("x", c_long),
|
||||
("y", c_long)]
|
||||
def test_struct_by_value(self):
|
||||
class POINT(Structure):
|
||||
_fields_ = [("x", c_long),
|
||||
("y", c_long)]
|
||||
|
||||
class RECT(Structure):
|
||||
_fields_ = [("left", c_long),
|
||||
("top", c_long),
|
||||
("right", c_long),
|
||||
("bottom", c_long)]
|
||||
class RECT(Structure):
|
||||
_fields_ = [("left", c_long),
|
||||
("top", c_long),
|
||||
("right", c_long),
|
||||
("bottom", c_long)]
|
||||
|
||||
dll = cdll.load(_ctypes_test.__file__)
|
||||
dll = cdll.load(_ctypes_test.__file__)
|
||||
|
||||
pt = POINT(10, 10)
|
||||
rect = RECT(0, 0, 20, 20)
|
||||
self.failUnlessEqual(1, dll.PointInRect(byref(rect), pt))
|
||||
pt = POINT(10, 10)
|
||||
rect = RECT(0, 0, 20, 20)
|
||||
self.failUnlessEqual(1, dll.PointInRect(byref(rect), pt))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -216,10 +216,10 @@ class bdist_msi (Command):
|
|||
# Prefix ProductName with Python x.y, so that
|
||||
# it sorts together with the other Python packages
|
||||
# in Add-Remove-Programs (APR)
|
||||
product_name = "Python %s %s" % (self.target_version,
|
||||
product_name = "Python %s %s" % (self.target_version,
|
||||
self.distribution.get_fullname())
|
||||
self.db = msilib.init_database(installer_name, schema,
|
||||
product_name, msilib.gen_uuid(),
|
||||
product_name, msilib.gen_uuid(),
|
||||
sversion, author)
|
||||
msilib.add_tables(self.db, sequence)
|
||||
props = [('DistVersion', version)]
|
||||
|
@ -238,7 +238,7 @@ class bdist_msi (Command):
|
|||
self.db.Commit()
|
||||
|
||||
if hasattr(self.distribution, 'dist_files'):
|
||||
self.distribution.dist_files.append(('bdist_msi', self.target_version, fullname))
|
||||
self.distribution.dist_files.append(('bdist_msi', self.target_version, fullname))
|
||||
|
||||
if not self.keep_temp:
|
||||
remove_tree(self.bdist_dir, dry_run=self.dry_run)
|
||||
|
@ -265,14 +265,14 @@ class bdist_msi (Command):
|
|||
if self.install_script_key:
|
||||
raise DistutilsOptionError, "Multiple files with name %s" % file
|
||||
self.install_script_key = '[#%s]' % key
|
||||
|
||||
|
||||
cab.commit(db)
|
||||
|
||||
def add_find_python(self):
|
||||
"""Adds code to the installer to compute the location of Python.
|
||||
Properties PYTHON.MACHINE, PYTHON.USER, PYTHONDIR and PYTHON will be set
|
||||
in both the execute and UI sequences; PYTHONDIR will be set from
|
||||
PYTHON.USER if defined, else from PYTHON.MACHINE.
|
||||
PYTHON.USER if defined, else from PYTHON.MACHINE.
|
||||
PYTHON is PYTHONDIR\python.exe"""
|
||||
install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % self.target_version
|
||||
add_data(self.db, "RegLocator",
|
||||
|
@ -497,7 +497,7 @@ class bdist_msi (Command):
|
|||
seldlg.title("Select Destination Directory")
|
||||
|
||||
version = sys.version[:3]+" "
|
||||
seldlg.text("Hint", 15, 30, 300, 40, 3,
|
||||
seldlg.text("Hint", 15, 30, 300, 40, 3,
|
||||
"The destination directory should contain a Python %sinstallation" % version)
|
||||
|
||||
seldlg.back("< Back", None, active=0)
|
||||
|
|
|
@ -252,7 +252,7 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
|
|||
for mname in mnames:
|
||||
m = __import__(mname, globals(), locals(), ["__dummy__"])
|
||||
m.__loader__ # to make sure we actually handled the import
|
||||
# Delete urllib from modules because urlparse was imported above.
|
||||
# Delete urllib from modules because urlparse was imported above.
|
||||
# Without this hack, test_socket_ssl fails if run in this order:
|
||||
# regrtest.py test_codecmaps_tw test_importhooks test_socket_ssl
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue