spack/var/spack/repos/builtin/packages/py-mysql-connector/single-version.patch
Elizabeth Fischer 82e9c01b5c New package: py-mysql-connector (#10327)
* 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:

https://github.com/mysql/mysql-connector-python/pull/9

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

* Clean up / reorder lines

* flake8
2019-03-12 20:52:43 -05:00

23 lines
863 B
Diff

diff --git a/lib/cpy_distutils.py b/lib/cpy_distutils.py
index a9132e5..3cffee6 100644
--- a/lib/cpy_distutils.py
+++ b/lib/cpy_distutils.py
@@ -29,9 +29,14 @@
"""Implements the DistUtils command 'build_ext'
"""
-from distutils.command.build_ext import build_ext
-from distutils.command.install import install
-from distutils.command.install_lib import install_lib
+try:
+ from setuptools.command.build_ext import build_ext
+ from setuptools.command.install import install
+ from setuptools.command.install_lib import install_lib
+except ImportError:
+ from distutils.command.build_ext import build_ext
+ from distutils.command.install import install
+ from distutils.command.install_lib import install_lib
from distutils.errors import DistutilsExecError
from distutils.util import get_platform
from distutils.version import LooseVersion