]> jfr.im git - yt-dlp.git/commitdiff
[update] Use `.git` folder to distinguish `source`/`unknown`
authorpukkandan <redacted>
Tue, 7 Jun 2022 18:46:23 +0000 (00:16 +0530)
committerpukkandan <redacted>
Tue, 7 Jun 2022 18:47:42 +0000 (00:17 +0530)
This is not perfect, but is good enough for how we use this information

Closes #3994

yt_dlp/update.py

index 3de7c720927b8f0946228ef5380702c5ae50da5c..85c676e00386ca9b548667899b4be671e8661cc5 100644 (file)
@@ -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