Move install-tools inside eris.

- Can fully install eris without cloning the repo.
This commit is contained in:
Andrew Hamilton 2021-12-20 21:21:32 +10:00
parent ea2302ff8b
commit 7dadb7d73f
4 changed files with 8 additions and 12 deletions

View file

@ -50,6 +50,7 @@ Usage:
eris [options] <directory> eris [options] <directory>
eris -h | --help eris -h | --help
eris -i | --info eris -i | --info
eris -a | --apt-install-tools
Example: Example:
# eris my_project # eris my_project
@ -57,6 +58,7 @@ Example:
Options: Options:
-h, --help Show the full help. -h, --help Show the full help.
-i, --info Show information about the available tools. -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. -w COUNT, --workers=COUNT The number of processes working in parallel.
By default it is the number of cpus minus 1. By default it is the number of cpus minus 1.
-e "COMMAND", --editor="COMMAND" The command used to start the editor, in -e "COMMAND", --editor="COMMAND" The command used to start the editor, in
@ -1137,6 +1139,10 @@ def check_arguments():
sys.exit(1) sys.exit(1)
os.environ["ERIS_CONFIG"] = config_path os.environ["ERIS_CONFIG"] = config_path
import eris.tools as tools 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"]: if arguments["--info"]:
print_tool_info() print_tool_info()
sys.exit(0) sys.exit(0)

View file

@ -386,7 +386,7 @@ MAX_IMAGE_SIZE = 200
def _resize_image(image, new_width): 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 scale = new_width / image.width
return image.resize((int(image.width * scale), int(image.height * scale)), PIL.Image.ANTIALIAS) return image.resize((int(image.width * scale), int(image.height * scale)), PIL.Image.ANTIALIAS)

View file

@ -7,4 +7,4 @@ set -e
sudo apt-get install -y python3.9 python3-pip 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 "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. # python3.9 -m pip install -e ./eris -e ./termstr -e ./fill3 -e ./lscolors # When developing.
./install-tools eris --apt-install-tools

View file

@ -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)