Include psutil module in the python build to enable emrun to track when browser process finishes. (#1464)

Without this, emrun web server will be left running after user code
quits the page abnormally without calling `exit()` (e.g. due to a page
awwsnap crash), and there are multiple processes in use by the browser.

emrun has a graceful fallback to weaker browser process detection when
psutil is not available, so this is easy to miss if not running emrun
with --verbose:
814ec05f74/emrun.py (L330-L339)
This commit is contained in:
juj
2024-10-17 19:47:19 +03:00
committed by GitHub
parent 2c42698bcd
commit 35439da1cd

View File

@@ -148,13 +148,17 @@ def build_python():
install_dir = os.path.join(src_dir, 'install') install_dir = os.path.join(src_dir, 'install')
# Install requests module. This is needed in particualr on macOS to ensure # Install requests module. This is needed in particular on macOS to ensure
# SSL certificates are available (certifi in installed and used by requests). # SSL certificates are available (certifi in installed and used by requests).
pybin = os.path.join(src_dir, 'install', 'usr', 'local', 'bin', 'python3') pybin = os.path.join(src_dir, 'install', 'usr', 'local', 'bin', 'python3')
pip = os.path.join(src_dir, 'install', 'usr', 'local', 'bin', 'pip3') pip = os.path.join(src_dir, 'install', 'usr', 'local', 'bin', 'pip3')
check_call([pybin, '-m', 'ensurepip', '--upgrade']) check_call([pybin, '-m', 'ensurepip', '--upgrade'])
check_call([pybin, pip, 'install', 'requests']) check_call([pybin, pip, 'install', 'requests'])
# Install psutil module. This is needed by emrun to track when browser
# process quits.
check_call([pybin, pip, 'install', 'psutil'])
dirname = 'python-%s-%s' % (version, revision) dirname = 'python-%s-%s' % (version, revision)
if os.path.isdir(dirname): if os.path.isdir(dirname):
print('Erasing old build directory ' + dirname) print('Erasing old build directory ' + dirname)