|
29 | 29 | from distutils.command.install_lib import install_lib
|
30 | 30 | from distutils.errors import DistutilsExecError
|
31 | 31 | from distutils.util import get_platform
|
| 32 | +from distutils.version import LooseVersion |
32 | 33 | from distutils.dir_util import copy_tree
|
33 | 34 | from distutils import log
|
34 | 35 | from glob import glob
|
@@ -327,21 +328,19 @@ def _finalize_connector_c(self, connc_loc):
|
327 | 328 | log.debug("# connc_loc: {0}".format(connc_loc))
|
328 | 329 | else:
|
329 | 330 | # Probably using MS Windows
|
330 |
| - myconfigh = os.path.join(connc_loc, 'include', 'my_config.h') |
| 331 | + myversionh = os.path.join(connc_loc, 'include', |
| 332 | + 'mysql_version.h') |
331 | 333 |
|
332 |
| - if not os.path.exists(myconfigh): |
| 334 | + if not os.path.exists(myversionh): |
333 | 335 | log.error("MySQL C API installation invalid "
|
334 |
| - "(my_config.h not found)") |
| 336 | + "(mysql_version.h not found)") |
335 | 337 | sys.exit(1)
|
336 | 338 | else:
|
337 |
| - with open(myconfigh, 'rb') as fp: |
| 339 | + with open(myversionh, 'rb') as fp: |
338 | 340 | for line in fp.readlines():
|
339 |
| - if b'#define VERSION' in line: |
340 |
| - version = tuple([ |
341 |
| - int(v) for v in |
342 |
| - line.split()[2].replace( |
343 |
| - b'"', b'').split(b'.') |
344 |
| - ]) |
| 341 | + if '#define LIBMYSQL_VERSION' in line: |
| 342 | + version = LooseVersion( |
| 343 | + line.split()[2].replace('"', '')).version |
345 | 344 | if version < min_version:
|
346 | 345 | log.error(err_version);
|
347 | 346 | sys.exit(1)
|
|
0 commit comments