Advertisement
AceScottie

setup.py

Apr 28th, 2019
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.86 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. from distutils.core import setup
  3. import py2exe, os
  4. # command to run: python setup.py py2exe
  5. ##Tree:
  6. #Desktop/
  7. #   Project Folder/
  8. #       assets/
  9. #       script.py
  10.  
  11. Mydata_files = []
  12. for files in os.listdir('C:\\Users\\User\\Desktop\\Project Folder V5\\assets\\'): ##gets list of files from the assets folder
  13.     f1 = 'C:\\Users\\User\\Desktop\\Project Folder V5\\assets\\' + files
  14.     if os.path.isfile(f1): # skip directories
  15.         f2 = 'assets', [f1]
  16.         Mydata_files.append(f2)
  17. Mydata_files.append('C:\\Users\\User\\Desktop\\Project Folder\\config.ini') ##append any files you want to include.
  18. icon_location = "C:\\Users\\User\\Desktop\\Project Folder\\icon.ico" ##for the exe icon
  19.  
  20. setup_dict = dict(
  21.     name="App Name",
  22.     version="0.0.0.1",
  23.     description="Short Deskription of your app",
  24.     author="Name",
  25.     windows = [{
  26.             "script":"script.py",
  27.             "icon_resources": [(0, icon_location), (1, icon_location), (42, icon_location)], ##adds the icon to your exe.
  28.             "dest_base":"AppName", ##the output folder you want to build into
  29.             "copyright": u"Copyright © 2018-2023 Your Name Here",
  30.             "company_name": u"You Company Name",
  31.            
  32.             }],
  33.     zipfile=None,
  34.     options={
  35.          "py2exe": {
  36.             "optimize": 2,
  37.             "dll_excludes": [
  38.             "api-ms-win-core-heap-l2-1-0.dll",
  39.             "api-ms-win-core-delayload-l1-1-1.dll",
  40.             "api-ms-win-core-libraryloader-l1-2-0.dll",
  41.             "api-ms-win-security-activedirectoryclient-l1-1-0.dll",
  42.             "api-ms-win-core-delayload-l1-1-0.dll",
  43.             "api-ms-win-core-processthreads-l1-1-0.dll",
  44.             "api-ms-win-core-string-obsolete-l1-1-0.dll",
  45.             "api-ms-win-core-profile-l1-1-0.dll",
  46.             "api-ms-win-core-errorhandling-l1-1-0.dll",
  47.             "api-ms-win-core-sysinfo-l1-1-0.dll"
  48.             ]
  49.            
  50.             }
  51.         },
  52.     data_files=Mydata_files
  53. )
  54.  
  55. setup(**setup_dict)
  56. setup(**setup_dict)##this has to run twice to deal with the exe icon issue.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement