Skip to content

Commit a281b4e

Browse files
committedAug 20, 2015
On Windows always use the new R directory unless that ships
with the installer unless that folder doesn't exist...
1 parent 1fa5632 commit a281b4e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed
 

‎__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def package_requirements():
8181
if not python_module_exists('scipy'):
8282
raise MissingRequirement('scipy')
8383

84-
8584
if system.systemType in ['Microsoft', 'Windows']:
8685
# on Windows the default location of these is relative to the python.exe
8786
pyloc = sys.executable

‎init.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
###############################################################################
3030

3131
import csv
32-
import os
32+
import os, sys
3333
import shutil
3434
import subprocess
3535
import copy
@@ -1897,17 +1897,21 @@ def initialize():
18971897
utils.importOSGEO()
18981898
utils.createLogger(session_dir, configuration.verbose)
18991899

1900-
utils.set_r_path(configuration.r_path)
1901-
if not os.path.exists(utils.get_r_path()) and \
1902-
system.systemType in ['Microsoft', 'Windows']:
1903-
# they don't have a decent R path, let's see if we can pull one from the
1904-
utils.set_r_path(utils.pull_R_install_from_reg())
1905-
configuration.r_path = utils.get_r_path()
1906-
configuration.set_deep_value('r_path', configuration.r_path)
1900+
if system.systemType in ['Microsoft', 'Windows']:
1901+
# we're on a windows box, they probably installed VisTrails, R, and SAHM
1902+
# using the prebuilt msi, let's make sure they're using the supplied R
1903+
base_dir = os.path.split(os.path.split(sys.executable)[0])[0]
1904+
default_r_dname = r"Central_R\R-3.2.0\bin"
1905+
r_path = os.path.join(base_dir, default_r_dname)
1906+
if os.path.exists(r_path):
1907+
configuration.r_path = utils.get_r_path()
1908+
configuration.set_deep_value('r_path', configuration.r_path)
19071909

1908-
package_manager = get_package_manager()
1909-
package = package_manager.get_package(identifier)
1910-
package.persist_configuration()
1910+
package_manager = get_package_manager()
1911+
package = package_manager.get_package(identifier)
1912+
package.persist_configuration()
1913+
1914+
utils.set_r_path(configuration.r_path)
19111915

19121916
try:
19131917
testfname = os.path.join(utils.get_r_path(), "CanSAHMWriteToR.txt")

0 commit comments

Comments
 (0)
Please sign in to comment.