Support PyInstaller by using frozen temp path
Issue #36
resolved
Using os.path.dirname(__file__)
exclusively makes it impossible to freeze Shady with PyInstaller (and probably other ‘compilers') without putting the ’MASTER_META' file and ‘accel' and ‘glsl' directories alongside the executable. Something like this would fix it but I don’t trust myself to do it without disturbing something:
def PackagePath(relative_path):
if getattr(sys, 'frozen', False):
here = getattr(sys, '_MEIPASS', '.') # sys._MEIPASS contains the temp exe unpack dir
else:
here = os.path.dirname(__file__)
return os.path.abspath(os.path.join(here, relative_path))
Comments (4)
-
-
reporter Yes, I meant the
inspect
-based function. It still only looks in the current working directory. I'll create a minimal example and attach it here. -
reporter I’ve addressed the issue in a new branch called
pyinstaller
; have a look. -
- changed status to resolved
pyinstaller was tweaked and then merged. To freeze a Shady-dependent application, include the output of
Shady.Manifest('pyinstaller')
in thedatas
argument. - Log in to comment
Which version of Shady is this from, and which file?
PackagePath()
doesn't use__file__
and hasn't for a long time. Is it possible you've got a pip-installed Shady package hanging over from the distant past, normally ignored but somehow being picked up during the freeze? The only place I finddef PackagePath
is inShady.Location
, and that uses aninspect
implementation rather__file__
— for exactly this kind of reason.