From 900befbb4e9a28c7c8e2188621c53f8eaa31483f Mon Sep 17 00:00:00 2001 From: raj_mathe Date: Thu, 6 May 2021 10:41:12 +0200 Subject: [PATCH] =?UTF-8?q?master=20>=20master:=20script=20zur=20einfachen?= =?UTF-8?q?=20Ausf=C3=BChrung=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/.gitignore | 3 +++ code/main.py | 5 ----- code/requirements | 4 ++++ code/run.sh | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 code/requirements create mode 100755 code/run.sh diff --git a/code/.gitignore b/code/.gitignore index bf7b032..b6b3640 100644 --- a/code/.gitignore +++ b/code/.gitignore @@ -1,3 +1,6 @@ * !/.gitignore !/*.py + +!/run.sh +!/requirements diff --git a/code/main.py b/code/main.py index 9e128eb..6fe8bbf 100644 --- a/code/main.py +++ b/code/main.py @@ -9,14 +9,9 @@ from __future__ import annotations; import os; import sys; sys.tracebacklimit = 0; -from itertools import product; from lark import Tree; from textwrap import dedent; -from typing import Dict; -from typing import Generator; from typing import List; -from typing import Tuple; -from typing import Union; sys.path.insert(0, os.getcwd()); diff --git a/code/requirements b/code/requirements new file mode 100644 index 0000000..ca73856 --- /dev/null +++ b/code/requirements @@ -0,0 +1,4 @@ +lark +lark-parser +lark-parser[regex] +typing diff --git a/code/run.sh b/code/run.sh new file mode 100755 index 0000000..f1cdc38 --- /dev/null +++ b/code/run.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +################################################################################################ +# NOTE: `chmod +x *.sh` vorher ausführen, um dieses Skript benutzen zu können. +################################################################################################ + +function run_python() { + [ "$OSTYPE" == "msys" ] && py -3 $@ || python3 $@; +} + +function run_pip() { + run_python -m pip $@; +} + +function run_check_requirements() { + run_pip install "$( cat requirements )" >> /dev/null; +} + +# Kann auskommentiert werden, wenn nötige Module schon installiert: +run_check_requirements; + +# Code ausführen: +run_python main.py;