From 02efc7600b831ec78231dc075c9ba37e70fec3c2 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 22 Dec 2017 11:43:09 -0500 Subject: [PATCH] gurobipy: Bump to 7.5.2 --- .../python-modules/gurobipy/darwin.nix | 14 ++--- .../python-modules/gurobipy/linux.nix | 9 +-- .../gurobipy/no-clever-setup.patch | 55 +++++++++++++++++++ .../gurobipy/no-darwin-fixup.patch | 20 ------- 4 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 pkgs/development/python-modules/gurobipy/no-clever-setup.patch delete mode 100644 pkgs/development/python-modules/gurobipy/no-darwin-fixup.patch diff --git a/pkgs/development/python-modules/gurobipy/darwin.nix b/pkgs/development/python-modules/gurobipy/darwin.nix index f5f06058fc75..65bec7d8b12e 100644 --- a/pkgs/development/python-modules/gurobipy/darwin.nix +++ b/pkgs/development/python-modules/gurobipy/darwin.nix @@ -1,10 +1,10 @@ { fetchurl, python, xar, cpio, cctools, insert_dylib }: assert python.pkgs.isPy27 && python.ucsEncoding == 2; python.pkgs.buildPythonPackage - { name = "gurobipy-7.0.2"; + { name = "gurobipy-7.5.2"; src = fetchurl - { url = "http://packages.gurobi.com/7.0/gurobi7.0.2_mac64.pkg"; - sha256 = "14dpxas6gx02kfb28i0fh68p1z4sbjmwg8hp8h5ch6c701h260mg"; + { url = "http://packages.gurobi.com/7.5/gurobi7.5.2_mac64.pkg"; + sha256 = "10zgn8741x48xjdiknj59x66mwj1azhihi1j5a1ajxi2n5fsak2h"; }; buildInputs = [ xar cpio cctools insert_dylib ]; unpackPhase = @@ -15,7 +15,7 @@ python.pkgs.buildPythonPackage sourceRoot=$(echo gurobi*/*64) runHook postUnpack ''; - patches = [ ./no-darwin-fixup.patch ]; + patches = [ ./no-clever-setup.patch ]; postInstall = "mv lib/lib*.so $out/lib"; postFixup = '' @@ -23,10 +23,10 @@ python.pkgs.buildPythonPackage /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 libgurobi70.so \ - $out/lib/libgurobi70.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/libaes70.so \ + insert_dylib --inplace $out/lib/libaes75.so \ $out/lib/python2.7/site-packages/gurobipy/gurobipy.so ''; } diff --git a/pkgs/development/python-modules/gurobipy/linux.nix b/pkgs/development/python-modules/gurobipy/linux.nix index 5010415d2c64..d78eff0b47a0 100644 --- a/pkgs/development/python-modules/gurobipy/linux.nix +++ b/pkgs/development/python-modules/gurobipy/linux.nix @@ -5,18 +5,19 @@ let utf = else if python.ucsEncoding == 4 then "32" else throw "Unsupported python UCS encoding UCS${toString python.ucsEncoding}"; in python.pkgs.buildPythonPackage - { name = "gurobipy-7.0.2"; + { name = "gurobipy-7.5.2"; src = fetchurl - { url = "http://packages.gurobi.com/7.0/gurobi7.0.2_linux64.tar.gz"; - sha256 = "1lgdj4cncjvnnw8dppiax7q2j8121pxyg9iryj8v26mrk778dnmn"; + { 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 libaes70.so \ + patchelf --add-needed libaes75.so \ $out/lib/python2.7/site-packages/gurobipy/gurobipy.so ''; } diff --git a/pkgs/development/python-modules/gurobipy/no-clever-setup.patch b/pkgs/development/python-modules/gurobipy/no-clever-setup.patch new file mode 100644 index 000000000000..c71ac7d68632 --- /dev/null +++ b/pkgs/development/python-modules/gurobipy/no-clever-setup.patch @@ -0,0 +1,55 @@ +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 @@ + from distutils.command.install import install + import os,sys,shutil + +-class GurobiClean(Command): +- description = "remove the build directory" +- user_options = [] +- def initialize_options(self): +- self.cwd = None +- 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) +- shutil.rmtree(build_dir) +- +-class GurobiInstall(install): +- +- # Calls the default run command, then deletes the build area +- # (equivalent to "setup clean --all"). +- def run(self): +- install.run(self) +- c = GurobiClean(self.distribution) +- c.finalize_options() +- c.run() +- + 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 @@ + 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)) diff --git a/pkgs/development/python-modules/gurobipy/no-darwin-fixup.patch b/pkgs/development/python-modules/gurobipy/no-darwin-fixup.patch deleted file mode 100644 index c1ed8cb48886..000000000000 --- a/pkgs/development/python-modules/gurobipy/no-darwin-fixup.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -Naur a/setup.py b/setup.py ---- a/setup.py 2017-12-18 12:48:02.000000000 -0500 -+++ b/setup.py 2017-12-18 12:48:43.000000000 -0500 -@@ -54,16 +54,3 @@ - package_dir={'gurobipy' : srcpath }, - package_data = {'gurobipy' : [srcfile] } - ) -- --if sys.platform == 'darwin': -- from distutils.sysconfig import get_python_lib -- import subprocess -- import os.path -- sitelib = get_python_lib() + '/gurobipy/gurobipy.so' -- subprocess.call(('install_name_tool', '-change', 'libgurobi70.so', '/Library/gurobi702/mac64/lib/libgurobi70.so', sitelib)) # version for change -- default = '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' -- modified = sys.prefix + '/Python' -- if default != modified: -- if not os.path.isfile(modified): -- modified = sys.prefix + '/lib/libpython2.7.dylib' # For Anaconda -- subprocess.call(('install_name_tool', '-change', default, modified, sitelib))