Skip to content

Commit 53d663c

Browse files
authored
Merge pull request #460 from stan-dev/use_shortpath_and_cleanup
use shortpath and cleanup
2 parents be34adb + b55d6af commit 53d663c

File tree

4 files changed

+7
-35
lines changed

4 files changed

+7
-35
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
3636
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3737
NOT_CRAN: true
38+
CMDSTAN_VERSION: "2.26.1"
3839

3940
steps:
4041
- uses: n1hility/cancel-previous-runs@v2
@@ -91,7 +92,7 @@ jobs:
9192
install.packages("posterior", repos = c("https://mc-stan.org/r-packages/", getOption("repos")), type="source")
9293
install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")), type="source")
9394
install.packages("curl")
94-
cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE)
95+
cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE, version = Sys.getenv("CMDSTAN_VERSION"))
9596
shell: Rscript {0}
9697

9798
- name: Session info

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
* Fixed issue with retrieving draws with models with spaces in their names. (#453)
66

7+
* Fixed bug with spaces in path to the temporary folder on Windows. (#460)
8+
79
### New features
810

911
* New function `as_cmdstan_fit()` that creates CmdStanMCMC/MLE/VB objects
@@ -22,7 +24,6 @@ Stan programs requires CmdStan >= 2.26. (#434)
2224

2325
* New check for invalid parameter names when supplying init values. (#452)
2426

25-
2627
# cmdstanr 0.3.0
2728

2829
### Bug fixes

R/install.R

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -158,27 +158,6 @@ install_cmdstan <- function(dir = NULL,
158158
append = TRUE
159159
)
160160
}
161-
if (version < "2.24") {
162-
# disable warnings cmdstan <= 2.23 prints with RTools 4.0 on Windows
163-
cmdstan_make_local(
164-
dir = dir_cmdstan,
165-
cpp_options = list(
166-
"ifeq (gcc,$(CXX_TYPE))",
167-
"CXXFLAGS_WARNINGS+= -Wno-int-in-bool-context -Wno-attributes",
168-
"endif"
169-
),
170-
append = TRUE
171-
)
172-
}
173-
if (version > "2.22" && version < "2.24") {
174-
# cmdstan 2.23 unnecessarily required chmod after moving the windows-stanc
175-
# this moves the exe file so the make command that requires chmod is not used
176-
windows_stanc <- file.path(dir_cmdstan, "bin", "windows-stanc")
177-
bin_stanc_exe <- file.path(dir_cmdstan, "bin", "stanc.exe")
178-
if (file.exists(windows_stanc)) {
179-
file.copy(windows_stanc, bin_stanc_exe)
180-
}
181-
}
182161
}
183162
# Setting up native M1 compilation of CmdStan and its downstream libraries
184163
if (is_rosetta2()) {
@@ -189,18 +168,6 @@ install_cmdstan <- function(dir = NULL,
189168
),
190169
append = TRUE
191170
)
192-
try(
193-
suppressWarnings({
194-
macos_inc <- "https://raw.githubusercontent.com/stan-dev/math/92fce0218c9fb15fd405ef031f488cad05c5546b/lib/tbb_2019_U8/build/macos.inc"
195-
dest_macos_inc <- file.path(dir_cmdstan, "stan", "lib", "stan_math", "lib", "tbb_2019_U8", "build", "macos.inc")
196-
file.remove(dest_macos_inc)
197-
utils::download.file(url = macos_inc,
198-
destfile = dest_macos_inc,
199-
quiet = quiet,
200-
headers = github_auth_token())
201-
}),
202-
silent = TRUE
203-
)
204171
}
205172

206173
message("* Building CmdStan binaries...")

R/model.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ compile <- function(quiet = TRUE,
434434
file.copy(self$stan_file(), temp_stan_file, overwrite = TRUE)
435435
temp_file_no_ext <- strip_ext(temp_stan_file)
436436
tmp_exe <- cmdstan_ext(temp_file_no_ext) # adds .exe on Windows
437+
if(os_is_windows()) {
438+
tmp_exe <- utils::shortPathName(tmp_exe)
439+
}
437440
private$hpp_file_ <- paste0(temp_file_no_ext, ".hpp")
438441

439442
# add path to the TBB library to the PATH variable to avoid copying the dll file

0 commit comments

Comments
 (0)