Skip to content

Commit

Permalink
Fix: Windows で PyInstaller のビルドに失敗する問題を修正
Browse files Browse the repository at this point in the history
例の dataclasses に __version__ 変数が存在しないとビルドに失敗する件で、Windows だと標準ライブラリの配置パスが異なるため dataclasses.py の書き換えに失敗していたのが原因
  • Loading branch information
tsukumijima committed Jul 14, 2024
1 parent 9a84042 commit 7144159
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion run.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ block_cipher = None
from pathlib import Path
import sys
base_prefix = getattr(sys, 'base_prefix', sys.prefix)
dataclasses_path = Path(base_prefix) / 'lib' / f'python{sys.version_info.major}.{sys.version_info.minor}' / 'dataclasses.py'
if sys.platform == 'win32':
dataclasses_path = Path(base_prefix) / 'Lib' / 'dataclasses.py'
else:
dataclasses_path = Path(base_prefix) / 'lib' / f'python{sys.version_info.major}.{sys.version_info.minor}' / 'dataclasses.py'
try:
with dataclasses_path.open('a') as file:
file.write('\n__version__ = "1.0"')
Expand Down

0 comments on commit 7144159

Please sign in to comment.