1
1
# MySQL Connector/Python - MySQL driver written in Python.
2
- # Copyright (c) 2014, 2017 , Oracle and/or its affiliates. All rights reserved.
2
+ # Copyright (c) 2014, 2018 , Oracle and/or its affiliates. All rights reserved.
3
3
4
4
# MySQL Connector/Python is licensed under the terms of the GPLv2
5
5
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -295,57 +295,6 @@ def initialize_options(self):
295
295
self .extra_link_args = None
296
296
self .with_mysql_capi = None
297
297
298
- def _get_posix_openssl_libs (self ):
299
- openssl_libs = []
300
- try :
301
- openssl_libs_path = os .path .join (self .with_mysql_capi , "lib" )
302
- openssl_libs .extend ([
303
- os .path .basename (glob (
304
- os .path .join (openssl_libs_path , "libssl.*.*.*" ))[0 ]),
305
- os .path .basename (glob (
306
- os .path .join (openssl_libs_path , "libcrypto.*.*.*" ))[0 ])
307
- ])
308
- except IndexError :
309
- log .error ("Couldn't find OpenSSL libraries in libmysqlclient" )
310
- return openssl_libs
311
-
312
- def _copy_vendor_libraries (self ):
313
- if not self .with_mysql_capi or self .distribution .data_files :
314
- return
315
-
316
- data_files = []
317
- vendor_libs = []
318
-
319
- if os .name == "nt" :
320
- mysql_capi = os .path .join (self .with_mysql_capi , "bin" )
321
- vendor_libs .append ((mysql_capi , ["ssleay32.dll" , "libeay32.dll" ]))
322
- vendor_folder = ""
323
- # Bundle libmysql.dll
324
- src = os .path .join (self .with_mysql_capi , "lib" , "libmysql.dll" )
325
- dst = os .getcwd ()
326
- log .info ("copying {0} -> {1}" .format (src , dst ))
327
- shutil .copy (src , dst )
328
- data_files .append ("libmysql.dll" )
329
- else :
330
- mysql_capi = os .path .join (self .with_mysql_capi , "lib" )
331
- vendor_libs .append ((mysql_capi , self ._get_posix_openssl_libs ()))
332
- vendor_folder = "mysql-vendor"
333
-
334
- if vendor_folder :
335
- mkpath (os .path .join (os .getcwd (), vendor_folder ))
336
-
337
- # Copy vendor libraries to 'mysql-vendor' folder
338
- log .info ("Copying vendor libraries" )
339
- for src_folder , files in vendor_libs :
340
- for filename in files :
341
- data_files .append (os .path .join (vendor_folder , filename ))
342
- src = os .path .join (src_folder , filename )
343
- dst = os .path .join (os .getcwd (), vendor_folder )
344
- log .info ("copying {0} -> {1}" .format (src , dst ))
345
- shutil .copy (src , dst )
346
- # Add data_files to distribution
347
- self .distribution .data_files = [(vendor_folder , data_files )]
348
-
349
298
def _finalize_connector_c (self , connc_loc ):
350
299
"""Finalize the --with-connector-c command line argument
351
300
"""
@@ -469,8 +418,6 @@ def finalize_options(self):
469
418
('extra_link_args' , 'extra_link_args' ),
470
419
('with_mysql_capi' , 'with_mysql_capi' ))
471
420
472
- self ._copy_vendor_libraries ()
473
-
474
421
build_ext .finalize_options (self )
475
422
476
423
print ("# Python architecture: {0}" .format (py_arch ))
@@ -524,8 +471,6 @@ def fix_compiler(self):
524
471
# Add extra link args
525
472
if self .extra_link_args and ext .name == "_mysql_connector" :
526
473
extra_link_args = self .extra_link_args .split ()
527
- if platform .system () == "Linux" :
528
- extra_link_args += ["-Wl,-rpath,$ORIGIN/mysql-vendor" ]
529
474
ext .extra_link_args .extend (extra_link_args )
530
475
# Add system headers
531
476
for sysheader in sysheaders :
@@ -558,26 +503,6 @@ def run(self):
558
503
self .fix_compiler ()
559
504
self .real_build_extensions ()
560
505
561
- if platform .system () == "Darwin" :
562
- libssl , libcrypto = self ._get_posix_openssl_libs ()
563
- cmd_libssl = [
564
- "install_name_tool" , "-change" , libssl ,
565
- "@loader_path/mysql-vendor/{0}" .format (libssl ),
566
- build_ext .get_ext_fullpath (self , "_mysql_connector" )
567
- ]
568
- log .info ("Executing: {0}" .format (" " .join (cmd_libssl )))
569
- proc = Popen (cmd_libssl , stdout = PIPE , universal_newlines = True )
570
- stdout , _ = proc .communicate ()
571
-
572
- cmd_libcrypto = [
573
- "install_name_tool" , "-change" , libcrypto ,
574
- "@loader_path/mysql-vendor/{0}" .format (libcrypto ),
575
- build_ext .get_ext_fullpath (self , "_mysql_connector" )
576
- ]
577
- log .info ("Executing: {0}" .format (" " .join (cmd_libcrypto )))
578
- proc = Popen (cmd_libcrypto , stdout = PIPE , universal_newlines = True )
579
- stdout , _ = proc .communicate ()
580
-
581
506
582
507
class BuildExtStatic (BuildExtDynamic ):
583
508
@@ -586,8 +511,6 @@ class BuildExtStatic(BuildExtDynamic):
586
511
user_options = build_ext .user_options + CEXT_OPTIONS
587
512
588
513
def finalize_options (self ):
589
- self ._copy_vendor_libraries ()
590
-
591
514
install_obj = self .distribution .get_command_obj ('install' )
592
515
install_obj .with_mysql_capi = self .with_mysql_capi
593
516
install_obj .extra_compile_args = self .extra_compile_args
0 commit comments