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