Fixed package detection

This commit is contained in:
2024-08-14 10:46:05 +02:00
committed by Flo Greistorfer
parent e0cb13771c
commit 9de971d2ac
5 changed files with 30 additions and 22 deletions

View File

@@ -4,10 +4,12 @@ import os
import argparse
from rich_argparse import RichHelpFormatter, HelpPreviewAction
if __package__ == None:
__package__ = ""
DEFAULT_THEME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__).removesuffix(__package__)), "templates", "default.css")
if __package__ is None:
PACKAGE = ""
else:
PACKAGE = __package__
SCRIPTDIR = os.path.abspath(os.path.dirname(__file__).removesuffix(PACKAGE))
DEFAULT_THEME_PATH = os.path.join(SCRIPTDIR, "templates", "default.css")
DEFAULT_AUTHOR = "Author"

View File

@@ -13,8 +13,11 @@ import modules.cclicense as cclicense
from modules.argumentparser import Args
# Constants for file paths and exclusions
if __package__ == None:
__package__ = ""
if __package__ is None:
PACKAGE = ""
else:
PACKAGE = __package__
SCRIPTDIR = os.path.abspath(os.path.dirname(__file__).removesuffix(PACKAGE))
FAVICON_PATH = ".static/favicon.ico"
GLOBAL_CSS_PATH = ".static/global.css"
EXCLUDES = ["index.html", "manifest.json", "robots.txt"]
@@ -23,7 +26,7 @@ EXCLUDES = ["index.html", "manifest.json", "robots.txt"]
Image.MAX_IMAGE_PIXELS = 933120000
# Initialize Jinja2 environment for template rendering
env = Environment(loader=FileSystemLoader(os.path.join(os.path.abspath(os.path.dirname(__file__).removesuffix(__package__)), "templates")))
env = Environment(loader=FileSystemLoader(os.path.join(SCRIPTDIR, "templates")))
thumbnails: List[Tuple[str, str]] = []
info: Dict[str, str] = {}
pbardict: Dict[str, tqdm] = {}

View File

@@ -14,16 +14,19 @@ except ImportError:
SVGSUPPORT = False
from modules.argumentparser import Args
from modules.css_color import css_color_to_hex, extract_theme_color, extract_colorscheme
from modules.css_color import extract_theme_color, extract_colorscheme
# Define constants for static files directory and icon sizes
if __package__ == None:
__package__ = ""
STATIC_FILES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__).removesuffix(__package__)), "files")
if __package__ is None:
PACKAGE = ""
else:
PACKAGE = __package__
SCRIPTDIR = os.path.abspath(os.path.dirname(__file__).removesuffix(PACKAGE))
STATIC_FILES_DIR = os.path.join(SCRIPTDIR, "files")
ICON_SIZES = ["36x36", "48x48", "72x72", "96x96", "144x144", "192x192", "512x512"]
# Initialize Jinja2 environment for template rendering
env = Environment(loader=FileSystemLoader(os.path.join(os.path.abspath(os.path.dirname(__file__).removesuffix(__package__)), "templates")))
env = Environment(loader=FileSystemLoader(os.path.join(SCRIPTDIR, "templates")))
class Icon: