This commit is contained in:
amnesia 2025-07-29 21:13:44 +02:00
parent fd51a0625f
commit 8e8409afc4

View File

@ -32,7 +32,7 @@ def config_logging(verbose: bool):
logging.getLogger().setLevel(logging.DEBUG)
mommy_logger.setLevel(50)
serious_logger.setLevel(logging.DEBUG)
WRAPPER_TEMPLATE = """#!{inner_bin}
# -*- coding: utf-8 -*-
@ -75,8 +75,8 @@ PIP_HOOK = """# GENERATED BY MOMMY
first_line = text.split("\\n")[0]
if not ("inner_" in first_line and first_line.startswith("#!")):
continue
continue
print(f"mommifying " + str(path))
text = text.replace("inner_", "", 1)
@ -145,7 +145,7 @@ def install_pip_hook(path: Path):
mommy_logger.info("ahhhhh mommy already watches %s", str(path))
serious_logger.info("pip hook already installed at %s", str(path))
return
mommy_logger.info("mommy needs to keep an eye on this little pip~ %s", str(path))
serious_logger.info("installing pip hook at %s", str(path))
@ -156,7 +156,7 @@ def install_pip_hook(path: Path):
def cli_compile_config():
parser = argparse.ArgumentParser(description="only recompile the config")
parser.add_argument(
"-v", "--verbose",
action="store_true",
@ -176,7 +176,7 @@ def cli_compile_config():
def mommify_venv():
parser = argparse.ArgumentParser(description="patch the virtual environment to use mommy")
parser.add_argument(
"-v", "--verbose",
action="store_true",
@ -203,7 +203,7 @@ def mommify_venv():
mommy_logger.info("mommy looks in %s to mess your system up~ <33", str(bin_path))
serious_logger.info("scanning binary directory of venv at %s", str(bin_path))
resolved_symlinks = {}
for path in list(bin_path.iterdir()):
if path.is_symlink():
@ -217,8 +217,8 @@ def mommify_venv():
# check for both just to be more expressive
if name.startswith("inner_"):
continue
if subprocess.run([str(path), '-c', '"exit(0)"'], stdout=sys.devnull).returncode != 0:
if subprocess.run([str(path), '-c', '"exit(0)"']).returncode != 0:
continue
wrap_interpreter(path, resolved_symlinks[path.name])