Skip to content

Commit 9127da9

Browse files
author
Christopher Doris
committed
install
1 parent 7f48586 commit 9127da9

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

juliacall/install.py

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def all_julia_versions():
2929
}
3030

3131
def get_os():
32-
os = platform.system()
32+
os = platform.system().lower()
3333
return os_aliases.get(os.lower(), os)
3434

3535
arch_aliases = {
@@ -39,7 +39,7 @@ def get_os():
3939
}
4040

4141
def get_arch():
42-
arch = platform.machine()
42+
arch = platform.machine().lower()
4343
return arch_aliases.get(arch.lower(), arch)
4444

4545
def compatible_julia_versions(compat=None, stable=True, kind=None):
@@ -82,31 +82,27 @@ def compatible_julia_versions(compat=None, stable=True, kind=None):
8282
raise Exception(f'multiple matching triplets {sorted(triplets)} - this is a bug, please report')
8383
return ans
8484

85-
def best_julia_version(*args, **kwargs):
86-
vers = compatible_julia_versions(*args, **kwargs)
85+
def install_julia(vers, prefix):
8786
if not vers:
88-
raise ValueError('no compatible Julia version found')
89-
v = sorted(vers.keys(), key=Version)[-1]
90-
return v, vers[v]
91-
92-
def install_julia(ver, prefix):
93-
for f in ver['files']:
94-
url = f['url']
95-
if url.endswith('.tar.gz'):
96-
installer = install_julia_tar
97-
elif url.endswith('.zip'):
98-
installer = install_julia_zip
99-
elif url.endswith('.dmg'):
100-
installer = install_julia_dmg
101-
else:
102-
continue
103-
buf = download_julia(f)
104-
print(f'Installing Julia to {prefix}')
105-
if os.path.exists(prefix):
106-
shutil.rmtree(prefix)
107-
installer(f, buf, prefix)
108-
return
109-
raise ValueError('no installable Julia version found')
87+
raise Exception('no compatible Julia version found')
88+
for v in sorted(vers.keys(), key=Version, reverse=True):
89+
for f in vers[v]['files']:
90+
url = f['url']
91+
if url.endswith('.tar.gz'):
92+
installer = install_julia_tar
93+
elif url.endswith('.zip'):
94+
installer = install_julia_zip
95+
elif url.endswith('.dmg'):
96+
installer = install_julia_dmg
97+
else:
98+
continue
99+
buf = download_julia(f)
100+
print(f'Installing Julia to {prefix}')
101+
if os.path.exists(prefix):
102+
shutil.rmtree(prefix)
103+
installer(f, buf, prefix)
104+
return
105+
raise Exception('no installable Julia version found')
110106

111107
def download_julia(f):
112108
url = f['url']

0 commit comments

Comments
 (0)