]>
Commit | Line | Data |
---|---|---|
befdbee2 AM |
1 | # TODO: |
2 | # - c extension build is done in install phase (http://bugs.mysql.com/bug.php?id=78621) | |
d75aefec ER |
3 | # |
4 | # Conditional build: | |
8ac2eab1 AM |
5 | %bcond_with tests # build with tests (requires mysql server) |
6 | %bcond_without python2 # build without python2 | |
d75aefec ER |
7 | %bcond_without python3 # build without python3 |
8 | ||
9 | %define pname mysql-connector | |
10 | Summary: The MySQL Client/Protocol implemented in Python | |
782f4144 | 11 | Name: python-%{pname} |
43242fad | 12 | # check documentation to see which version is GA (we don't want devel releases) |
41a350af | 13 | # https://dev.mysql.com/downloads/connector/python/ |
0ca036a1 AM |
14 | Version: 8.0.12 |
15 | Release: 1 | |
782f4144 AM |
16 | License: GPL v2 |
17 | Group: Libraries/Python | |
33174d16 | 18 | Source0: http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-%{version}.zip |
0ca036a1 | 19 | # Source0-md5: 356f20fd899837178f7719e54095d2ae |
81c16330 | 20 | Patch0: 32bit.patch |
8ac2eab1 AM |
21 | Patch1: binary-bug-90585.patch |
22 | Patch2: tests.patch | |
33174d16 | 23 | URL: http://dev.mysql.com/doc/connector-python/en/ |
befdbee2 | 24 | BuildRequires: mysql-devel |
f1568111 | 25 | BuildRequires: protobuf-devel |
8ac2eab1 | 26 | %if %{with python2} |
befdbee2 | 27 | BuildRequires: python-devel |
782f4144 | 28 | BuildRequires: python-modules |
8ac2eab1 AM |
29 | %endif |
30 | %if %{with python3} | |
31 | BuildRequires: python3-devel | |
32 | BuildRequires: python3-modules | |
33 | %endif | |
782f4144 | 34 | BuildRequires: rpm-pythonprov |
f1568111 | 35 | BuildRequires: rpmbuild(macros) >= 1.710 |
8ac2eab1 AM |
36 | %if %{with tests} |
37 | BuildRequires: mysql | |
38 | %endif | |
43242fad | 39 | Requires: python-modules |
782f4144 AM |
40 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
41 | ||
42 | %description | |
43 | MySQL Connector/Python is implementing the MySQL Client/Server | |
44 | protocol completely in Python. No MySQL libraries are needed, and no | |
45 | compilation is necessary to run this Python DB API v2.0 compliant | |
46 | driver. An interface to the popular MySQL database server for Python. | |
47 | ||
48 | %package -n python3-%{pname} | |
d75aefec | 49 | Summary: The MySQL Client/Protocol implemented in Python |
782f4144 | 50 | Group: Development/Languages/Python |
43242fad | 51 | Requires: python3-modules |
782f4144 AM |
52 | |
53 | %description -n python3-%{pname} | |
54 | MySQL Connector/Python is implementing the MySQL Client/Server | |
55 | protocol completely in Python. No MySQL libraries are needed, and no | |
56 | compilation is necessary to run this Python DB API v2.0 compliant | |
57 | driver. An interface to the popular MySQL database server for Python. | |
58 | ||
59 | %prep | |
33174d16 | 60 | %setup -q -n mysql-connector-python-%{version} |
81c16330 | 61 | %patch0 -p1 |
8ac2eab1 AM |
62 | %patch1 -p1 |
63 | %patch2 -p1 | |
782f4144 AM |
64 | |
65 | %build | |
f1568111 AM |
66 | export MYSQLXPB_PROTOC=%{_bindir}/protoc |
67 | export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir} | |
68 | export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir} | |
69 | ||
8ac2eab1 | 70 | %if %{with python2} |
0d49b37d | 71 | %py_build |
8ac2eab1 AM |
72 | %if %{with tests} |
73 | export PYTHONPATH="$(pwd)/$(ls -1d build-2/lib*)" | |
74 | %{__python} unittests.py \ | |
75 | --verbosity 1 \ | |
76 | --keep --stats \ | |
77 | --skip-install \ | |
78 | --with-mysql=%{_prefix} \ | |
79 | --with-mysql-share=%{_datadir}/mysql | |
80 | %endif | |
81 | %endif | |
d75aefec ER |
82 | |
83 | %if %{with python3} | |
0d49b37d | 84 | %py3_build |
8ac2eab1 AM |
85 | %if %{with tests} |
86 | export PYTHONPATH="$(pwd)/$(ls -1d build-3/lib*)" | |
87 | %{__python3} unittests.py \ | |
88 | --verbosity 1 \ | |
89 | --keep --stats \ | |
90 | --skip-install \ | |
91 | --with-mysql=%{_prefix} \ | |
92 | --with-mysql-share=%{_datadir}/mysql | |
93 | %endif | |
d75aefec | 94 | %endif |
782f4144 AM |
95 | |
96 | %install | |
97 | rm -rf $RPM_BUILD_ROOT | |
98 | ||
f1568111 AM |
99 | # see NOTE on beginning of the spec |
100 | export MYSQLXPB_PROTOC=%{_bindir}/protoc | |
101 | export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir} | |
102 | export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir} | |
103 | ||
8ac2eab1 | 104 | %if %{with python2} |
2ed20bfc AM |
105 | %py_install \ |
106 | --with-mysql-capi=%{_prefix} | |
782f4144 | 107 | %py_postclean |
8ac2eab1 | 108 | %endif |
782f4144 | 109 | |
d75aefec | 110 | %if %{with python3} |
2ed20bfc AM |
111 | %py3_install \ |
112 | --with-mysql-capi=%{_prefix} | |
d75aefec | 113 | %endif |
782f4144 AM |
114 | |
115 | %clean | |
116 | rm -rf $RPM_BUILD_ROOT | |
117 | ||
8ac2eab1 | 118 | %if %{with python2} |
782f4144 AM |
119 | %files |
120 | %defattr(644,root,root,755) | |
5a951d91 | 121 | %doc CHANGES.txt README.txt |
befdbee2 AM |
122 | %attr(755,root,root) %{py_sitedir}/_mysql_connector.so |
123 | %dir %{py_sitedir}/mysql | |
124 | %{py_sitedir}/mysql/*.py[co] | |
125 | %dir %{py_sitedir}/mysql/connector | |
126 | %{py_sitedir}/mysql/connector/*.py[co] | |
127 | %dir %{py_sitedir}/mysql/connector/django | |
128 | %{py_sitedir}/mysql/connector/django/*.py[co] | |
befdbee2 AM |
129 | %dir %{py_sitedir}/mysql/connector/locales |
130 | %{py_sitedir}/mysql/connector/locales/*.py[co] | |
131 | %dir %{py_sitedir}/mysql/connector/locales/eng | |
132 | %{py_sitedir}/mysql/connector/locales/eng/*.py[co] | |
50013483 AM |
133 | %dir %{py_sitedir}/mysqlx |
134 | %{py_sitedir}/mysqlx/*.py[co] | |
135 | %dir %{py_sitedir}/mysqlx/protobuf | |
136 | %{py_sitedir}/mysqlx/protobuf/*.py[co] | |
137 | %dir %{py_sitedir}/mysqlx/locales | |
138 | %{py_sitedir}/mysqlx/locales/*.py[co] | |
139 | %dir %{py_sitedir}/mysqlx/locales/eng | |
140 | %{py_sitedir}/mysqlx/locales/eng/*.py[co] | |
d75aefec | 141 | %if "%{py_ver}" > "2.4" |
befdbee2 | 142 | %{py_sitedir}/mysql_connector_python-*.egg-info |
d75aefec | 143 | %endif |
8ac2eab1 | 144 | %endif |
782f4144 | 145 | |
d75aefec | 146 | %if %{with python3} |
782f4144 AM |
147 | %files -n python3-%{pname} |
148 | %defattr(644,root,root,755) | |
5a951d91 | 149 | %doc CHANGES.txt README.txt |
befdbee2 AM |
150 | %attr(755,root,root) %{py3_sitedir}/_mysql_connector.cpython-*.so |
151 | %{py3_sitedir}/mysql*.egg-info | |
152 | %dir %{py3_sitedir}/mysql | |
153 | %{py3_sitedir}/mysql/*.py | |
154 | %dir %{py3_sitedir}/mysql/__pycache__ | |
155 | %{py3_sitedir}/mysql/__pycache__/*.py[co] | |
156 | %dir %{py3_sitedir}/mysql/connector | |
157 | %{py3_sitedir}/mysql/connector/*.py | |
158 | %dir %{py3_sitedir}/mysql/connector/__pycache__ | |
159 | %{py3_sitedir}/mysql/connector/__pycache__/*.py[co] | |
160 | %dir %{py3_sitedir}/mysql/connector/django | |
161 | %{py3_sitedir}/mysql/connector/django/*.py | |
162 | %dir %{py3_sitedir}/mysql/connector/django/__pycache__ | |
163 | %{py3_sitedir}/mysql/connector/django/__pycache__/*.py[co] | |
befdbee2 AM |
164 | %dir %{py3_sitedir}/mysql/connector/locales |
165 | %{py3_sitedir}/mysql/connector/locales/*.py | |
166 | %dir %{py3_sitedir}/mysql/connector/locales/__pycache__ | |
167 | %{py3_sitedir}/mysql/connector/locales/__pycache__/*.py[co] | |
168 | %dir %{py3_sitedir}/mysql/connector/locales/eng | |
169 | %{py3_sitedir}/mysql/connector/locales/eng/*.py | |
170 | %dir %{py3_sitedir}/mysql/connector/locales/eng/__pycache__ | |
171 | %{py3_sitedir}/mysql/connector/locales/eng/__pycache__/*.py[co] | |
50013483 AM |
172 | %dir %{py3_sitedir}/mysqlx |
173 | %{py3_sitedir}/mysqlx/*.py | |
174 | %dir %{py3_sitedir}/mysqlx/__pycache__ | |
175 | %{py3_sitedir}/mysqlx/__pycache__/*.py[co] | |
176 | %dir %{py3_sitedir}/mysqlx/locales | |
177 | %{py3_sitedir}/mysqlx/locales/*.py | |
178 | %dir %{py3_sitedir}/mysqlx/locales/__pycache__ | |
179 | %{py3_sitedir}/mysqlx/locales/__pycache__/*.py[co] | |
180 | %dir %{py3_sitedir}/mysqlx/locales/eng | |
181 | %{py3_sitedir}/mysqlx/locales/eng/*.py | |
182 | %dir %{py3_sitedir}/mysqlx/locales/eng/__pycache__ | |
183 | %{py3_sitedir}/mysqlx/locales/eng/__pycache__/*.py[co] | |
184 | %dir %{py3_sitedir}/mysqlx/protobuf | |
185 | %{py3_sitedir}/mysqlx/protobuf/*.py | |
186 | %dir %{py3_sitedir}/mysqlx/protobuf/__pycache__ | |
187 | %{py3_sitedir}/mysqlx/protobuf/__pycache__/*.py[co] | |
d75aefec | 188 | %endif |