From 233ad894d3fa4596b793541649f6183188508e44 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Wed, 8 Jun 2022 00:16:23 +0530 Subject: [PATCH] [update] Use `.git` folder to distinguish `source`/`unknown` This is not perfect, but is good enough for how we use this information Closes #3994 --- yt_dlp/update.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/update.py b/yt_dlp/update.py index 3de7c72092..85c676e003 100644 --- a/yt_dlp/update.py +++ b/yt_dlp/update.py @@ -29,7 +29,8 @@ def _get_variant_and_executable_path(): path = os.path.dirname(__file__) if isinstance(__loader__, zipimporter): return 'zip', os.path.join(path, '..') - elif os.path.basename(sys.argv[0]) == '__main__.py': + elif (os.path.basename(sys.argv[0]) in ('__main__.py', '-m') + and os.path.exists(os.path.join(path, '../.git/HEAD'))): return 'source', path return 'unknown', path