Skip to content

Commit

Permalink
[core] Improve platform debug log, based on yt-dlp
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkf committed May 11, 2023
1 parent 6ed3433 commit d1c6c5c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions youtube_dl/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import traceback
import random

from ssl import OPENSSL_VERSION
from string import ascii_letters

from .compat import (
Expand Down Expand Up @@ -66,6 +67,7 @@
HEADRequest,
int_or_none,
ISO3166Utils,
join_nonempty,
locked_file,
LazyList,
make_HTTPS_handler,
Expand Down Expand Up @@ -2395,9 +2397,20 @@ def python_implementation():
return impl_name + ' version %d.%d.%d' % sys.pypy_version_info[:3]
return impl_name

self._write_string('[debug] Python version %s (%s) - %s\n' % (
platform.python_version(), python_implementation(),
platform_name()))
def libc_ver():
try:
return platform.libc_ver()
except OSError: # We may not have access to the executable
return []

self._write_string('[debug] Python %s (%s %s) - %s (%s%s)\n' % (
platform.python_version(),
python_implementation(),
platform.architecture()[0],
platform_name(),
OPENSSL_VERSION,
', %s' % (join_nonempty(*libc_ver(), delim=' ') or '-'),
))

exe_versions = FFmpegPostProcessor.get_versions(self)
exe_versions['rtmpdump'] = rtmpdump_version()
Expand Down

2 comments on commit d1c6c5c

@Vangelis66
Copy link

@Vangelis66 Vangelis66 commented on d1c6c5c May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

', %s' % (join_nonempty(*libc_ver(), delim=' ') or '-'),

... Under Windows, a compiled youtube-dl.exe 32-bit binary now prints below output, due to referenced committed code:

[debug] youtube-dl version 2023.05.17.40298
** This build is unofficial daily builds, provided for ease of use.
** Please do not ask for any support.
[debug] Python 3.4.4 (CPython 32bit) - Windows-Vista-6.0.6003-SP2 (OpenSSL 1.0.2d 9 Jul 2015, -)

When I first saw the "dash" (... 2015, -), I was puzzled why it was there and what it was supposed to signify, hence I had to search the code and arrive... here 😜 ! Since this is a Windows platform (without any libc library), why print that "dash" at all?

The latest yt-dlp_x86.exe nightly build OTOH omits this completely:

[debug] yt-dlp version [email protected] [21b9413cf] (win_x86_exe)
[debug] Python 3.7.9 (CPython x86 32bit) - Windows-Vista-6.0.6003-SP2 (OpenSSL 1.1.1g  21 Apr 2020)

Thanks 😄 ...

@Vangelis66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... OK, my comment above has been addressed in 1f7c6f8 👍 ; a locally compiled youtube-dl.exe, built from 2389c7c, now prints:

[debug] Command-line args: ['-v']
[debug] Encodings: locale cp1253, fs mbcs, out cp737, pref cp1253
[debug] youtube-dl version 2023.05.25.19419 (single file build)
[debug] Python 3.4.4 (CPython x86 32bit) - Windows-Vista-6.0.6003-SP2 - OpenSSL 1.0.2d 9 Jul 2015

Thanks indeed 😄 ❤️ ...

Please sign in to comment.