Skip to content

Conversation

posita
Copy link

@posita posita commented Nov 21, 2015

This patch fixes the following problem when installing using certain versions of pip/setuptools (attempted on Debian jessie):

vagrant@bad:~$ git clone https://github.com/mysql/mysql-connector-python.git mysql-mysql-connector-python
Cloning into 'mysql-mysql-connector-python'...
remote: Counting objects: 1560, done.
remote: Total 1560 (delta 0), reused 0 (delta 0), pack-reused 1559
Receiving objects: 100% (1560/1560), 675.71 KiB | 685.00 KiB/s, done.
Resolving deltas: 100% (913/913), done.
Checking connectivity... done.
vagrant@bad:~$ python -m virtualenv ./test-mysql-connectorRunning virtualenv with interpreter /usr/bin/python2
New python executable in ./test-mysql-connector/bin/python2
Also creating executable in ./test-mysql-connector/bin/python
Installing setuptools, pip...done.
vagrant@bad:~$ ./test-mysql-connector/bin/pip install ./mysql-mysql-connector-python
Unpacking ./mysql-mysql-connector-python
  Running setup.py (path:/tmp/pip-Ln020b-build/setup.py) egg_info for package from file:///home/vagrant/mysql-mysql-connector-python

Installing collected packages: mysql-connector-python
  Running setup.py install for mysql-connector-python
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --single-version-externally-managed not recognized
    Complete output from command /home/vagrant/test-mysql-connector/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-Ln020b-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-eXmiqs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/test-mysql-connector/include/site/python2.7:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: -c --help [cmd1 cmd2 ...]

   or: -c --help-commands

   or: -c cmd --help



error: option --single-version-externally-managed not recognized

----------------------------------------
Cleaning up...
Command /home/vagrant/test-mysql-connector/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-Ln020b-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-eXmiqs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/test-mysql-connector/include/site/python2.7 failed with error code 1 in /tmp/pip-Ln020b-build
Storing debug log for failure in /home/vagrant/.pip/pip.log

This patch uses a similar technique to llvmlite (explained here). After the patch:

vagrant@bad:~$ git clone --branch posita/fix-broken-use-of-distutils https://github.com/posita/mysql-connector-python.git posita-mysql-connector-python Cloning into 'posita-mysql-connector-python'...
remote: Counting objects: 1564, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 1564 (delta 0), reused 0 (delta 0), pack-reused 1559
Receiving objects: 100% (1564/1564), 682.01 KiB | 899.00 KiB/s, done.
Resolving deltas: 100% (913/913), done.
Checking connectivity... done.
vagrant@bad:~$ python -m virtualenv ./test-mysql-connector-fixed
Running virtualenv with interpreter /usr/bin/python2
New python executable in ./test-mysql-connector-fixed/bin/python2
Also creating executable in ./test-mysql-connector-fixed/bin/python
Installing setuptools, pip...done.
vagrant@bad:~$ ./test-mysql-connector-fixed/bin/pip install ./posita-mysql-connector-python
Unpacking ./posita-mysql-connector-python
  Running setup.py (path:/tmp/pip-iwmOVU-build/setup.py) egg_info for package from file:///home/vagrant/posita-mysql-connector-python

Installing collected packages: mysql-connector-python
  Running setup.py install for mysql-connector-python
    Not Installing C Extension

Successfully installed mysql-connector-python
Cleaning up...

@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

@posita
Copy link
Author

posita commented Nov 22, 2015

oca-405177-signed.pdf

oca-405177-signed.pdf.asc:

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iEYEABECAAYFAlZSPAoACgkQnLpDzL5I7l9l2QCffnHRThb3SNTzFBWmh4hjQiAN
gswAn3s2VCAT8l7i7Fbr7t/fUFtf1JCK
=WFDj
-----END PGP SIGNATURE-----

@posita
Copy link
Author

posita commented Nov 23, 2015

Begin forwarded message:

From: ... < mtb19 at columbia dot edu >
Subject: Re: OCA Re: #9
Date: November 23, 2015 at 08:05:27 PST
To: ... < ... at oracle dot com >

Hi ...,

Thanks for getting back to me. The OCA as written only benefits Oracle. Contributors receive nothing in return. More specifically, it does not provide any protections for contributors.

If contributors are required to assign all rights to Oracle, Oracle needs to take all the responsibility off their plates too. That means Oracle needs to indemnify contributors and hold them harmless for any harm their patches might cause in the context of Oracle's software. I'm not interested in Oracle or any of Oracle's users coming back and suing me because what I wrote harmed them in some unpredictable way. I don't mind striking the paragraph I added, but Oracle needs to provide some alternate protection here. It's not fair to take all the upside and leave contributors with all the downside.

If you can't find a solution to this, then please close the patch and have one of your developers author a similar fix herself. You already have a release from me that would more than cover you under those circumstances.

Thanks, and I look forward to hearing from you.

Hello ...,

On Nov 23, 2015, at 06:45, ... < ... at oracle dot com > wrote:

...

thank you for your OCA. However I cannot process / approve that since there is additional paragraph added by you. This paragraph is in conflict with our legal rules and thus I cannot approve that as it is. Can you please remove the paragraph and send that to me once more? Once received I will make sure it’s processed asap in order to approve your GitHub contribution as well.

Please let me know if you have any further questions.
thank you,
...

@mysql-oca-bot
Copy link

Hi, there was no response to our request to sign an OCA or confirm the code is submitted under the terms of the OCA. As such this request will be closed.
Thanks

@posita
Copy link
Author

posita commented Dec 23, 2015

If you won't accept my patch and assume responsibility for it, then please ask one of your engineers to fix this independently. It's still a bug.

@coryvirok
Copy link

Thanks for this patch @posita. It's unfortunate that they didn't merge it in. Hopefully Oracle will get their act together and fix this ASAP.

In case anyone else lands here and is trying to find a solution to this problem, I found another workaround which doesn't require a code change.

rm -rf ~/.cache/pip
pip install --upgrade pip
pip install wheel
pip install mysql-connector-python-2.1.3.tar.gz

mysql-connector installs properly if it's installed using bdist_wheel.

i.e. Make sure you see this in your pip install output:

...
Running setup.py bdist_wheel for mysql-connector-python ... done
...

@posita
Copy link
Author

posita commented Jun 14, 2016

That's true, @coryvirok, upgrading pip will address this issue. That approach has been discussed on MySQL's bug tracker, which I forgot to link to from this PR. Unfortunately, it doesn't seem to be a priority, and their OCA is too draconian for me to feel comfortable signing (they basically take ownership of the intellectual property, but I can still be sued if they distribute it and it causes harm).

@posita posita deleted the posita/fix-broken-use-of-distutils branch December 14, 2016 06:20
citibeth pushed a commit to citibeth/spack that referenced this pull request Jan 21, 2019
mysql/mysql-connector-python#9

Uncommenting this patch will make `error: option --single-version-externally-managed not recognized`  reappear.
adamjstewart pushed a commit to spack/spack that referenced this pull request Mar 13, 2019
* New package: py-mysql-connector

* Fixed docstring

* 1. Determined that py-setuptools was not needed at all, so removed.
2. Added py-protobuf.  Docs seem to imply that only C protobuf library is required; however, the Python setup.py says differently, and some Python code seems to reference protobuf too.  I don't know why this worked for me, but it looks like including py-protobuf is the right thing to do.

* Applied solution detailed in:

mysql/mysql-connector-python#9

Uncommenting this patch will make `error: option --single-version-externally-managed not recognized`  reappear.

* Clean up / reorder lines

* flake8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants