@@ -242,9 +242,7 @@ def get_install_package_manager(on_failure_return_none: bool = False) -> str | N
242
242
The path to the package manager.
243
243
"""
244
244
if constants .IS_WINDOWS and (
245
- not is_windows_bun_supported ()
246
- or windows_check_onedrive_in_path ()
247
- or windows_npm_escape_hatch ()
245
+ windows_check_onedrive_in_path () or windows_npm_escape_hatch ()
248
246
):
249
247
return get_package_manager (on_failure_return_none )
250
248
return str (get_config ().bun_path )
@@ -1064,17 +1062,11 @@ def install_bun():
1064
1062
Raises:
1065
1063
SystemPackageMissingError: If "unzip" is missing.
1066
1064
"""
1067
- win_supported = is_windows_bun_supported ()
1068
1065
one_drive_in_path = windows_check_onedrive_in_path ()
1069
- if constants .IS_WINDOWS and (not win_supported or one_drive_in_path ):
1070
- if not win_supported :
1071
- console .warn (
1072
- "Bun for Windows is currently only available for x86 64-bit Windows. Installation will fall back on npm."
1073
- )
1074
- if one_drive_in_path :
1075
- console .warn (
1076
- "Creating project directories in OneDrive is not recommended for bun usage on windows. This will fallback to npm."
1077
- )
1066
+ if constants .IS_WINDOWS and one_drive_in_path :
1067
+ console .warn (
1068
+ "Creating project directories in OneDrive is not recommended for bun usage on windows. This will fallback to npm."
1069
+ )
1078
1070
1079
1071
# Skip if bun is already installed.
1080
1072
if get_bun_version () == version .parse (constants .Bun .VERSION ):
@@ -1176,12 +1168,7 @@ def install_frontend_packages(packages: set[str], config: Config):
1176
1168
get_package_manager (on_failure_return_none = True )
1177
1169
if (
1178
1170
not constants .IS_WINDOWS
1179
- or (
1180
- constants .IS_WINDOWS
1181
- and (
1182
- is_windows_bun_supported () and not windows_check_onedrive_in_path ()
1183
- )
1184
- )
1171
+ or (constants .IS_WINDOWS and not windows_check_onedrive_in_path ())
1185
1172
)
1186
1173
else None
1187
1174
)
@@ -1926,24 +1913,23 @@ def format_address_width(address_width: str | None) -> int | None:
1926
1913
return None
1927
1914
1928
1915
1929
- @functools .lru_cache (maxsize = None )
1930
- def get_cpu_info () -> CpuInfo | None :
1931
- """Get the CPU info of the underlining host.
1916
+ def _retrieve_cpu_info () -> CpuInfo | None :
1917
+ """Retrieve the CPU info of the host.
1932
1918
1933
1919
Returns:
1934
- The CPU info.
1920
+ The CPU info.
1935
1921
"""
1936
1922
platform_os = platform .system ()
1937
1923
cpuinfo = {}
1938
1924
try :
1939
1925
if platform_os == "Windows" :
1940
- cmd = "wmic cpu get addresswidth,caption,manufacturer /FORMAT:csv"
1926
+ cmd = 'powershell -Command "Get-CimInstance Win32_Processor | Select-Object -First 1 | Select-Object AddressWidth,Manufacturer,Name | ConvertTo-Json"'
1941
1927
output = processes .execute_command_and_return_output (cmd )
1942
1928
if output :
1943
- val = output . splitlines ()[ - 1 ]. split ( "," )[ 1 :]
1944
- cpuinfo ["manufacturer_id " ] = val [ 2 ]
1945
- cpuinfo ["model_name " ] = val [ 1 ]. split ( "Family" )[ 0 ]. strip ()
1946
- cpuinfo ["address_width " ] = format_address_width ( val [ 0 ])
1929
+ cpu_data = json . loads ( output )
1930
+ cpuinfo ["address_width " ] = cpu_data [ "AddressWidth" ]
1931
+ cpuinfo ["manufacturer_id " ] = cpu_data [ "Manufacturer" ]
1932
+ cpuinfo ["model_name " ] = cpu_data [ "Name" ]
1947
1933
elif platform_os == "Linux" :
1948
1934
output = processes .execute_command_and_return_output ("lscpu" )
1949
1935
if output :
@@ -1983,21 +1969,20 @@ def get_cpu_info() -> CpuInfo | None:
1983
1969
1984
1970
1985
1971
@functools .lru_cache (maxsize = None )
1986
- def is_windows_bun_supported () -> bool :
1987
- """Check whether the underlining host running windows qualifies to run bun.
1988
- We typically do not run bun on ARM or 32 bit devices that use windows.
1972
+ def get_cpu_info () -> CpuInfo | None :
1973
+ """Get the CPU info of the underlining host.
1989
1974
1990
1975
Returns:
1991
- Whether the host is qualified to use bun .
1976
+ The CPU info .
1992
1977
"""
1993
- cpu_info = get_cpu_info ()
1994
- return (
1995
- constants . IS_WINDOWS
1996
- and cpu_info is not None
1997
- and cpu_info . address_width == 64
1998
- and cpu_info . model_name is not None
1999
- and "ARM" not in cpu_info . model_name
2000
- )
1978
+ cpu_info_file = environment . REFLEX_DIR . get () / "cpu_info.json"
1979
+ if cpu_info_file . exists () and ( cpu_info := json . loads ( cpu_info_file . read_text ())):
1980
+ return CpuInfo ( ** cpu_info )
1981
+ cpu_info = _retrieve_cpu_info ()
1982
+ if cpu_info :
1983
+ cpu_info_file . parent . mkdir ( parents = True , exist_ok = True )
1984
+ cpu_info_file . write_text ( json . dumps ( dataclasses . asdict ( cpu_info )))
1985
+ return cpu_info
2001
1986
2002
1987
2003
1988
def is_generation_hash (template : str ) -> bool :
0 commit comments