summary refs log tree commit diff
diff options
context:
space:
mode:
authorAxel Forsman <axelsfor@gmail.com>2021-06-18 10:43:39 +0200
committerGitHub <noreply@github.com>2021-06-18 10:43:39 +0200
commitd8984f8522529d7e439ecd60c32ad687b7ec951a (patch)
treefd214838d2c012889648736d4af94f1b61a46999
parentff621f0cab6f25b698a942fc9915904a9a125266 (diff)
downloadnixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.tar
nixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.tar.gz
nixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.tar.bz2
nixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.tar.lz
nixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.tar.xz
nixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.tar.zst
nixpkgs-d8984f8522529d7e439ecd60c32ad687b7ec951a.zip
gurobi: 8.1.0 -> 9.1.2 (#120525)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
-rw-r--r--pkgs/applications/science/math/gurobi/default.nix27
-rw-r--r--pkgs/development/python-modules/gurobipy/linux.nix47
-rw-r--r--pkgs/development/python-modules/gurobipy/no-clever-setup.patch24
3 files changed, 42 insertions, 56 deletions
diff --git a/pkgs/applications/science/math/gurobi/default.nix b/pkgs/applications/science/math/gurobi/default.nix
index 2bfeaa00568..91ee7c1c65e 100644
--- a/pkgs/applications/science/math/gurobi/default.nix
+++ b/pkgs/applications/science/math/gurobi/default.nix
@@ -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";
diff --git a/pkgs/development/python-modules/gurobipy/linux.nix b/pkgs/development/python-modules/gurobipy/linux.nix
index d572b10fd62..ebcdc0e73f2 100644
--- a/pkgs/development/python-modules/gurobipy/linux.nix
+++ b/pkgs/development/python-modules/gurobipy/linux.nix
@@ -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" ];
+  };
+}
diff --git a/pkgs/development/python-modules/gurobipy/no-clever-setup.patch b/pkgs/development/python-modules/gurobipy/no-clever-setup.patch
index c71ac7d6863..bcb43a4707b 100644
--- a/pkgs/development/python-modules/gurobipy/no-clever-setup.patch
+++ b/pkgs/development/python-modules/gurobipy/no-clever-setup.patch
@@ -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))
+