_rtools
Windows Rtools management. Split into focused functions.
Attributes¶
RTOOLS_VERSIONS = {(4, 0): '40', (4, 2): '42', (4, 3): '43', (4, 4): '44', (4, 5): '45', (4, 6): '46', (4, 7): '47', (4, 8): '48'}
module-attribute
¶
RTOOLS_SUBDIRS = [os.path.join('usr', 'bin'), os.path.join('mingw64', 'bin')]
module-attribute
¶
RTOOLS_FALLBACK_URLS = {'40': 'https://cran.r-project.org/bin/windows/Rtools/rtools40-x86_64.exe', '42': 'https://cran.r-project.org/bin/windows/Rtools/rtools42/files/rtools42-5355-5357.exe', '43': 'https://cran.r-project.org/bin/windows/Rtools/rtools43/files/rtools43-5976-5975.exe', '44': 'https://cran.r-project.org/bin/windows/Rtools/rtools44/files/rtools44-6459-6401.exe', '45': 'https://cran.r-project.org/bin/windows/Rtools/rtools45/files/rtools45-6691-6492.exe'}
module-attribute
¶
RTOOLS_BASE = 'https://cran.r-project.org/bin/windows/Rtools'
module-attribute
¶
Functions¶
get_arch()
¶
Returns 'x86_64' or 'arm64'.
get_os()
¶
Returns 'linux', 'macos', or 'windows'.
log_warning(msg, method_name=None)
¶
Log a warning message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
str
|
The warning message to log |
required |
method_name
|
str
|
The name of the method/function. If None, will auto-detect from call stack. |
None
|
Source code in brmspy/helpers/log.py
_windows_drives()
¶
Return a list of existing drive roots like ['C:\', 'D:\', ...].
Source code in brmspy/_runtime/_rtools.py
_candidate_rtools_paths()
¶
Generate all plausible Rtools bin paths across all drives.
Source code in brmspy/_runtime/_rtools.py
get_required_version(r_version)
¶
Map R version to required Rtools version.
Source code in brmspy/_runtime/_rtools.py
_discover_rtools_installer(rtools_version, timeout=10.0, aarch64=False)
¶
Try to discover the latest Rtools installer .exe from the CRAN directory index.
Looks at:
https://cran.r-project.org/bin/windows/Rtools/rtools{version}/files/
and picks the newest-looking rtools{version}-*.exe.
If aarch64 is True, prefer the -aarch64- installer.
Otherwise prefer the x86_64 installer and avoid the aarch64 one.
Source code in brmspy/_runtime/_rtools.py
get_download_url(rtools_version)
¶
Get download URL for Rtools version.
Source code in brmspy/_runtime/_rtools.py
is_installed()
¶
Check if Rtools is installed (make + mingw g++ on PATH).
Source code in brmspy/_runtime/_rtools.py
get_installed_gxx_version()
¶
Get g++ version from Rtools.
Source code in brmspy/_runtime/_rtools.py
_stream_download(url, dst, timeout=30)
¶
Download URL to dst in chunks, verifying size if Content-Length is present.
Source code in brmspy/_runtime/_rtools.py
download_installer(rtools_version, max_retries=3)
¶
Download Rtools installer to temp directory with retries and size check.
Source code in brmspy/_runtime/_rtools.py
run_installer(installer, rtools_version, silent=True)
¶
Run Rtools installer safely on Windows and CI.
Source code in brmspy/_runtime/_rtools.py
update_paths()
¶
Update PATH in both Python os.environ and R Sys.setenv.
Source code in brmspy/_runtime/_rtools.py
ensure_installed()
¶
Orchestrator: ensure Rtools is installed for current R. Downloads and installs if needed. Updates paths.