1
0
Эх сурвалжийг харах

Properly include all files in the pyinstaller binary

Oz N Tiram 6 жил өмнө
parent
commit
15b94969fa
2 өөрчлөгдсөн 7 нэмэгдсэн , 3 устгасан
  1. 2 1
      blogit.spec
  2. 5 2
      blogit/blogit.py

+ 2 - 1
blogit.spec

@@ -38,7 +38,8 @@ def Entrypoint(dist, group, name, **kwargs):
         **kwargs
     )
 
-a = Entrypoint('blogit', 'console_scripts', 'blogit')
+a = Entrypoint('blogit', 'console_scripts', 'blogit',
+               datas=[('blogit/blogit-mir/*', 'blogit-mir')])
 
 pyz = PYZ(a.pure, a.zipped_data,
              cipher=block_cipher)

+ 5 - 2
blogit/blogit.py

@@ -481,8 +481,11 @@ def preview():  # pragma: no coverage
 
 
 def quick_start():  # pragma: no coverage
-    # TODO: handle this exception, won't work in pyinstaller
-    path = resource_filename(Requirement.parse("blogit"), 'blogit/blogit-mir')
+    if getattr(sys, 'frozen', False):
+        path = os.path.join(sys._MEIPASS, 'blogit-mir')
+    else:
+        path = resource_filename(Requirement.parse("blogit"),
+                                 'blogit/blogit-mir')
     copy_tree(path, '.')
     print("edit conf.py, create some pages and posts and run blogit --preview")