Skip to content

Commit 27683d5

Browse files
committed
MANIFEST.in
- Added *.cc setupinfo.py - To satisfy the MySQL Connector/C static library dependencies, link with librt if not Windows or OS X - Force distutils to use C++ linking by referencing a dummy C++ source file src/force_cpp_linkage.cc - New dummy file to force distutil to use C++ linking
1 parent 884c8ce commit 27683d5

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include MANIFEST.in
99
recursive-include examples *.py
1010
recursive-include lib *.py
1111
recursive-include tests *.py *.csv *.pem *.cnf
12-
recursive-include src *.c *.h
12+
recursive-include src *.c *.h *.cc
1313

1414
include docs/README_DOCS.txt
1515

setupinfo.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from distutils.core import Extension
2525
import os
2626
import sys
27+
import platform
2728

2829
from lib.cpy_distutils import (
2930
Install, InstallLib, BuildExtDynamic, BuildExtStatic
@@ -60,15 +61,21 @@
6061
name = 'mysql-connector-python'
6162
version = '{0}.{1}.{2}'.format(*VERSION[0:3])
6263

64+
extra_libraries = ['rt']
65+
if platform.system() in ["Darwin", "Windows"]:
66+
extra_libraries = []
67+
6368
extensions = [
6469
Extension("_mysql_connector",
6570
sources=[
6671
"src/exceptions.c",
6772
"src/mysql_capi.c",
6873
"src/mysql_capi_conversion.c",
6974
"src/mysql_connector.c",
75+
"src/force_cpp_linkage.cc",
7076
],
71-
include_dirs=['src/include']
77+
include_dirs=['src/include'],
78+
libraries=extra_libraries,
7279
)
7380
]
7481

src/force_cpp_linkage.cc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
# MySQL Connector/Python - MySQL driver written in Python.
3+
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
4+
5+
# MySQL Connector/Python is licensed under the terms of the GPLv2
6+
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
7+
# MySQL Connectors. There are special exceptions to the terms and
8+
# conditions of the GPLv2 as it is applied to this software, see the
9+
# FOSS License Exception
10+
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
11+
#
12+
# This program is free software; you can redistribute it and/or modify
13+
# it under the terms of the GNU General Public License as published by
14+
# the Free Software Foundation.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program; if not, write to the Free Software
23+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24+
*/
25+
26+
/*
27+
Dummy file to force distutils to do C++ linkage.
28+
29+
The MySQL client library in MySQL Serer 5.6 and up and MySQL
30+
Connector/C 6.1 and up is really a C++ library, and then the MySQL
31+
Connector/Python driver needs to be linked using C++ to get the
32+
right C++ runtime library references.
33+
*/
34+
35+
int dummy_variable;

0 commit comments

Comments
 (0)