11# -*- mode: python -*-
22
33
4- import platform , sys , os , os .path , numpy , glob , pathlib
4+ import glob
5+ import os
6+ import os .path
7+ import pathlib
8+ import platform
9+ import sys
10+
11+ import numpy
12+ import pkg_resources
513from PyInstaller .utils .hooks import collect_submodules
614
715hidden_imports = []
@@ -14,8 +22,9 @@ hidden_imports += collect_submodules("pyglui")
1422hidden_imports += collect_submodules ("pupil_apriltags" )
1523hidden_imports += collect_submodules ("sklearn" )
1624
17- from pyglui import ui
25+ import glfw
1826import pupil_apriltags
27+ from pyglui import ui
1928
2029apriltag_lib_path = pathlib .Path (pupil_apriltags .__file__ ).parent
2130
@@ -25,6 +34,12 @@ def apriltag_relative_path(absolute_path):
2534 return os .path .join (* absolute_path .parts [- 3 :])
2635
2736
37+ glfw_name = glfw ._glfw ._name
38+ glfw_path = pathlib .Path (glfw_name )
39+ if not glfw_path .exists ():
40+ glfw_path = pathlib .Path (pkg_resources .resource_filename ("glfw" , glfw_name ))
41+ glfw_binaries = [(glfw_path .name , str (glfw_path ), "BINARY" )]
42+
2843if platform .system () == "Darwin" :
2944 sys .path .append ("." )
3045 from version import pupil_version
@@ -63,11 +78,11 @@ if platform.system() == "Darwin":
6378 a .binaries - libSystem ,
6479 a .zipfiles ,
6580 a .datas ,
66- [("libglfw.dylib" , "/usr/local/lib/libglfw.dylib" , "BINARY" )],
6781 [("pyglui/OpenSans-Regular.ttf" , ui .get_opensans_font_path (), "DATA" )],
6882 [("pyglui/Roboto-Regular.ttf" , ui .get_roboto_font_path (), "DATA" )],
6983 [("pyglui/pupil_icons.ttf" , ui .get_pupil_icons_font_path (), "DATA" )],
7084 apriltag_libs ,
85+ glfw_binaries ,
7186 strip = None ,
7287 upx = True ,
7388 name = "Pupil Capture" ,
@@ -125,19 +140,21 @@ elif platform.system() == "Linux":
125140 binaries ,
126141 a .zipfiles ,
127142 a .datas ,
128- [("libglfw.so" , "/usr/local/lib/libglfw.so" , "BINARY" )],
129143 [("libGLEW.so" , "/usr/lib/x86_64-linux-gnu/libGLEW.so" , "BINARY" )],
130144 [("pyglui/OpenSans-Regular.ttf" , ui .get_opensans_font_path (), "DATA" )],
131145 [("pyglui/Roboto-Regular.ttf" , ui .get_roboto_font_path (), "DATA" )],
132146 [("pyglui/pupil_icons.ttf" , ui .get_pupil_icons_font_path (), "DATA" )],
133147 apriltag_libs ,
148+ glfw_binaries ,
134149 strip = True ,
135150 upx = True ,
136151 name = "pupil_capture" ,
137152 )
138153
139154elif platform .system () == "Windows" :
140- import sys , os , os .path
155+ import os
156+ import os .path
157+ import sys
141158
142159 np_path = os .path .dirname (numpy .__file__ )
143160 np_dlls = glob .glob (np_path + "/core/*.dll" )
@@ -194,11 +211,11 @@ elif platform.system() == "Windows":
194211 a .zipfiles ,
195212 a .datas ,
196213 [("PupilDrvInst.exe" , "../../pupil_external/PupilDrvInst.exe" , "BINARY" )],
197- [("glfw3.dll" , "../../pupil_external/glfw3.dll" , "BINARY" )],
198214 [("pyglui/OpenSans-Regular.ttf" , ui .get_opensans_font_path (), "DATA" )],
199215 [("pyglui/Roboto-Regular.ttf" , ui .get_roboto_font_path (), "DATA" )],
200216 [("pyglui/pupil_icons.ttf" , ui .get_pupil_icons_font_path (), "DATA" )],
201217 apriltag_libs ,
218+ glfw_binaries ,
202219 vc_redist_libs ,
203220 np_dll_list ,
204221 strip = False ,
0 commit comments