Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from distutils.core import setup
- import py2exe, os
- # command to run: python setup.py py2exe
- ##Tree:
- #Desktop/
- # Project Folder/
- # assets/
- # script.py
- Mydata_files = []
- for files in os.listdir('C:\\Users\\User\\Desktop\\Project Folder V5\\assets\\'): ##gets list of files from the assets folder
- f1 = 'C:\\Users\\User\\Desktop\\Project Folder V5\\assets\\' + files
- if os.path.isfile(f1): # skip directories
- f2 = 'assets', [f1]
- Mydata_files.append(f2)
- Mydata_files.append('C:\\Users\\User\\Desktop\\Project Folder\\config.ini') ##append any files you want to include.
- icon_location = "C:\\Users\\User\\Desktop\\Project Folder\\icon.ico" ##for the exe icon
- setup_dict = dict(
- name="App Name",
- version="0.0.0.1",
- description="Short Deskription of your app",
- author="Name",
- windows = [{
- "script":"script.py",
- "icon_resources": [(0, icon_location), (1, icon_location), (42, icon_location)], ##adds the icon to your exe.
- "dest_base":"AppName", ##the output folder you want to build into
- "copyright": u"Copyright © 2018-2023 Your Name Here",
- "company_name": u"You Company Name",
- }],
- zipfile=None,
- options={
- "py2exe": {
- "optimize": 2,
- "dll_excludes": [
- "api-ms-win-core-heap-l2-1-0.dll",
- "api-ms-win-core-delayload-l1-1-1.dll",
- "api-ms-win-core-libraryloader-l1-2-0.dll",
- "api-ms-win-security-activedirectoryclient-l1-1-0.dll",
- "api-ms-win-core-delayload-l1-1-0.dll",
- "api-ms-win-core-processthreads-l1-1-0.dll",
- "api-ms-win-core-string-obsolete-l1-1-0.dll",
- "api-ms-win-core-profile-l1-1-0.dll",
- "api-ms-win-core-errorhandling-l1-1-0.dll",
- "api-ms-win-core-sysinfo-l1-1-0.dll"
- ]
- }
- },
- data_files=Mydata_files
- )
- setup(**setup_dict)
- 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