Skip to content

Commit

Permalink
always allow trying mosek_cli (#966)
Browse files Browse the repository at this point in the history
* closes #963
* allow gpkit_build to be run from another directory
* don't assume a mosek_bin_dir was found
  • Loading branch information
bqpd authored Dec 2, 2016
1 parent 72202dd commit d1c9591
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
5 changes: 3 additions & 2 deletions gpkit/_mosek/cli_expopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def imize_fn(path=None, clearfiles=True):
if not path:
path = tempfile.mkdtemp()
filename = path + os.sep + "gpkit_mosek"
os.environ['PATH'] = (os.environ['PATH'] + ':%s' %
settings["mosek_bin_dir"])
if "mosek_bin_dir" in settings:
os.environ['PATH'] = ":".join([os.environ['PATH'],
settings["mosek_bin_dir"]])

# pylint: disable=unused-argument
def imize(c, A, p_idxs, *args, **kwargs):
Expand Down
17 changes: 7 additions & 10 deletions gpkit/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import shutil
import subprocess
import glob
import platform

LOGSTR = ""
settings = {}
Expand Down Expand Up @@ -100,13 +99,6 @@ class MosekCLI(SolverBackend):

def look(self):
"Attempts to run mskexpopt."

if sys.platform == "win32":
## does not work on 32-bit windows ##
log("# Build script does not support mosek_cli"
" your architecture (%s)" % platform.architecture()[0])
return

try:
log("# Trying to run mskexpopt...")
if call("mskexpopt") in (1052, 28): # 28 for MacOSX
Expand All @@ -121,7 +113,7 @@ class CVXopt(SolverBackend):
name = "cvxopt"

def look(self):
"Attempts to import mskexpopt."
"Attempts to import cvxopt."
try:
log("# Trying to import cvxopt...")
# Testing the import, so the variable is intentionally not used
Expand Down Expand Up @@ -279,7 +271,12 @@ def build(self):

def build_gpkit():
"Builds GPkit"
global settings # pylint: disable=global-variable-not-assigned
try:
import gpkit
log("# Moving to the directory from which GPkit was imported.")
os.chdir(gpkit.__path__[0])
except ImportError:
pass

if isfile("__init__.py"):
#call("ls")
Expand Down
2 changes: 1 addition & 1 deletion gpkit/nomials/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class NomialArray(np.ndarray):
__repr__ = _repr
_repr_latex_ = _repr_latex_

def str_without(self, excluded=()):
def str_without(self, excluded=None):
"Returns string without certain fields (such as 'models')."
if self.shape:
return "[" + ", ".join([try_str_without(el, excluded)
Expand Down

0 comments on commit d1c9591

Please sign in to comment.