Skip to content

Commit

Permalink
yet another fix on release update issue
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 committed Apr 18, 2020
1 parent e15302e commit bff6853
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
15 changes: 3 additions & 12 deletions jill/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ def download_package(version=None, sys=None, arch=None, *,

# allow downloading unregistered releases, e.g., 1.4.0-rc1
do_release_check = not is_full_version(version)

wrong_args = False
try:
version = latest_version(version, system, architecture)
version = latest_version(version, system, architecture, update=True)
except ValueError as e:
# hide the nested error stack :P
wrong_args = True
Expand All @@ -123,19 +124,9 @@ def download_package(version=None, sys=None, arch=None, *,
msg += f"example: jill download 1 linux x86_64"
raise(ValueError(msg))

if architecture in ["ARMv7", "ARMv8"]:
# TODO: fix update functionality for it in version_utils
msg = f"update is disabled for tier-2 support {architecture}"
logging.warning(msg)
print(f"{color.YELLOW}{msg}{color.END}")
update = False
else:
update = True

release_str = f"{version}-{system}-{architecture}"
if do_release_check:
rst = is_version_released(version, system, architecture,
update=update)
rst = is_version_released(version, system, architecture)
if not rst:
msg = f"failed to find Julia release for {release_str}."
logging.info(msg)
Expand Down
2 changes: 1 addition & 1 deletion jill/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def install_julia(version=None, *,

wrong_args = False
try:
version = latest_version(version, system, arch)
version = latest_version(version, system, arch, update=True)
except ValueError as e:
# hide the nested error stack :P
wrong_args = True
Expand Down
19 changes: 16 additions & 3 deletions jill/utils/version_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def is_version_released(version, system, architecture,
if rst:
logging.info(f"get new release {item}")
try:
os.chmod(RELEASE_CONFIGFILE, mode=0o755) # TODO: put this line to the "right" place
# TODO: put this line to the "right" place
os.chmod(RELEASE_CONFIGFILE, mode=0o755)
with open(RELEASE_CONFIGFILE, 'a') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(item)
Expand Down Expand Up @@ -152,6 +153,7 @@ def latest_patch_version(version, system, architecture, **kwargs) -> str:
"""
if version == "latest":
return version

# TODO: this is only useful for ARM, remove it (#16)
if (architecture in ["ARMv7", "ARMv8"] and
not kwargs.get("update", False)):
Expand Down Expand Up @@ -228,15 +230,26 @@ def latest_version(version, system, architecture, update=True, **kwargs) -> str:
if is_full_version(version):
return version

if architecture in ["ARMv7", "ARMv8"]:
# TODO: fix update functionality for it in version_utils
msg = f"update is disabled for tier-2 support {architecture}"
logging.warning(msg)
print(f"{color.YELLOW}{msg}{color.END}")
update = False
else:
update = True

if update:
print(f"query the latest {version} version, it may take seconds...")
if len(version.strip()) == 0:
# if empty string is provided, query the latest version since 1.0.0
return latest_major_version('1', system, architecture, **kwargs)
return latest_major_version('1', system, architecture, update=update, **kwargs)
else:
# TODO: we can also support ^ and > semantics here
f_list = [latest_minor_version,
latest_patch_version]
idx = len(version.split('.')) - 1
return f_list[idx](version, system, architecture, **kwargs)
return f_list[idx](version, system, architecture, update=update, **kwargs)


def sort_releases():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setuptools.setup(
name='jill',
version='0.6.7',
version='0.6.8',
author="Johnny Chen",
author_email="[email protected]",
description="JILL -- Julia Installer for Linux (MacOS, Windows and FreeBSD) -- Light",
Expand Down

0 comments on commit bff6853

Please sign in to comment.