Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions easybuild/easyblocks/g/gurobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,25 @@ def __init__(self, *args, **kwargs):
"""Easyblock constructor, define custom class variables specific to Gurobi."""
super(EB_Gurobi, self).__init__(*args, **kwargs)

self.license_file = self.cfg['license_file']
# make sure license file is available
self.orig_license_file = self.cfg['license_file']
if self.orig_license_file is None:
self.orig_license_file = os.getenv('EB_GUROBI_LICENSE_FILE', None)

if self.cfg['copy_license_file']:
self.license_file = os.path.join(self.installdir, 'gurobi.lic')
else:
self.license_file = self.orig_license_file

def install_step(self):
"""Install Gurobi and license file."""

# make sure license file is available
if self.cfg['license_file'] is None or not os.path.exists(self.cfg['license_file']):
raise EasyBuildError("No existing license file specified: %s", self.cfg['license_file'])

super(EB_Gurobi, self).install_step()

if self.cfg['copy_license_file']:
copy_file(self.cfg['license_file'], self.license_file)
if self.orig_license_file is None or not os.path.exists(self.orig_license_file):
raise EasyBuildError("No existing license file specified: %s", self.orig_license_file)

copy_file(self.orig_license_file, self.license_file)

if get_software_root('Python'):
run_cmd("python setup.py install --prefix=%s" % self.installdir)
Expand Down