diff --git a/eris/eris/__main__.py b/eris/eris/__main__.py index 741e61f..9ac6b5b 100755 --- a/eris/eris/__main__.py +++ b/eris/eris/__main__.py @@ -50,6 +50,7 @@ Usage: eris [options] eris -h | --help eris -i | --info + eris -a | --apt-install-tools Example: # eris my_project @@ -57,6 +58,7 @@ Example: Options: -h, --help Show the full help. -i, --info Show information about the available tools. + -a, --apt-install-tools Install all tools. Ubuntu only. -w COUNT, --workers=COUNT The number of processes working in parallel. By default it is the number of cpus minus 1. -e "COMMAND", --editor="COMMAND" The command used to start the editor, in @@ -1137,6 +1139,10 @@ def check_arguments(): sys.exit(1) os.environ["ERIS_CONFIG"] = config_path import eris.tools as tools + if arguments["--apt-install-tools"]: + subprocess.run(["sudo", "apt", "-y", "install"] + sorted(tools.dependencies()), check=True) + print("Installed all tools.") + sys.exit(0) if arguments["--info"]: print_tool_info() sys.exit(0) diff --git a/eris/eris/tools.py b/eris/eris/tools.py index 38f79ab..d9491b8 100755 --- a/eris/eris/tools.py +++ b/eris/eris/tools.py @@ -386,7 +386,7 @@ MAX_IMAGE_SIZE = 200 def _resize_image(image, new_width): - import PIL.Image # Here to avoid 'Segmentation Fault' in install-tools + import PIL.Image # Here to avoid 'Segmentation Fault' in apt-install-tools scale = new_width / image.width return image.resize((int(image.width * scale), int(image.height * scale)), PIL.Image.ANTIALIAS) diff --git a/install b/install index 7cc7fdb..07b19d9 100755 --- a/install +++ b/install @@ -7,4 +7,4 @@ set -e sudo apt-get install -y python3.9 python3-pip python3.9 -m pip install "git+https://github.com/ahamilton/eris@2021.12.20#subdirectory=eris" # python3.9 -m pip install -e ./eris -e ./termstr -e ./fill3 -e ./lscolors # When developing. -./install-tools +eris --apt-install-tools diff --git a/install-tools b/install-tools deleted file mode 100755 index cbef38c..0000000 --- a/install-tools +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3.9 - - -import subprocess - -import eris.tools - - -subprocess.run(["sudo", "apt-get", "-y", "install"] + - sorted(eris.tools.dependencies()), check=True)