Bug #78621 building C API extension is done in install phase instead of build phase
Submitted: 29 Sep 2015 9:17 Modified: 16 Dec 2022 19:34
Reporter: Arek M Email Updates:
Status: Closed 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] Arek M
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$
[16 Dec 2022 18:37] Nuno Mariz
Posted by developer:
 
This issue was fixed in the release 8.0.22 by WL#13997.
Thank you for your bug report.
[16 Dec 2022 19:34] Arek M
Thanks but I'm confused by "Not a bug" and "Fixed" at the same time.