From a9c256e74f50bfd85cb6c65f0edaa7376bc25172 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Fri, 23 Sep 2022 13:37:37 -0400 Subject: [PATCH] Rename latty.py to pdf_builder.py Other small cleanup. --- init | 11 ++++++----- start | 3 ++- undercover/css.py | 7 ++----- undercover/{latty.py => pdf_builder.py} | 0 undercover/routes.py | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) rename undercover/{latty.py => pdf_builder.py} (100%) diff --git a/init b/init index d782c0c..3c4c08b 100755 --- a/init +++ b/init @@ -1,4 +1,5 @@ #!/bin/bash + SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" NEEDS="needs to be installed through your distro's package manager" @@ -10,22 +11,22 @@ function fail { failed=false if ! whereis python3 | grep "/" &> /dev/null; then - echo "python3" $NEEDS + echo "python3 $NEEDS" failed=true fi if ! whereis pip3 | grep "/" &> /dev/null; then - echo "pip3" $NEEDS + echo "pip3 $NEEDS" failed=true fi if ! whereis pdflatex | grep "/" &> /dev/null; then - echo "texlive" $NEEDS + echo "texlive $NEEDS" failed=true fi if ! whereis gs | grep "/" &> /dev/null; then - echo "ghostscript" $NEEDS + echo "ghostscript $NEEDS" failed=true fi @@ -47,4 +48,4 @@ for com in "${commands[@]}"; do done echo "UnderCover Init Succeeded!" -touch $SCRIPT_DIR/.undercover_init_successful +touch "$SCRIPT_DIR/.undercover_init_successful" diff --git a/start b/start index baf1702..2925741 100755 --- a/start +++ b/start @@ -1,4 +1,5 @@ #!/bin/bash + SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then @@ -7,7 +8,7 @@ if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then fi fi -if ! pip3 -V | grep "$SCRIPT_DIR/.venv"; then +if ! pip3 -V | grep -E "$SCRIPT_DIR/\.?venv"; then echo "Entering virtual environment..." source "$SCRIPT_DIR/.venv/bin/activate" fi diff --git a/undercover/css.py b/undercover/css.py index 69b0ca1..b2b328a 100644 --- a/undercover/css.py +++ b/undercover/css.py @@ -15,8 +15,5 @@ def optimize_css_file(): static_dir = root + '/undercover/undercover/static/' css = open(static_dir + 'styles.css', 'r').read() minified = optimize_css(css) - minified_file = open(static_dir + 'styles_min.css', 'w') - minified_file.write(minified) - minified_file.close() - - + with open(static_dir + 'styles_min.css', 'w') as minified_file: + minified_file.write(minified) diff --git a/undercover/latty.py b/undercover/pdf_builder.py similarity index 100% rename from undercover/latty.py rename to undercover/pdf_builder.py diff --git a/undercover/routes.py b/undercover/routes.py index 9508201..d36ce79 100644 --- a/undercover/routes.py +++ b/undercover/routes.py @@ -9,7 +9,7 @@ from flask import (Blueprint, render_template, request, make_response) from wtforms import Form, StringField, TextAreaField, validators import undercover.db as db -from undercover.latty import CLData +from undercover.pdf_builder import CLData index_cache = None writing_blueprint = Blueprint('writing', __name__,)