2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2022-05-18 14:49:53 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, django
|
|
|
|
, dnspython
|
|
|
|
, fetchFromGitHub
|
|
|
|
, protobuf
|
|
|
|
, pythonOlder
|
2023-10-09 19:29:22 +00:00
|
|
|
, mysql80
|
|
|
|
, openssl
|
|
|
|
, pkgs
|
2022-05-18 14:49:53 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "mysql-connector";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "8.0.33";
|
2022-05-18 14:49:53 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
setupPyBuildFlags = [
|
|
|
|
"--with-mysql-capi=\"${mysql80}\""
|
|
|
|
"--with-openssl-include-dir=\"${openssl.dev}/include\""
|
|
|
|
"--with-openssl-lib-dir=\"${lib.getLib openssl}/lib\""
|
|
|
|
"-L \"${lib.getLib pkgs.zstd}/lib:${lib.getLib mysql80}/lib\""
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mysql";
|
|
|
|
repo = "mysql-connector-python";
|
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-GtMq7E2qBqFu54hjUotzPyxScTKXNdEQcmgHnS7lBhc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
patches = [
|
|
|
|
# mysql-connector overrides MACOSX_DEPLOYMENT_TARGET to 11.
|
|
|
|
# This makes the installation with nixpkgs fail. I suspect, that's
|
2024-01-02 11:29:13 +00:00
|
|
|
# because stdenv.hostPlatform.darwinSdkVersion is (currently) set to
|
2021-09-18 10:52:07 +00:00
|
|
|
# 10.12. The patch reverts
|
|
|
|
# https://github.com/mysql/mysql-connector-python/commit/d1e89fd3d7391084cdf35b0806cb5d2a4b413654
|
|
|
|
./0001-Revert-Fix-MacOS-wheels-platform-tag.patch
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
mysql80
|
2021-09-18 10:52:07 +00:00
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
dnspython
|
|
|
|
protobuf
|
2023-10-09 19:29:22 +00:00
|
|
|
mysql80
|
|
|
|
openssl
|
|
|
|
pkgs.zstd
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"mysql"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
# Tests require a running MySQL instance
|
|
|
|
doCheck = false;
|
2021-04-22 02:08:21 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A MySQL driver";
|
|
|
|
longDescription = ''
|
|
|
|
A MySQL driver that does not depend on MySQL C client libraries and
|
|
|
|
implements the DB API v2.0 specification.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/mysql/mysql-connector-python";
|
2020-05-03 17:38:23 +00:00
|
|
|
changelog = "https://raw.githubusercontent.com/mysql/mysql-connector-python/${version}/CHANGES.txt";
|
2022-05-18 14:49:53 +00:00
|
|
|
license = licenses.gpl2Only;
|
|
|
|
maintainers = with maintainers; [ neosimsim turion ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|