-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_cxfreeze.py
61 lines (51 loc) · 1.33 KB
/
setup_cxfreeze.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import sys
from cx_Freeze import setup, Executable
import os
import shutil
import time
RESOURCES_DIR = 'resources'
build_exe_options = {"packages": ["os"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs']
packages = []
path = []
GUI2Exe_Target_1 = Executable(
script = "game.py",
initScript = None,
base = base,
#targetDir = r"dist",
targetName = "game.exe",
compress = True,
copyDependentFiles = True,
appendScriptToExe = True,
appendScriptToLibrary = True,
icon = None
)
setup(
version = "0.1",
description = "No Description",
author = "No Author",
name = "cx_Freeze Sample File",
options = {
"build_exe": {
"includes": includes,
"excludes": excludes,
"packages": packages,
"path": path
}
},
executables = [GUI2Exe_Target_1]
)
path = ''
directory = os.listdir('build')
for d in directory:
if d.startswith('exe.win'):
path = 'build/{}'.format(d)
shutil.copytree(RESOURCES_DIR, '{}/{}'.format(path, RESOURCES_DIR))
#shutil.rmtree('build')
name = time.strftime("%Y%m%d-%H%M%S", time.localtime())
os.rename('build', 'exe build {}'.format(name))