()
| 27 | mysql_config.path = "mysql_config" |
| 28 | |
| 29 | def get_config(): |
| 30 | from setup_common import get_metadata_and_options, enabled, create_release_file |
| 31 | |
| 32 | metadata, options = get_metadata_and_options() |
| 33 | |
| 34 | if 'mysql_config' in options: |
| 35 | mysql_config.path = options['mysql_config'] |
| 36 | |
| 37 | extra_objects = [] |
| 38 | static = enabled(options, 'static') |
| 39 | if enabled(options, 'embedded'): |
| 40 | libs = mysql_config("libmysqld-libs") |
| 41 | client = "mysqld" |
| 42 | elif enabled(options, 'threadsafe'): |
| 43 | libs = mysql_config("libs_r") |
| 44 | client = "mysqlclient_r" |
| 45 | if not libs: |
| 46 | libs = mysql_config("libs") |
| 47 | client = "mysqlclient" |
| 48 | else: |
| 49 | libs = mysql_config("libs") |
| 50 | client = "mysqlclient" |
| 51 | |
| 52 | library_dirs = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("L")) ] |
| 53 | libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ] |
| 54 | |
| 55 | removable_compile_args = [ compiler_flag(f) for f in "ILl" ] |
| 56 | extra_compile_args = [ i.replace("%", "%%") for i in mysql_config("cflags") |
| 57 | if i[:2] not in removable_compile_args ] |
| 58 | |
| 59 | # Copy the arch flags for linking as well |
| 60 | extra_link_args = list() |
| 61 | for i in range(len(extra_compile_args)): |
| 62 | if extra_compile_args[i] == '-arch': |
| 63 | extra_link_args += ['-arch', extra_compile_args[i + 1]] |
| 64 | |
| 65 | include_dirs = [ dequote(i[2:]) |
| 66 | for i in mysql_config('include') |
| 67 | if i.startswith(compiler_flag('I')) ] |
| 68 | if not include_dirs: # fix for MySQL-3.23 |
| 69 | include_dirs = [ dequote(i[2:]) |
| 70 | for i in mysql_config('cflags') |
| 71 | if i.startswith(compiler_flag('I')) ] |
| 72 | |
| 73 | if static: |
| 74 | extra_objects.append(os.path.join(library_dirs[0],'lib{}.a'.format(client))) |
| 75 | if client in libraries: |
| 76 | libraries.remove(client) |
| 77 | |
| 78 | name = "MySQL-python" |
| 79 | if enabled(options, 'embedded'): |
| 80 | name = name + "-embedded" |
| 81 | metadata['name'] = name |
| 82 | |
| 83 | define_macros = [ |
| 84 | ('version_info', metadata['version_info']), |
| 85 | ('__version__', metadata['version']), |
| 86 | ] |
nothing calls this directly
no test coverage detected