gurobi: 8.1.0 -> 9.1.2 (#120525)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Axel Forsman 2021-06-18 10:43:39 +02:00 committed by GitHub
parent ff621f0cab
commit d8984f8522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 56 deletions

View file

@ -1,35 +1,28 @@
{ stdenv, lib, fetchurl, autoPatchelfHook, python2 }:
{ stdenv, lib, fetchurl, autoPatchelfHook, python3 }:
let
majorVersion = "8.1";
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "gurobi";
version = "${majorVersion}.0";
version = "9.1.2";
src = with lib; fetchurl {
url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
sha256 = "1yjqbzqnq4jjkjm616d36bgd3rmqr0a1ii17n0prpdjzmdlq63dz";
src = fetchurl {
url = "https://packages.gurobi.com/${lib.versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
sha256 = "7f60bd675f79476bb2b32cd632aa1d470f8246f2b033b7652d8de86f6e7e429b";
};
sourceRoot = "gurobi${builtins.replaceStrings ["."] [""] version}/linux64";
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ (python2.withPackages (ps: [ ps.gurobipy ])) ];
buildInputs = [ (python3.withPackages (ps: [ ps.gurobipy ])) ];
strictDeps = true;
buildPhase = ''
cd src/build
make
cd ../..
'';
makeFlags = [ "--directory=src/build" ];
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin/
rm $out/bin/gurobi.env
rm $out/bin/gurobi.sh
rm $out/bin/python2.7
rm $out/bin/python*
cp lib/gurobi.py $out/bin/gurobi.sh
@ -48,7 +41,7 @@ in stdenv.mkDerivation rec {
ln -s $out/lib/gurobi-javadoc.jar $out/share/java/
'';
passthru.libSuffix = lib.replaceStrings ["."] [""] majorVersion;
passthru.libSuffix = lib.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor version);
meta = with lib; {
description = "Optimization solver for mathematical programming";

View file

@ -1,21 +1,28 @@
{ fetchurl, python }:
assert python.pkgs.isPy27;
{ lib, buildPythonPackage, python, gurobi }:
python.pkgs.buildPythonPackage
{ pname = "gurobipy";
version = "7.5.2";
src = fetchurl
{ url = "http://packages.gurobi.com/7.5/gurobi7.5.2_linux64.tar.gz";
sha256 = "13i1dl22lnmg7z9mb48zl3hy1qnpwdpr0zl2aizda0qnb7my5rnj";
};
setSourceRoot = "sourceRoot=$(echo gurobi*/*64)";
patches = [ ./no-clever-setup.patch ];
postInstall = "mv lib/libaes*.so* lib/libgurobi*.so* $out/lib";
postFixup =
''
patchelf --set-rpath $out/lib \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
patchelf --add-needed libaes75.so \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so
'';
}
buildPythonPackage {
pname = "gurobipy";
version = "9.1.2";
src = gurobi.src;
setSourceRoot = "sourceRoot=$(echo gurobi*/*64)";
patches = [ ./no-clever-setup.patch ];
postInstall = ''
mv lib/libgurobi*.so* $out/lib
'';
postFixup = ''
patchelf --set-rpath $out/lib \
$out/lib/${python.libPrefix}/site-packages/gurobipy/gurobipy.so
'';
meta = with lib; {
description = "The Gurobi Python interface";
homepage = "https://www.gurobi.com";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}

View file

@ -1,7 +1,7 @@
diff -Naur a/setup.py b/setup.py
--- a/setup.py 2017-12-22 10:52:43.730264611 -0500
+++ b/setup.py 2017-12-22 10:53:27.660104199 -0500
@@ -15,30 +15,6 @@
--- a/setup.py 2021-04-24 12:53:18.300255006 -0500
+++ b/setup.py 2021-04-24 12:47:51.619052574 -0500
@@ -15,29 +15,6 @@
from distutils.command.install import install
import os,sys,shutil
@ -13,7 +13,6 @@ diff -Naur a/setup.py b/setup.py
- def finalize_options(self):
- self.cwd = os.path.dirname(os.path.realpath(__file__))
- def run(self):
- assert os.getcwd() == self.cwd, 'Must be run from setup.py directory: %s' % self.cwd
- build_dir = os.path.join(os.getcwd(), "build")
- if os.path.exists(build_dir):
- print('removing %s' % build_dir)
@ -32,24 +31,11 @@ diff -Naur a/setup.py b/setup.py
License = """
This software is covered by the Gurobi End User License Agreement.
By completing the Gurobi installation process and using the software,
@@ -79,20 +55,4 @@
@@ -78,7 +55,5 @@
packages = ['gurobipy'],
package_dir={'gurobipy' : srcpath },
package_data = {'gurobipy' : [srcfile] },
- cmdclass={'install' : GurobiInstall,
- 'clean' : GurobiClean }
)
-
-if os.name == 'posix' and sys.platform == 'darwin': # update Mac paths
- verstr = sys.version[:3]
- default = '/Library/Frameworks/Python.framework/Versions/%s/Python' % verstr
- default = '/System'+default if verstr == '2.7' else default
- modified = sys.prefix + '/Python'
- if default != modified:
- import subprocess
- from distutils.sysconfig import get_python_lib
- sitelib = get_python_lib() + '/gurobipy/gurobipy.so'
- if not os.path.isfile(modified): # Anaconda
- libver = verstr if verstr == '2.7' else verstr+'m'
- modified = sys.prefix + '/lib/libpython%s.dylib' % libver # For Anaconda
- subprocess.call(('install_name_tool', '-change', default, modified, sitelib))