1 diff -Naur a/setup.py b/setup.py
2 --- a/setup.py 2017-12-22 10:52:43.730264611 -0500
3 +++ b/setup.py 2017-12-22 10:53:27.660104199 -0500
5 from distutils.command.install import install
8 -class GurobiClean(Command):
9 - description = "remove the build directory"
11 - def initialize_options(self):
13 - def finalize_options(self):
14 - self.cwd = os.path.dirname(os.path.realpath(__file__))
16 - assert os.getcwd() == self.cwd, 'Must be run from setup.py directory: %s' % self.cwd
17 - build_dir = os.path.join(os.getcwd(), "build")
18 - if os.path.exists(build_dir):
19 - print('removing %s' % build_dir)
20 - shutil.rmtree(build_dir)
22 -class GurobiInstall(install):
24 - # Calls the default run command, then deletes the build area
25 - # (equivalent to "setup clean --all").
28 - c = GurobiClean(self.distribution)
29 - c.finalize_options()
33 This software is covered by the Gurobi End User License Agreement.
34 By completing the Gurobi installation process and using the software,
36 packages = ['gurobipy'],
37 package_dir={'gurobipy' : srcpath },
38 package_data = {'gurobipy' : [srcfile] },
39 - cmdclass={'install' : GurobiInstall,
40 - 'clean' : GurobiClean }
43 -if os.name == 'posix' and sys.platform == 'darwin': # update Mac paths
44 - verstr = sys.version[:3]
45 - default = '/Library/Frameworks/Python.framework/Versions/%s/Python' % verstr
46 - default = '/System'+default if verstr == '2.7' else default
47 - modified = sys.prefix + '/Python'
48 - if default != modified:
50 - from distutils.sysconfig import get_python_lib
51 - sitelib = get_python_lib() + '/gurobipy/gurobipy.so'
52 - if not os.path.isfile(modified): # Anaconda
53 - libver = verstr if verstr == '2.7' else verstr+'m'
54 - modified = sys.prefix + '/lib/libpython%s.dylib' % libver # For Anaconda
55 - subprocess.call(('install_name_tool', '-change', default, modified, sitelib))