2004-09-25 20:45:44 +00:00
|
|
|
# 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 = []
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
scriptpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts")
|
|
|
|
scriptdir = os.listdir(scriptpath)
|
2004-09-25 20:45:44 +00:00
|
|
|
for scriptitem in scriptdir:
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
scriptfile = "%s\\%s" % (scriptpath, scriptitem)
|
|
|
|
if os.path.isdir(scriptfile) == 0:
|
|
|
|
scriptlist.append("File %s" % scriptfile)
|
2004-09-25 20:45:44 +00:00
|
|
|
scriptstring = string.join(scriptlist, "\n ")
|
|
|
|
scriptstring += "\n\n"
|
|
|
|
nsis_cnt = string.replace(nsis_cnt, "[SCRIPTCONTS]", scriptstring)
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
|
|
|
|
# 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
|
2004-09-25 20:45:44 +00:00
|
|
|
bpydatalist = []
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
bpydatapath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpydata")
|
|
|
|
bpydatadir = os.listdir(bpydatapath)
|
2004-09-25 20:45:44 +00:00
|
|
|
for bpydataitem in bpydatadir:
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
|
|
|
|
if os.path.isdir(bpydatafile) == 0:
|
|
|
|
bpydatalist.append("File %s" % bpydatafile)
|
2004-09-25 20:45:44 +00:00
|
|
|
bpydatastring = string.join(bpydatalist, "\n ")
|
|
|
|
bpydatastring += "\n\n"
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
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)
|
2005-06-10 08:43:59 +00:00
|
|
|
|
|
|
|
# do plugins\include
|
|
|
|
plugincludelist = []
|
|
|
|
plugincludepath = "%s%s" % (startdir, "\\dist\\plugins\\include")
|
|
|
|
plugincludedir = os.listdir(plugincludepath)
|
|
|
|
for plugincludeitem in plugincludedir:
|
|
|
|
plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
|
|
|
|
if os.path.isdir(plugincludefile) == 0:
|
|
|
|
plugincludelist.append("File %s" % plugincludefile)
|
|
|
|
plugincludestring = string.join(plugincludelist, "\n ")
|
|
|
|
plugincludestring += "\n\n"
|
|
|
|
nsis_cnt = string.replace(nsis_cnt, "[PLUGINCONTS]", plugincludestring)
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
|
2004-09-25 20:45:44 +00:00
|
|
|
# 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')
|
Updating build systems: folder release/bpydata/ moved to release/scripts/bpydata/
It seemed trivial enough, so I updated all systems (makefiles, xcode, scons, scons win installer), please complain if something went wrong. Mostly it was just removing release/bpydata references, since the release/scripts dir is already worked on recursevely, handling dirs inside it.
For the scons nsi file writer script I had to write code for each new dir, but it can be recoded recursively, too (in fact joining all release stuff in a single dir tree with nothing else would be a good idea, making installation code simpler). Since it's just python and I have a little more time now, I can help scons managers if they still need.
Thanks Campbell Barton for reporting.
2005-04-16 18:25:42 +00:00
|
|
|
inst_env.Alias("wininst", nsis_inst)
|