-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake_dist.py
60 lines (48 loc) · 1.4 KB
/
make_dist.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
from distutils.core import setup
import py2exe
import sys
import shutil
import os
from pessheet import getApplicationName, getApplicationVersion
appName = getApplicationName()
appVer = getApplicationVersion()
distdir = '%s_%s.win32' % (appName, appVer)
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ['msvcp71.dll']:
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
# no arguments
if len(sys.argv) == 1:
sys.argv.append("py2exe")
def compile(pyName):
OPTIONS = {"py2exe": \
{"compressed": 1,
"optimize": 0,
"bundle_files": 1,
'dist_dir': distdir,
}
}
ZIPFILE = None
console = pyName.endswith('.py')
#console = True
appinfo = {'script': pyName, 'icon_resources': [(0, 'resources/pessheet.ico')]}
setup_args = dict(
options=OPTIONS,
zipfile=ZIPFILE,
)
if console:
setup_args['console'] = [appinfo]
else:
setup_args['windows'] = [appinfo]
setup(**setup_args)
os.remove('%s/w9xpopen.exe' % distdir)
shutil.copytree('resources', '%s/resources' % distdir)
shutil.copytree('examples', '%s/examples' % distdir)
try:
shutil.rmtree(distdir)
except WindowsError, e:
pass
compile('pessheet.pyw')
shutil.rmtree('build')