From 8f8ecb7b940b330b8e2763757f834f85b94e988d Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Fri, 19 Aug 2022 12:58:34 -0400 Subject: [PATCH] [O] Make readline optional --- hyfetch/main.py | 10 ++++++---- setup.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hyfetch/main.py b/hyfetch/main.py index 799382fc..ecfaf3cc 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -1,10 +1,6 @@ #!/usr/bin/env python3 from __future__ import annotations -# Do not delete import readline. Even though it's not used in the code, importing it would allow -# arrow keys to be used in input() functions. -import readline - import argparse import json import random @@ -321,6 +317,12 @@ def create_config() -> Config: def run(): + # Optional: Import readline + try: + import readline + except ModuleNotFoundError: + pass + # Create CLI hyfetch = color('&b&lhyfetch&r') parser = argparse.ArgumentParser(description=color(f'{hyfetch} - neofetch with flags <3')) diff --git a/setup.py b/setup.py index d1dba475..0dff0bfc 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ setup( packages=['hyfetch'], package_data={'hyfetch': ['hyfetch/*']}, include_package_data=True, - install_requires=['setuptools', 'typing_extensions', 'pyreadline'], + install_requires=['setuptools', 'typing_extensions'], entry_points={ "console_scripts": [ "hyfetch=hyfetch.main:run",