Skip to content

Commit bcd91fd

Browse files
author
Cuong Duong
committed
formatting
1 parent 8ae7970 commit bcd91fd

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

cmdstanpy/install_cmdstan.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
from cmdstanpy import _DOT_CMDSTAN, _DOT_CMDSTANPY
3434
from cmdstanpy.utils import get_logger, pushd, validate_dir, wrap_progress_hook
3535

36-
MAKE = os.getenv("MAKE", "make" if platform.system() != "Windows" else "mingw32-make")
36+
MAKE = os.getenv(
37+
'MAKE', 'make' if platform.system() != 'Windows' else 'mingw32-make'
38+
)
3739
EXTENSION = '.exe' if platform.system() == 'Windows' else ''
3840

3941

@@ -64,8 +66,8 @@ def usage() -> None:
6466
print(msg)
6567

6668

67-
def clear(verbose: bool = False) -> None:
68-
cmd = [MAKE, "clean-all"]
69+
def clean_all(verbose: bool = False) -> None:
70+
cmd = [MAKE, 'clean-all']
6971
proc = subprocess.Popen(
7072
cmd,
7173
cwd=None,
@@ -76,19 +78,19 @@ def clear(verbose: bool = False) -> None:
7678
)
7779
while proc.poll() is None:
7880
if proc.stdout:
79-
output = proc.stdout.readline().decode("utf-8").strip()
81+
output = proc.stdout.readline().decode('utf-8').strip()
8082
if verbose and output:
8183
print(output, flush=True)
8284
_, stderr = proc.communicate()
8385
if proc.returncode:
8486
msgs = ['Command "make clean-all" failed']
8587
if stderr:
86-
msgs.append(stderr.decode("utf-8").strip())
87-
raise CmdStanInstallError("\n".join(msgs))
88+
msgs.append(stderr.decode('utf-8').strip())
89+
raise CmdStanInstallError('\n'.join(msgs))
8890

8991

9092
def build(verbose: bool = False) -> None:
91-
cmd = [MAKE, "build"]
93+
cmd = [MAKE, 'build']
9294
proc = subprocess.Popen(
9395
cmd,
9496
cwd=None,
@@ -99,27 +101,26 @@ def build(verbose: bool = False) -> None:
99101
)
100102
while proc.poll() is None:
101103
if proc.stdout:
102-
103-
output = proc.stdout.readline().decode("utf-8").strip()
104+
output = proc.stdout.readline().decode('utf-8').strip()
104105
if verbose and output:
105106
print(output, flush=True)
106107
_, stderr = proc.communicate()
107108
if proc.returncode:
108109
msgs = ['Command "make build" failed']
109110
if stderr:
110-
msgs.append(stderr.decode("utf-8").strip())
111-
raise CmdStanInstallError("\n".join(msgs))
112-
if not os.path.exists(os.path.join("bin", "stansummary" + EXTENSION)):
111+
msgs.append(stderr.decode('utf-8').strip())
112+
raise CmdStanInstallError('\n'.join(msgs))
113+
if not os.path.exists(os.path.join('bin', 'stansummary' + EXTENSION)):
113114
raise CmdStanInstallError(
114-
f"bin/stansummary{EXTENSION} not found"
115-
", please rebuild or report a bug!"
115+
f'bin/stansummary{EXTENSION} not found'
116+
', please rebuild or report a bug!'
116117
)
117-
if not os.path.exists(os.path.join("bin", "diagnose" + EXTENSION)):
118+
if not os.path.exists(os.path.join('bin', 'diagnose' + EXTENSION)):
118119
raise CmdStanInstallError(
119-
f"bin/stansummary{EXTENSION} not found"
120-
", please rebuild or report a bug!"
120+
f'bin/stansummary{EXTENSION} not found'
121+
', please rebuild or report a bug!'
121122
)
122-
if platform.system() == "Windows":
123+
if platform.system() == 'Windows':
123124
# Add tbb to the $PATH on Windows
124125
libtbb = os.path.join(
125126
os.getcwd(), 'stan', 'lib', 'stan_math', 'lib', 'tbb'
@@ -133,7 +134,7 @@ def build(verbose: bool = False) -> None:
133134
)
134135

135136

136-
def test():
137+
def compile_example():
137138
cmd = [
138139
MAKE,
139140
Path(
@@ -178,11 +179,11 @@ def install_version(
178179
'Overwrite requested, remove existing build of version '
179180
'{}'.format(cmdstan_version)
180181
)
181-
clear(verbose)
182+
clean_all(verbose)
182183
print('Rebuilding version {}'.format(cmdstan_version))
183184
build(verbose)
184185
print('Test model compilation')
185-
test()
186+
compile_example()
186187
print('Installed {}'.format(cmdstan_version))
187188

188189

0 commit comments

Comments
 (0)