gurobipy: Bump to 7.5.2

This commit is contained in:
Shea Levy 2017-12-22 11:43:09 -05:00
parent 73a0d95b96
commit 02efc7600b
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
4 changed files with 67 additions and 31 deletions

View File

@ -1,10 +1,10 @@
{ fetchurl, python, xar, cpio, cctools, insert_dylib }: { fetchurl, python, xar, cpio, cctools, insert_dylib }:
assert python.pkgs.isPy27 && python.ucsEncoding == 2; assert python.pkgs.isPy27 && python.ucsEncoding == 2;
python.pkgs.buildPythonPackage python.pkgs.buildPythonPackage
{ name = "gurobipy-7.0.2"; { name = "gurobipy-7.5.2";
src = fetchurl src = fetchurl
{ url = "http://packages.gurobi.com/7.0/gurobi7.0.2_mac64.pkg"; { url = "http://packages.gurobi.com/7.5/gurobi7.5.2_mac64.pkg";
sha256 = "14dpxas6gx02kfb28i0fh68p1z4sbjmwg8hp8h5ch6c701h260mg"; sha256 = "10zgn8741x48xjdiknj59x66mwj1azhihi1j5a1ajxi2n5fsak2h";
}; };
buildInputs = [ xar cpio cctools insert_dylib ]; buildInputs = [ xar cpio cctools insert_dylib ];
unpackPhase = unpackPhase =
@ -15,7 +15,7 @@ python.pkgs.buildPythonPackage
sourceRoot=$(echo gurobi*/*64) sourceRoot=$(echo gurobi*/*64)
runHook postUnpack runHook postUnpack
''; '';
patches = [ ./no-darwin-fixup.patch ]; patches = [ ./no-clever-setup.patch ];
postInstall = "mv lib/lib*.so $out/lib"; postInstall = "mv lib/lib*.so $out/lib";
postFixup = postFixup =
'' ''
@ -23,10 +23,10 @@ python.pkgs.buildPythonPackage
/System/Library/Frameworks/Python.framework/Versions/2.7/Python \ /System/Library/Frameworks/Python.framework/Versions/2.7/Python \
${python}/lib/libpython2.7.dylib \ ${python}/lib/libpython2.7.dylib \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so $out/lib/python2.7/site-packages/gurobipy/gurobipy.so
install_name_tool -change libgurobi70.so \ install_name_tool -change /Library/gurobi752/mac64/lib/libgurobi75.so \
$out/lib/libgurobi70.so \ $out/lib/libgurobi75.so \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.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 $out/lib/python2.7/site-packages/gurobipy/gurobipy.so
''; '';
} }

View File

@ -5,18 +5,19 @@ let utf =
else if python.ucsEncoding == 4 then "32" else if python.ucsEncoding == 4 then "32"
else throw "Unsupported python UCS encoding UCS${toString python.ucsEncoding}"; else throw "Unsupported python UCS encoding UCS${toString python.ucsEncoding}";
in python.pkgs.buildPythonPackage in python.pkgs.buildPythonPackage
{ name = "gurobipy-7.0.2"; { name = "gurobipy-7.5.2";
src = fetchurl src = fetchurl
{ url = "http://packages.gurobi.com/7.0/gurobi7.0.2_linux64.tar.gz"; { url = "http://packages.gurobi.com/7.5/gurobi7.5.2_linux64.tar.gz";
sha256 = "1lgdj4cncjvnnw8dppiax7q2j8121pxyg9iryj8v26mrk778dnmn"; sha256 = "13i1dl22lnmg7z9mb48zl3hy1qnpwdpr0zl2aizda0qnb7my5rnj";
}; };
setSourceRoot = "sourceRoot=$(echo gurobi*/*64)"; setSourceRoot = "sourceRoot=$(echo gurobi*/*64)";
patches = [ ./no-clever-setup.patch ];
postInstall = "mv lib/libaes*.so* lib/libgurobi*.so* $out/lib"; postInstall = "mv lib/libaes*.so* lib/libgurobi*.so* $out/lib";
postFixup = postFixup =
'' ''
patchelf --set-rpath $out/lib \ patchelf --set-rpath $out/lib \
$out/lib/python2.7/site-packages/gurobipy/gurobipy.so $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 $out/lib/python2.7/site-packages/gurobipy/gurobipy.so
''; '';
} }

View File

@ -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))

View File

@ -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))