From c0f79d9413e316942bc64f08fea30950bfd4002a Mon Sep 17 00:00:00 2001 From: Vyron Vasileiadis Date: Tue, 7 Nov 2023 16:26:46 +0100 Subject: [PATCH] Remove logger.info from QM's __init__ file --- setup.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/setup.py b/setup.py index 332bdd582..eeb785b9a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ """Installation script for python""" import os +import site from setuptools import find_packages, setup @@ -54,3 +55,21 @@ long_description_content_type="text/markdown", license="Apache License 2.0", ) + + +def _postprocess_setup(): + site_packages_path = site.getsitepackages() + qm_init_path = os.path.join(site_packages_path[0], "qm", "__init__.py") + + if os.path.exists(qm_init_path): + with open(qm_init_path, "r", encoding="utf-8") as file: + lines = file.readlines() + + if lines and lines[-1].startswith("logger.info"): + lines = lines[:-1] + + with open(qm_init_path, "w", encoding="utf-8") as file: + file.writelines(lines) + + +_postprocess_setup()