Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal pyinstaller hook (Fixes #1514)
Makes sure that pyinstaller gets all the required libraries when bundling pygame 2 projects into an exe.
- Loading branch information
Starbuck5
committed
Aug 30, 2020
1 parent
1476009
commit a64cc9a
Showing
4 changed files
with
32 additions
and
2 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
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
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,5 @@ | ||
import os | ||
|
||
|
||
def get_hook_dirs(): | ||
return [os.path.dirname(__file__)] |
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 @@ | ||
""" | ||
binaries hook for pygame seems to be required for pygame 2.0 Windows. | ||
Otherwise some essential DLLs will not be transfered to the exe. | ||
""" | ||
|
||
import platform | ||
|
||
if platform.system() == "Windows": | ||
|
||
from PyInstaller.utils.hooks import collect_dynamic_libs | ||
|
||
pre_binaries = collect_dynamic_libs('pygame') | ||
binaries = [] | ||
|
||
for b in pre_binaries: | ||
binary, location = b | ||
# settles all the DLLs into the top level folder, which prevents duplication | ||
# with the DLLs already being put there. | ||
binaries.append((binary, ".")) |