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