Bug #75520 Connector/Python version checker does not like nonnumeric suffixes
Submitted: 15 Jan 2015 18:21 Modified: 30 Mar 2015 15:28
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:2.1.1 OS:Any
Assigned to: CPU Architecture:Any

[15 Jan 2015 18:21] Paul DuBois
Description:
During the build process, if the --with-mysql-api option is given, C/Py checks the MySQL version number, and fails if the final version component has nonnumeric characters.

How to repeat:
My installed version of MySQL is "5.7.6-m16"

% python setup.py build_ext --with-mysql-capi=/usr/local/mysql
running build_ext
Traceback (most recent call last):
  File "setup.py", line 64, in <module>
    ext_modules=setupinfo.extensions,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 971, in run_command
    cmd_obj.ensure_finalized()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "/src/extern/MySQL/mysql-git/connector-python/lib/cpy_distutils.py", line 327, in finalize_options
    self._finalize_connector_c(self.with_mysql_capi)
  File "/src/extern/MySQL/mysql-git/connector-python/lib/cpy_distutils.py", line 289, in _finalize_connector_c
    myc_info = get_mysql_config_info(mysql_config)
  File "/src/extern/MySQL/mysql-git/connector-python/lib/cpy_distutils.py", line 147, in get_mysql_config_info
    info['version'] = tuple([int(v) for v in info['version'].split('.')[0:3]])
ValueError: invalid literal for int() with base 10: '6-m16'

If I point --with-mysql-capi at my 5.6.24 installation, it works, presumably because that version number has no nonnumeric suffix.

Suggested fix:
Version splitter needs to be a little smarter?
[30 Mar 2015 15:28] Paul DuBois
Noted in 2.1.12 changelog.

The Connector/Python version checker for MySQL did not handle
nonnumeric suffixes. During the build process, if the
--with-mysql-api option was given, the check failed for installed
versions of MySQL such as 5.7.6-m16.