Bug #78621 building C API extension is done in install phase instead of build phase
Submitted: 29 Sep 2015 9:17 Modified: 10 Mar 2016 7:44
Reporter: Arkadiusz Miskiewicz Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:2.1.3 OS:Any
Assigned to: CPU Architecture:Any

[29 Sep 2015 9:17] Arkadiusz Miskiewicz
Description:
One of correct ways to build python extension is to use:

python setup.py build

That should build all what's needed.

Then installation is done by:

python setup.py install

Unfortunately mysql-python-connector does crazy thing as building C extension in install phase instead of doing that in build phase.

That means that it is not possible to only build connector, example:

How to repeat:
That means that it is not possible to only build connector (without installing), example:

mysql-connector-python-2.1.3]$ python setup.py build  --with-mysql-capi=/usr
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --with-mysql-capi not recognized

Suggested fix:
Move mysql capi building into build phase and make install do installation ONLY 

(there are dependencies that make install dependand on build, so if user does install only then build still will be called - that way current documented method of installation will work).

Every sane Linux distribution (for example) distinguishes build and install phases when building their packages (deb, rpm based ones etc). So build and install need to be clearly separated.
[10 Mar 2016 7:44] Chiranjeevi Battula
Hello  Arkadiusz Miskiewicz,

Thank you for the bug report.
Verified this behavior on MySQL Connector/Python 2.1.3.

Thanks,
Chiranjeevi.
[10 Mar 2016 7:44] Chiranjeevi Battula
output :
chiran@chiran-VirtualBox:~/mysql-connector-python$ 
chiran@chiran-VirtualBox:~/mysql-connector-python$ sudo python setup.py build  --with-mysql-capi=/usr
[sudo] password for chiran: 
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --with-mysql-capi not recognized
chiran@chiran-VirtualBox:~/mysql-connector-python$