1{ stdenv
2, lib
3, buildPythonPackage
4, django
5, dnspython
6, fetchFromGitHub
7, protobuf
8, pythonOlder
9, fetchpatch
10}:
11
12buildPythonPackage rec {
13 pname = "mysql-connector";
14 version = "8.0.29";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "mysql";
21 repo = "mysql-connector-python";
22 rev = version;
23 hash = "sha256-X0qiXNYkNoR00ESUdByPj4dPnEnjLyopm25lm1JvkAk=";
24 };
25
26 patches = [
27 # mysql-connector overrides MACOSX_DEPLOYMENT_TARGET to 11.
28 # This makes the installation with nixpkgs fail. I suspect, that's
29 # because stdenv.targetPlatform.darwinSdkVersion is (currently) set to
30 # 10.12. The patch reverts
31 # https://github.com/mysql/mysql-connector-python/commit/d1e89fd3d7391084cdf35b0806cb5d2a4b413654
32 ./0001-Revert-Fix-MacOS-wheels-platform-tag.patch
33
34 # Allow for clang to be used to build native extensions
35 (fetchpatch {
36 url = "https://github.com/mysql/mysql-connector-python/commit/fd24ce9dc8c60cc446a8e69458f7851d047c7831.patch";
37 hash = "sha256-WvU1iB53MavCsksKCjGvUl7R3Ww/38alxxMVzjpr5Xg=";
38 })
39 ];
40
41 propagatedBuildInputs = [
42 dnspython
43 protobuf
44 ];
45
46 pythonImportsCheck = [
47 "mysql"
48 ];
49
50 # Tests require a running MySQL instance
51 doCheck = false;
52
53 meta = with lib; {
54 description = "A MySQL driver";
55 longDescription = ''
56 A MySQL driver that does not depend on MySQL C client libraries and
57 implements the DB API v2.0 specification.
58 '';
59 homepage = "https://github.com/mysql/mysql-connector-python";
60 changelog = "https://raw.githubusercontent.com/mysql/mysql-connector-python/${version}/CHANGES.txt";
61 license = licenses.gpl2Only;
62 maintainers = with maintainers; [ neosimsim turion ];
63 };
64}