Advertisement
here2share

# b_py2exe_preset.py

Mar 17th, 2021
1,394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. # -*- coding: iso-8859-1 -*-
  2. # b_py2exe_preset.py
  3.  
  4. from distutils.core import setup
  5. import py2exe
  6. import sys
  7. import os
  8. import os.path
  9. sys.argv.append ('py2exe')
  10. setup (
  11.     options    =
  12.         {'py2exe':
  13.             { "bundle_files" : 1    # 3 = don't bundle (default)
  14.                                      # 2 = bundle everything but the Python interpreter
  15.                                      # 1 = bundle everything, including the Python interpreter
  16.             , "compressed"   : False  # (boolean) create a compressed zipfile
  17.             , "unbuffered"   : False  # if true, use unbuffered binary stdout and stderr
  18.             , "includes"     :
  19.                 [ "Tkinter", "Tkconstants"
  20.  
  21.                 ]
  22.             , "excludes"      : ["tcl", ]
  23.             , "optimize"     : 0  #-O
  24.             , "packages"     :
  25.                 [
  26.                 ]
  27.             , "dist_dir"     : "foo"
  28.             , "dll_excludes": ["tcl85.dll", "tk85.dll"]
  29.             ,              
  30.             }
  31.         }
  32.     , windows    =
  33.         ["foo.py"
  34.         ]
  35.     , zipfile    = None
  36.     # the syntax for data files is a list of tuples with (dest_dir, [sourcefiles])
  37.     # if only [sourcefiles] then they are copied to dist_dir
  38.     , data_files = [   os.path.join (sys.prefix, "DLLs", f)
  39.                    for f in os.listdir (os.path.join (sys.prefix, "DLLs"))
  40.                    if  (   f.lower ().startswith (("tcl", "tk"))
  41.                        and f.lower ().endswith ((".dll", ))
  42.                        )
  43.                     ]
  44.  
  45.     ,
  46. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement