~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to tools/scons/bs/bs_nsis.py

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# nsis target
2
 
#
3
 
# this file has the NSIS related functions
4
 
 
5
 
import os
6
 
import string
7
 
import sys
8
 
 
9
 
import bs_dirs
10
 
import bs_globals
11
 
 
12
 
def donsis(env, target, source):
13
 
        """
14
 
        Create a Windows installer with NSIS
15
 
        """
16
 
        print
17
 
        print "Creating the Windows installer"
18
 
        print
19
 
        
20
 
        startdir = os.getcwd()
21
 
        
22
 
        if bs_dirs.preparedist()==0:
23
 
                print "check output for error"
24
 
                return
25
 
        
26
 
        os.chdir("release/windows/installer")
27
 
        
28
 
        nsis = open("00.sconsblender.nsi", 'r')
29
 
        nsis_cnt = str(nsis.read())
30
 
        nsis.close()
31
 
        
32
 
        # do root
33
 
        rootlist = []
34
 
        rootdir = os.listdir(startdir + "\\dist")
35
 
        for rootitem in rootdir:
36
 
                if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
37
 
                        rootlist.append("File " + startdir + "\\dist\\" + rootitem)
38
 
        rootstring = string.join(rootlist, "\n  ")
39
 
        rootstring += "\n\n"
40
 
        nsis_cnt = string.replace(nsis_cnt, "[ROOTDIRCONTS]", rootstring)
41
 
        
42
 
        # do delete items
43
 
        delrootlist = []
44
 
        for rootitem in rootdir:
45
 
                if os.path.isdir(startdir + "\\dist\\" + rootitem) == 0:
46
 
                        delrootlist.append("Delete $INSTDIR\\" + rootitem)
47
 
        delrootstring = string.join(delrootlist, "\n ")
48
 
        delrootstring += "\n"
49
 
        nsis_cnt = string.replace(nsis_cnt, "[DELROOTDIRCONTS]", delrootstring)
50
 
        
51
 
        # do scripts
52
 
        scriptlist = []
53
 
        scriptpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts")
54
 
        scriptdir = os.listdir(scriptpath)
55
 
        for scriptitem in scriptdir:
56
 
                scriptfile = "%s\\%s" % (scriptpath, scriptitem)
57
 
                if os.path.isdir(scriptfile) == 0:
58
 
                        scriptlist.append("File %s" % scriptfile)
59
 
        scriptstring = string.join(scriptlist, "\n  ")
60
 
        scriptstring += "\n\n"
61
 
        nsis_cnt = string.replace(nsis_cnt, "[SCRIPTCONTS]", scriptstring)
62
 
 
63
 
        # do scripts\bpymodules
64
 
        bpymodlist = []
65
 
        bpymodpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpymodules")
66
 
        bpymoddir = os.listdir(bpymodpath)
67
 
        for bpymoditem in bpymoddir:
68
 
                bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
69
 
                if os.path.isdir(bpymodfile) == 0:
70
 
                        bpymodlist.append("File %s" % bpymodfile)
71
 
        bpymodstring = string.join(bpymodlist, "\n  ")
72
 
        bpymodstring += "\n\n"
73
 
        nsis_cnt = string.replace(nsis_cnt, "[SCRIPTMODCONTS]", bpymodstring)
74
 
 
75
 
        # do scripts\bpydata
76
 
        bpydatalist = []
77
 
        bpydatapath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpydata")
78
 
        bpydatadir = os.listdir(bpydatapath)
79
 
        for bpydataitem in bpydatadir:
80
 
                bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
81
 
                if os.path.isdir(bpydatafile) == 0:
82
 
                        bpydatalist.append("File %s" % bpydatafile)
83
 
        bpydatastring = string.join(bpydatalist, "\n  ")
84
 
        bpydatastring += "\n\n"
85
 
        nsis_cnt = string.replace(nsis_cnt, "[SCRIPTDATACONTS]", bpydatastring)
86
 
 
87
 
        # do scripts\bpydata\config
88
 
        cfglist = []
89
 
        cfgpath = "%s%s" % (startdir, "\\dist\\.blender\\scripts\\bpydata\\config")
90
 
        cfgdir = os.listdir(cfgpath)
91
 
        for cfgitem in cfgdir:
92
 
                cfgfile = "%s\\%s" % (cfgpath, cfgitem)
93
 
                if os.path.isdir(cfgfile) == 0:
94
 
                        cfglist.append("File %s" % cfgfile)
95
 
        cfgstring = string.join(cfglist, "\n  ")
96
 
        cfgstring += "\n\n"
97
 
        nsis_cnt = string.replace(nsis_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
98
 
        
99
 
        # do plugins\include
100
 
        plugincludelist = []
101
 
        plugincludepath = "%s%s" % (startdir, "\\dist\\plugins\\include")
102
 
        plugincludedir = os.listdir(plugincludepath)
103
 
        for plugincludeitem in plugincludedir:
104
 
                plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
105
 
                if os.path.isdir(plugincludefile) == 0:
106
 
                        plugincludelist.append("File %s" % plugincludefile)
107
 
        plugincludestring = string.join(plugincludelist, "\n  ")
108
 
        plugincludestring += "\n\n"
109
 
        nsis_cnt = string.replace(nsis_cnt, "[PLUGINCONTS]", plugincludestring)
110
 
 
111
 
        # do dotblender
112
 
        dotblendlist = []
113
 
        dotblenddir = os.listdir(startdir+"\\dist\\.blender")
114
 
        for dotblenditem in dotblenddir:
115
 
                if os.path.isdir(startdir + "\\dist\\.blender\\" + dotblenditem) == 0:
116
 
                        dotblendlist.append("File " + startdir + "\\dist\\.blender\\" + dotblenditem)
117
 
        dotblendstring = string.join(dotblendlist, "\n  ")
118
 
        dotblendstring += "\n\n"
119
 
        nsis_cnt = string.replace(nsis_cnt, "[DOTBLENDERCONTS]", dotblendstring)
120
 
        
121
 
        # do language files
122
 
        langlist = []
123
 
        langfiles = []
124
 
        langdir = os.listdir(startdir + "\\dist\\.blender\\locale")
125
 
        for langitem in langdir:
126
 
                if os.path.isdir(startdir + "\\dist\\.blender\\locale\\" + langitem) == 1:
127
 
                        langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
128
 
                        langfiles.append("File " + startdir + "\\dist\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
129
 
        langstring = string.join(langfiles, "\n  ")
130
 
        langstring += "\n\n"
131
 
        nsis_cnt = string.replace(nsis_cnt, "[LANGUAGECONTS]", langstring)
132
 
        
133
 
        # var replacements
134
 
        nsis_cnt = string.replace(nsis_cnt, "DISTDIR", startdir + "\\dist")
135
 
        nsis_cnt = string.replace(nsis_cnt, "SHORTVER", bs_globals.shortversion)
136
 
        nsis_cnt = string.replace(nsis_cnt, "VERSION", bs_globals.version)
137
 
        
138
 
        new_nsis = open("00.blender_tmp.nsi", 'w')
139
 
        new_nsis.write(nsis_cnt)
140
 
        new_nsis.close()
141
 
        
142
 
        sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
143
 
        
144
 
        os.chdir(startdir)
145
 
        
146
 
def BlenderNSIS(target):
147
 
        """
148
 
        Entry for creating Windows installer
149
 
        """
150
 
        if sys.platform == 'win32':
151
 
                inst_env = bs_globals.init_env.Copy()
152
 
                nsis_inst = inst_env.Command('nsisinstaller', 'blender$PROGSUFFIX', donsis)
153
 
                if bs_globals.user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
154
 
                        inst_env.Depends(nsis_inst, 'blenderplayer$PROGSUFFIX')
155
 
                inst_env.Alias("wininst", nsis_inst)