mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
Merge remote branch 'jason/devel' into devel
This commit is contained in:
commit
8ab7fa596c
15
psycopg/_psycopg.vc9.amd64.manifest
Normal file
15
psycopg/_psycopg.vc9.amd64.manifest
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
15
psycopg/_psycopg.vc9.x86.manifest
Normal file
15
psycopg/_psycopg.vc9.x86.manifest
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
19
setup.py
19
setup.py
|
@ -54,6 +54,8 @@ from distutils.errors import DistutilsFileError
|
|||
from distutils.command.build_ext import build_ext
|
||||
from distutils.sysconfig import get_python_inc
|
||||
from distutils.ccompiler import get_default_compiler
|
||||
from distutils.dep_util import newer_group
|
||||
from distutils.util import get_platform
|
||||
try:
|
||||
from distutils.command.build_py import build_py_2to3 as build_py
|
||||
except ImportError:
|
||||
|
@ -149,6 +151,23 @@ class psycopg_build_ext(build_ext):
|
|||
def get_pg_config(self, kind):
|
||||
return get_pg_config(kind, self.pg_config)
|
||||
|
||||
def build_extension(self, ext):
|
||||
build_ext.build_extension(self, ext)
|
||||
|
||||
# For MSVC compiler and Python 2.6/2.7 (aka VS 2008), re-insert the
|
||||
# Manifest into the resulting .pyd file.
|
||||
sysVer = sys.version_info[:2]
|
||||
if self.get_compiler().lower().startswith('msvc') and \
|
||||
sysVer in ((2,6), (2,7)):
|
||||
platform = get_platform()
|
||||
# Default to the x86 manifest
|
||||
manifest = '_psycopg.vc9.x86.manifest'
|
||||
if platform == 'win-amd64':
|
||||
manifest = '_psycopg.vc9.amd64.manifest'
|
||||
self.compiler.spawn(['mt.exe', '-nologo', '-manifest',
|
||||
os.path.join('psycopg', manifest),
|
||||
'-outputresource:%s;2' % (os.path.join(self.build_lib, 'psycopg2', '_psycopg.pyd'))])
|
||||
|
||||
def finalize_win32(self):
|
||||
"""Finalize build system configuration on win32 platform."""
|
||||
import struct
|
||||
|
|
|
@ -143,7 +143,7 @@ class ConnectionTests(unittest.TestCase):
|
|||
|
||||
def test_weakref(self):
|
||||
from weakref import ref
|
||||
conn = psycopg2.connect(self.conn.dsn)
|
||||
conn = psycopg2.connect(dsn)
|
||||
w = ref(conn)
|
||||
conn.close()
|
||||
del conn
|
||||
|
|
|
@ -6,6 +6,7 @@ dbname = os.environ.get('PSYCOPG2_TESTDB', 'psycopg2_test')
|
|||
dbhost = os.environ.get('PSYCOPG2_TESTDB_HOST', None)
|
||||
dbport = os.environ.get('PSYCOPG2_TESTDB_PORT', None)
|
||||
dbuser = os.environ.get('PSYCOPG2_TESTDB_USER', None)
|
||||
dbpass = os.environ.get('PSYCOPG2_TESTDB_PASSWORD', None)
|
||||
|
||||
# Check if we want to test psycopg's green path.
|
||||
green = os.environ.get('PSYCOPG2_TEST_GREEN', None)
|
||||
|
@ -29,5 +30,7 @@ if dbport is not None:
|
|||
dsn += ' port=%s' % dbport
|
||||
if dbuser is not None:
|
||||
dsn += ' user=%s' % dbuser
|
||||
if dbpass is not None:
|
||||
dsn += ' password=%s' % dbpass
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# testutils.py - utility module for psycopg2 testing.
|
||||
|
||||
#
|
||||
# Copyright (C) 2010-2011 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||
#
|
||||
|
@ -190,21 +191,24 @@ def script_to_py3(script):
|
|||
return script
|
||||
|
||||
import tempfile
|
||||
f = tempfile.NamedTemporaryFile(suffix=".py")
|
||||
f = tempfile.NamedTemporaryFile(suffix=".py", delete=False)
|
||||
f.write(script.encode())
|
||||
f.flush()
|
||||
filename = f.name
|
||||
f.close()
|
||||
|
||||
# 2to3 is way too chatty
|
||||
import logging
|
||||
logging.basicConfig(filename=os.devnull)
|
||||
|
||||
from lib2to3.main import main
|
||||
if main("lib2to3.fixes", ['--no-diffs', '-w', '-n', f.name]):
|
||||
if main("lib2to3.fixes", ['--no-diffs', '-w', '-n', filename]):
|
||||
raise Exception('py3 conversion failed')
|
||||
|
||||
f2 = open(f.name)
|
||||
f2 = open(filename)
|
||||
try:
|
||||
return f2.read()
|
||||
finally:
|
||||
f2.close()
|
||||
os.remove(filename)
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ class HstoreTestCase(unittest.TestCase):
|
|||
oids = HstoreAdapter.get_oids(self.conn)
|
||||
try:
|
||||
register_hstore(self.conn, globally=True)
|
||||
conn2 = psycopg2.connect(self.conn.dsn)
|
||||
conn2 = psycopg2.connect(dsn)
|
||||
try:
|
||||
cur2 = self.conn.cursor()
|
||||
cur2.execute("select 'a => b'::hstore")
|
||||
|
@ -489,8 +489,8 @@ class AdaptTypeTestCase(unittest.TestCase):
|
|||
def test_register_on_connection(self):
|
||||
self._create_type("type_ii", [("a", "integer"), ("b", "integer")])
|
||||
|
||||
conn1 = psycopg2.connect(self.conn.dsn)
|
||||
conn2 = psycopg2.connect(self.conn.dsn)
|
||||
conn1 = psycopg2.connect(dsn)
|
||||
conn2 = psycopg2.connect(dsn)
|
||||
try:
|
||||
psycopg2.extras.register_composite("type_ii", conn1)
|
||||
curs1 = conn1.cursor()
|
||||
|
@ -507,8 +507,8 @@ class AdaptTypeTestCase(unittest.TestCase):
|
|||
def test_register_globally(self):
|
||||
self._create_type("type_ii", [("a", "integer"), ("b", "integer")])
|
||||
|
||||
conn1 = psycopg2.connect(self.conn.dsn)
|
||||
conn2 = psycopg2.connect(self.conn.dsn)
|
||||
conn1 = psycopg2.connect(dsn)
|
||||
conn2 = psycopg2.connect(dsn)
|
||||
try:
|
||||
t = psycopg2.extras.register_composite("type_ii", conn1, globally=True)
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user