From 6ddc30aa2b0c2aa56f3d465cdd13ea74ae8f2361 Mon Sep 17 00:00:00 2001 From: snow-fox Date: Tue, 27 Feb 2024 21:01:40 +0000 Subject: [PATCH] revert to autoinstall --- pyproject.toml | 3 --- src/python/roms/__init__.py | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 59fe70531..96d395881 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,9 +51,6 @@ homepage = "https://github.com/mgbellemare/Arcade-Learning-Environment" documentation = "https://github.com/mgbellemare/Arcade-Learning-Environment/tree/master/docs" changelog = "https://github.com/mgbellemare/Arcade-Learning-Environment/blob/master/CHANGELOG.md" -[project.scripts] -ale-accept-license-install-roms = "ale_py.roms:_download_roms" - [tool.setuptools] packages = [ "ale_py", diff --git a/src/python/roms/__init__.py b/src/python/roms/__init__.py index 683aaf73b..700c9513e 100644 --- a/src/python/roms/__init__.py +++ b/src/python/roms/__init__.py @@ -5,6 +5,7 @@ import hashlib import json import tarfile +import time import warnings from pathlib import Path @@ -84,17 +85,17 @@ def get_rom_path(name: str) -> Path | None: warnings.warn(f"Rom {name} not supported.") return None - if bin_path.exists(): - # if the path exists, just return it - return bin_path - else: - # if it doesn't exist, prompt the user to download it, just quit here. + # if the bin_path doesn't exist, we assume the user already has the license and just download the roms + if not bin_path.exists(): print( - f"Looks like the rom {name} could not be found. " - "To install all roms, please run `ale-accept-license-install-roms` " - "to accept the license agreement and install all available roms." + f"Looks like the rom {name} could not be found, it may not have been downloaded. " + "\nWe will install all roms in the next 5 seconds, and we assume that you have accepted the license agreement beforehand. " ) - exit() + time.sleep(5) + _download_roms() + + # return the path + return bin_path def get_all_rom_ids() -> list[str]: