[PATCH 2 of 2] thg: reuse thg_base_path instead of duplicating code

2 views
Skip to first unread message

Antonio Muci

unread,
Jan 31, 2025, 6:08:43 PMJan 31
to thg...@googlegroups.com, a....@inwind.it
# HG changeset patch
# User Antonio Muci <a....@inwind.it>
# Date 1737850798 -3600
# Sun Jan 26 01:19:58 2025 +0100
# Branch stable
# Node ID ae2a656dc16741b44e253eaa4a879ecb87f24291
# Parent 326e8dde97a9440bd82e4e40a40671df04a893b9
thg: reuse thg_base_path instead of duplicating code

Once we recognize that:
os.path.dirname(fpath) == os.path.dirname(os.path.realpath(__file__))
We can replace the expression with thg_base_path we introduced before.

diff --git a/thg b/thg
--- a/thg
+++ b/thg
@@ -110,8 +110,7 @@ else:
sys.path.insert(0, thg_base_path)

# compile .ui and .qrc for in-place use
- fpath = os.path.realpath(__file__)
- if os.path.exists(os.path.join(os.path.dirname(fpath), 'setup.py')):
+ if os.path.exists(os.path.join(thg_base_path, 'setup.py')):
# allow setuptools to patch distutils before we import Distribution
from setup import build_ui
from distutils.dist import Distribution
Reply all
Reply to author
Forward
0 new messages