-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add work-around for ffpyplayer trying to use site.USER_BASE
Add a run-time hook for `ffpyplayer` that sets `site.USER_BASE` to an empty string, in order to prevent run-time errors caused by `ffpyplayer` blindly passing `site.USER_BASE` to `os.path.join`. Due to `site` being disabled in PyInstaller-frozen application, `site.USER_BASE` is `None`. In PyInstaller versions prior to v5.5, this was mitigated by PyInstaller's own fake `site` module, which also set `site.USER_BASE` to an empty string.
- Loading branch information
Showing
3 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Add work-around for ``ffpyplayer`` 4.3.5 and 4.4.0 trying to use | ||
``site.USER_BASE``, which is ``None`` in PyInstaller 5.5 and later | ||
due to removal of PyInstaller's fake ``site`` module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_ffpyplayer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#----------------------------------------------------------------------------- | ||
# Copyright (c) 2023, PyInstaller Development Team. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# | ||
# The full license is in the file COPYING.txt, distributed with this software. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
#----------------------------------------------------------------------------- | ||
|
||
# Starting with v4.3.5, the `ffpyplayer` package attempts to use `site.USER_BASE` in path manipulation functions. | ||
# As frozen application runs with disabled `site`, the value of this variable is `None`, and causes path manipulation | ||
# functions to raise an error. As a work-around, we set `site.USER_BASE` to an empty string, which is also what the | ||
# fake `site` module available in PyInstaller prior to v5.5 did. | ||
import site | ||
|
||
if site.USER_BASE is None: | ||
site.USER_BASE = '' |