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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# nsis target
#
# this file has the NSIS related functions
import os
import string
import sys
import bs_dirs
import bs_globals
def donsis(env, target, source):
"""
Create a Windows installer with NSIS
"""
print
print "Creating the Windows installer"
print
startdir = os.getcwd()
if bs_dirs.preparedist()==0:
print "check output for error"
return
os.chdir("release/windows/installer")
nsis = open("00.sconsblender.nsi", 'r')
nsis_cnt = str(nsis.read())
nsis.close()
# do root
rootlist = []
rootdir = os.listdir(startdir + "\\dist")
for rootitem in rootdir:
if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
rootlist.append("File " + startdir + "\\dist\\" + rootitem)
rootstring = string.join(rootlist, "\n ")
rootstring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[ROOTDIRCONTS]", rootstring)
# do delete items
delrootlist = []
for rootitem in rootdir:
if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
delrootlist.append("Delete $INSTDIR\\" + rootitem)
delrootstring = string.join(delrootlist, "\n ")
delrootstring += "\n"
nsis_cnt = string.replace(nsis_cnt, "[DELROOTDIRCONTS]", delrootstring)
# do scripts
scriptlist = []
scriptpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts")
scriptdir = os.listdir(scriptpath)
for scriptitem in scriptdir:
scriptfile = "%s\\%s" % (scriptpath, scriptitem)
if os.path.isdir(scriptfile) == 0:
scriptlist.append("File %s" % scriptfile)
scriptstring = string.join(scriptlist, "\n ")
scriptstring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[SCRIPTCONTS]", scriptstring)
# do scripts\bpymodules
bpymodlist = []
bpymodpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpymodules")
bpymoddir = os.listdir(bpymodpath)
for bpymoditem in bpymoddir:
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
if os.path.isdir(bpymodfile) == 0:
bpymodlist.append("File %s" % bpymodfile)
bpymodstring = string.join(bpymodlist, "\n ")
bpymodstring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[SCRIPTMODCONTS]", bpymodstring)
# do scripts\bpydata
bpydatalist = []
bpydatapath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpydata")
bpydatadir = os.listdir(bpydatapath)
for bpydataitem in bpydatadir:
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
if os.path.isdir(bpydatafile) == 0:
bpydatalist.append("File %s" % bpydatafile)
bpydatastring = string.join(bpydatalist, "\n ")
bpydatastring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[SCRIPTDATACONTS]", bpydatastring)
# do scripts\bpydata\config
cfglist = []
cfgpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpydata\\config")
cfgdir = os.listdir(cfgpath)
for cfgitem in cfgdir:
cfgfile = "%s\\%s" % (cfgpath, cfgitem)
if os.path.isdir(cfgfile) == 0:
cfglist.append("File %s" % cfgfile)
cfgstring = string.join(cfglist, "\n ")
cfgstring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
# do dotblender
dotblendlist = []
dotblenddir = os.listdir(startdir+"\\dist\\.blender")
for dotblenditem in dotblenddir:
if os.path.isdir(startdir + "\\dist\\.blender\\" + dotblenditem) == 0:
dotblendlist.append("File " + startdir + "\\dist\\.blender\\" + dotblenditem)
dotblendstring = string.join(dotblendlist, "\n ")
dotblendstring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[DOTBLENDERCONTS]", dotblendstring)
# do language files
langlist = []
langfiles = []
langdir = os.listdir(startdir + "\\dist\\.blender\\locale")
for langitem in langdir:
if os.path.isdir(startdir + "\\dist\\.blender\\locale\\" + langitem) == 1:
langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
langfiles.append("File " + startdir + "\\dist\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
langstring = string.join(langfiles, "\n ")
langstring += "\n\n"
nsis_cnt = string.replace(nsis_cnt, "[LANGUAGECONTS]", langstring)
# var replacements
nsis_cnt = string.replace(nsis_cnt, "DISTDIR", startdir + "\\dist")
nsis_cnt = string.replace(nsis_cnt, "SHORTVER", bs_globals.shortversion)
nsis_cnt = string.replace(nsis_cnt, "VERSION", bs_globals.version)
new_nsis = open("00.blender_tmp.nsi", 'w')
new_nsis.write(nsis_cnt)
new_nsis.close()
sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
os.chdir(startdir)
def BlenderNSIS(target):
"""
Entry for creating Windows installer
"""
if sys.platform == 'win32':
inst_env = bs_globals.init_env.Copy()
nsis_inst = inst_env.Command('nsisinstaller', 'blender$PROGSUFFIX', donsis)
if bs_globals.user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
inst_env.Depends(nsis_inst, 'blenderplayer$PROGSUFFIX')
inst_env.Alias("wininst", nsis_inst)
|