Skip to content

Commit

Permalink
fixes for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bqpd committed Sep 9, 2019
1 parent 34313b0 commit bd1f124
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions gpkit/_mosek/expopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class ModuleShortener(object):
module : str
Module to be shortened (the first "MSK" object above)
"""
def __init__(self, stub, module):
self.module = module
def __init__(self, stub, *modules):
self.modules = modules
self.stub = stub

def __getattr__(self, attribute):
Expand All @@ -48,7 +48,11 @@ def __getattr__(self, attribute):
-------
attribute from self.module
"""
return getattr(self.module, self.stub + attribute)
for module in self.modules:
try:
return getattr(module, self.stub + attribute)
except AttributeError:
pass


# below is MSKsolsta_enum from mosek.h
Expand Down Expand Up @@ -89,7 +93,8 @@ def c_array(py_array, c_type):
return (c_type * len(pya))(*pya)


MSK = ModuleShortener("MSK", load_library(settings["mosek_bin_path"]))
MSK = ModuleShortener("MSK", load_library(settings["mosek_lib_path"]),
load_library(settings["mosek_gpkitbin_path"]))
MSK_RES_OK = 0
if settings["mosek_version"] == "7":
MSK_IPAR_INTPNT_MAX_ITERATIONS = 28
Expand Down
3 changes: 2 additions & 1 deletion gpkit/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def look(self): # pylint: disable=too-many-return-statements
for expopt_file in self.expopt_files:
if not isfile(expopt_file):
return None
settings["mosek_lib_path"] = self.lib_path
settings["mosek_bin_dir"] = self.bin_dir
settings["mosek_version"] = self.version
os.environ['PATH'] = os.environ['PATH'] + os.pathsep + self.bin_dir
Expand Down Expand Up @@ -260,7 +261,7 @@ def build(self):
+ " @executable_path/libmosek64.8.1.dylib "
+ pathjoin(self.bin_dir, "mskexpopt"))

settings["mosek_bin_path"] = pathjoin(solib_dir, "expopt.so")
settings["mosek_gpkitbin_path"] = pathjoin(solib_dir, "expopt.so")

if built_expopt_lib != 0:
return False
Expand Down

0 comments on commit bd1f124

Please sign in to comment.