Merge pull request #297437 from wegank/gurobipy-darwin-bump

python312Packages.gurobipy: 7.5.2 -> 11.0.1 (darwin)
This commit is contained in:
Weijia Wang 2024-03-21 00:40:39 +01:00 committed by GitHub
commit 2bb3dc3add
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 37 deletions

View File

@ -1,33 +1,49 @@
{ fetchurl, python, xar, cpio, cctools, insert_dylib }:
assert python.pkgs.isPy27 && python.ucsEncoding == 2;
python.pkgs.buildPythonPackage
{ pname = "gurobipy";
version = "7.5.2";
src = fetchurl
{ url = "http://packages.gurobi.com/7.5/gurobi7.5.2_mac64.pkg";
sha256 = "10zgn8741x48xjdiknj59x66mwj1azhihi1j5a1ajxi2n5fsak2h";
};
buildInputs = [ xar cpio cctools insert_dylib ];
unpackPhase =
''
xar -xf $src
zcat gurobi*mac64tar.pkg/Payload | cpio -i
tar xf gurobi*_mac64.tar.gz
sourceRoot=$(echo gurobi*/*64)
runHook postUnpack
'';
patches = [ ./no-clever-setup.patch ];
postInstall = "mv lib/lib*.so $out/lib";
postFixup =
''
install_name_tool -change \
/System/Library/Frameworks/Python.framework/Versions/2.7/Python \
${python}/lib/libpython2.7.dylib \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
install_name_tool -change /Library/gurobi752/mac64/lib/libgurobi75.so \
$out/lib/libgurobi75.so \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
insert_dylib --inplace $out/lib/libaes75.so \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
'';
}
{
lib,
stdenv,
buildPythonPackage,
python,
fetchPypi,
}:
let
format = "wheel";
pyShortVersion = "cp" + builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
platforms = rec {
aarch64-darwin = "macosx_10_9_universal2";
x86_64-darwin = aarch64-darwin;
};
platform = platforms.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
hashes = rec {
cp311-aarch64-darwin = "sha256-pMwq4TXvr0mrKxZppeW2MQE/KrplWWFGmjKRLKwbHCI=";
cp311-x86_64-darwin = cp311-aarch64-darwin;
cp312-aarch64-darwin = "sha256-5+1QxYOhjbs01S3gqhkQ9Bx/0/NhbXEi710BGpiC5kM=";
cp312-x86_64-darwin = cp312-aarch64-darwin;
};
hash =
hashes."${pyShortVersion}-${stdenv.system}"
or (throw "Unsupported Python version: ${python.pythonVersion}");
in
buildPythonPackage rec {
pname = "gurobipy";
version = "11.0.1";
inherit format;
src = fetchPypi {
inherit pname version;
python = pyShortVersion;
abi = pyShortVersion;
dist = pyShortVersion;
inherit format platform hash;
};
pythonImportsCheck = [ "gurobipy" ];
meta = {
description = "Python interface to Gurobi";
homepage = "https://www.gurobi.com";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ wegank ];
platforms = builtins.attrNames platforms;
};
}

View File

@ -5118,10 +5118,8 @@ self: super: with self; {
guppy3 = callPackage ../development/python-modules/guppy3 { };
gurobipy = if stdenv.hostPlatform.system == "x86_64-darwin" then
callPackage ../development/python-modules/gurobipy/darwin.nix {
inherit (pkgs.darwin) cctools insert_dylib;
}
gurobipy = if stdenv.hostPlatform.isDarwin then
callPackage ../development/python-modules/gurobipy/darwin.nix { }
else if stdenv.hostPlatform.system == "x86_64-linux" then
callPackage ../development/python-modules/gurobipy/linux.nix { }
else