16 Variables = SCons.Variables
17 BoolVariable = SCons.Variables.BoolVariable
19 def print_arguments(args, bc):
21 for k,v in args.iteritems():
24 print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC
26 print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC
28 def validate_arguments(args, bc):
30 'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
31 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
32 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
33 'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
34 'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
36 'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
37 'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
38 'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
39 'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
40 'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
41 'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
42 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
43 'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
44 'WITH_BF_INTERNATIONAL',
45 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
46 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
47 'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
48 'BF_WINTAB', 'BF_WINTAB_INC',
49 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
50 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
51 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
56 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
57 'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
61 'BF_FANCY', 'BF_QUIET',
64 'WITH_BF_LCMS', 'BF_LCMS_LIB',
70 # Have options here that scons expects to be lists
72 'BF_PYTHON_LINKFLAGS',
73 'BF_OPENGL_LINKFLAGS',
74 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
75 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
76 'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS',
77 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
78 'C_WARN', 'CC_WARN', 'CXX_WARN',
79 'LLIBS', 'PLATFORM_LINKFLAGS',
83 arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
84 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
85 'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE',
86 'BF_BSC', 'BF_CONFIG',
87 'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
88 'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
93 for k,v in args.iteritems():
94 if (k in opts_list) or (k in arg_list):
96 elif k in opts_list_split:
97 okdict[k] = v.split() # "" have already been stripped
99 print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v
103 def print_targets(targs, bc):
106 print '\t'+bc.OKBLUE+t+bc.ENDC
108 print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC
110 def validate_targets(targs, bc):
111 valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
112 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
113 'everything', 'clean', 'install-bin', 'install', 'nsis']
119 print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
123 def ourspawn(self, sh, escape, cmd, args, env):
124 newargs = string.join(args[1:], ' ')
125 cmdline = cmd + " " + newargs
126 startupinfo = subprocess.STARTUPINFO()
127 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
128 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
129 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
130 data, err = proc.communicate()
138 def SetupSpawn( env ):
141 env['SPAWN'] = buf.ourspawn
144 def read_opts(cfg, args):
145 localopts = Variables.Variables(cfg, args)
146 localopts.AddVariables(
147 ('LCGDIR', 'location of cvs lib dir'),
148 (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
149 ('BF_PYTHON', 'base path for python', ''),
150 ('BF_PYTHON_VERSION', 'Python version to use', ''),
151 ('BF_PYTHON_INC', 'include path for Python headers', ''),
152 ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''),
153 ('BF_PYTHON_LIB', 'Python library', ''),
154 ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''),
155 ('BF_PYTHON_LIBPATH', 'Library path', ''),
156 ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
157 (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
159 (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
160 ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''),
161 (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
162 ('BF_OPENAL', 'base path for OpenAL', ''),
163 ('BF_OPENAL_INC', 'include path for python headers', ''),
164 ('BF_OPENAL_LIB', 'Path to OpenAL library', ''),
165 ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''),
166 ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
167 (BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
169 (BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
170 ('BF_SDL', 'SDL base path', ''),
171 ('BF_SDL_INC', 'SDL include path', ''), #$(shell $(BF_SDL)/bin/sdl-config --cflags)
172 ('BF_SDL_LIB', 'SDL library', ''), #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
173 ('BF_SDL_LIBPATH', 'SDL library path', ''),
175 ('BF_PTHREADS', 'Pthreads base path', ''),
176 ('BF_PTHREADS_INC', 'Pthreads include path', ''),
177 ('BF_PTHREADS_LIB', 'Pthreads library', ''),
178 ('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''),
180 (BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)),
181 (BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)),
182 ('BF_OPENEXR', 'OPENEXR base path', ''),
183 ('BF_OPENEXR_INC', 'OPENEXR include path', ''),
184 ('BF_OPENEXR_LIB', 'OPENEXR library', ''),
185 ('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''),
186 ('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''),
188 (BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)),
190 (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
191 ('BF_FFMPEG', 'FFMPEG base path', ''),
192 ('BF_FFMPEG_LIB', 'FFMPEG library', ''),
193 ('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''),
195 ('BF_FFMPEG_INC', 'FFMPEG includes', ''),
196 ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
198 (BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
200 ('BF_OGG', 'OGG base path', ''),
201 ('BF_OGG_LIB', 'OGG library', ''),
203 (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
204 ('BF_JPEG', 'JPEG base path', ''),
205 ('BF_JPEG_INC', 'JPEG include path', ''),
206 ('BF_JPEG_LIB', 'JPEG library', ''),
207 ('BF_JPEG_LIBPATH', 'JPEG library path', ''),
209 (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
210 ('BF_OPENJPEG', 'OPENJPEG base path', ''),
211 ('BF_OPENJPEG_INC', 'OPENJPEG include path', ''),
212 ('BF_OPENJPEG_LIB', 'OPENJPEG library', ''),
213 ('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''),
215 (BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)),
216 ('BF_REDCODE', 'REDCODE base path', ''),
217 ('BF_REDCODE_INC', 'REDCODE include path', ''),
218 ('BF_REDCODE_LIB', 'REDCODE library', ''),
219 ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
221 (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
222 ('BF_PNG', 'PNG base path', ''),
223 ('BF_PNG_INC', 'PNG include path', ''),
224 ('BF_PNG_LIB', 'PNG library', ''),
225 ('BF_PNG_LIBPATH', 'PNG library path', ''),
227 ('BF_TIFF', 'TIFF base path', ''),
228 ('BF_TIFF_INC', 'TIFF include path', ''),
229 ('BF_TIFF_LIB', 'TIFF library', ''),
230 ('BF_TIFF_LIBPATH', 'TIFF library path', ''),
232 (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
233 ('BF_ZLIB', 'ZLib base path', ''),
234 ('BF_ZLIB_INC', 'ZLib include path', ''),
235 ('BF_ZLIB_LIB', 'ZLib library', ''),
236 ('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
238 (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext if true', True)),
240 ('BF_GETTEXT', 'gettext base path', ''),
241 ('BF_GETTEXT_INC', 'gettext include path', ''),
242 ('BF_GETTEXT_LIB', 'gettext library', ''),
243 ('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
245 (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
246 ('BF_ICONV', 'iconv base path', ''),
247 ('BF_ICONV_INC', 'iconv include path', ''),
248 ('BF_ICONV_LIB', 'iconv library', ''),
249 ('BF_ICONV_LIBPATH', 'iconv library path', ''),
251 (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , False)),
253 (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
254 ('BF_BULLET', 'Bullet base dir', ''),
255 ('BF_BULLET_INC', 'Bullet include path', ''),
256 ('BF_BULLET_LIB', 'Bullet library', ''),
258 ('BF_WINTAB', 'WinTab base dir', ''),
259 ('BF_WINTAB_INC', 'WinTab include dir', ''),
260 ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
261 (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
262 ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
264 ##WITH_BF_NSPR = True
265 ##BF_NSPR = $(LCGDIR)/nspr
266 ##BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
268 ### Uncomment the following line to use Mozilla inplace of netscape
269 ##CPPFLAGS += -DMOZ_NOT_NET
270 ### Location of MOZILLA/Netscape header files...
271 ##BF_MOZILLA = $(LCGDIR)/mozilla
272 ##BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
274 ### Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
275 ### if this is not set.
277 ### Be paranoid regarding library creation (do not update archives)
280 ### enable freetype2 support for text objects
281 (BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', True)),
282 ('BF_FREETYPE', 'Freetype base path', ''),
283 ('BF_FREETYPE_INC', 'Freetype include path', ''),
284 ('BF_FREETYPE_LIB', 'Freetype library', ''),
285 ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
287 (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
289 (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
290 ('BF_QUICKTIME', 'QuickTime base path', ''),
291 ('BF_QUICKTIME_INC', 'QuickTime include path', ''),
292 ('BF_QUICKTIME_LIB', 'QuickTime library', ''),
293 ('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
295 (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
296 ('BF_OPENGL', 'OpenGL base path', ''),
297 ('BF_OPENGL_INC', 'OpenGL include path', ''),
298 ('BF_OPENGL_LIB', 'OpenGL libraries', ''),
299 ('BF_OPENGL_LIBPATH', 'OpenGL library path', ''),
300 ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
301 ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
303 (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
304 (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
306 ('CFLAGS', 'C only flags', ''),
307 ('CCFLAGS', 'Generic C and C++ flags', ''),
308 ('CXXFLAGS', 'C++ only flags', ''),
309 ('CPPFLAGS', 'Defines', ''),
310 ('REL_CFLAGS', 'C only release flags', ''),
311 ('REL_CCFLAGS', 'Generic C and C++ release flags', ''),
312 ('REL_CXXFLAGS', 'C++ only release flags', ''),
314 ('C_WARN', 'C warning flags', ''),
315 ('CC_WARN', 'Generic C and C++ warning flags', ''),
316 ('CXX_WARN', 'C++ only warning flags', ''),
318 ('LLIBS', 'Platform libs', ''),
319 ('PLATFORM_LINKFLAGS', 'Platform linkflags', ''),
321 (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
322 ('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
323 ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
324 ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
325 ('BF_PROFILE_LINKFLAGS', 'Profile linkflags', ''),
327 (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
328 ('BF_DEBUG_CFLAGS', 'C only debug flags', ''),
329 ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
330 ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
332 (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
334 ('BF_BUILDDIR', 'Build dir', ''),
335 ('BF_INSTALLDIR', 'Installation dir', ''),
336 ('BF_DOCDIR', 'Dir where BPy documentation will be created', ''),
338 ('CC', 'C compiler to use', ''),
339 ('CXX', 'C++ compiler to use', ''),
341 (BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)),
343 (BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)),
344 (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
345 (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
346 (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
347 (BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
348 (BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
350 (BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)),
351 ('BF_LCMS_LIB', 'LCMSlibrary', 'lcms'),
353 ('BF_X264_CONFIG', 'configuration flags for x264', ''),
354 ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
355 (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
357 ('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
358 ('BF_NUMJOBS', 'Number of build processes to spawn', '1'),
359 ('BF_MSVS', 'Generate MSVS project files and solution', False)
361 ) # end of opts.AddOptions()
365 def NSIS_print(target, source, env):
366 return "Creating NSIS installer for Blender 3D"
368 def NSIS_Installer(target=None, source=None, env=None):
370 if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
371 print "NSIS installer is only available on Windows."
374 start_dir = os.getcwd()
375 rel_dir = start_dir + "\\release\\windows\\installer\\"
376 install_base_dir = start_dir + "\\"
378 if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
379 os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
381 for f in glob.glob('source/blender/blenpluginapi/*.h'):
382 shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
384 shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
388 version = v.read()[:-1]
389 shortver = version.split('.')[0] + version.split('.')[1]
392 #### change to suit install dir ####
393 inst_dir = install_base_dir + env['BF_INSTALLDIR']
395 os.chdir("windows/installer")
397 ns = open("00.sconsblender.nsi","r")
400 ns_cnt = str(ns.read())
403 # set Python version we compile against
404 ns_cnt = string.replace(ns_cnt, "[PYTHON_VERSION]", env['BF_PYTHON_VERSION'])
408 rootdir = os.listdir(inst_dir+"\\")
409 for rootitem in rootdir:
410 if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
411 rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
412 rootstring = string.join(rootlist, "\n ")
414 ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
418 for rootitem in rootdir:
419 if os.path.isdir(inst_dir + rootitem) == 0:
420 delrootlist.append("Delete $INSTDIR\\" + rootitem)
421 delrootstring = string.join(delrootlist, "\n ")
422 delrootstring += "\n"
423 ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
427 scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
428 scriptdir = os.listdir(scriptpath)
429 for scriptitem in scriptdir:
430 scriptfile = "%s\\%s" % (scriptpath, scriptitem)
431 if os.path.isdir(scriptfile) == 0:
432 scriptfile = os.path.normpath(scriptfile)
433 scriptlist.append("File \"%s\"" % scriptfile)
434 scriptstring = string.join(scriptlist, "\n ")
435 scriptstring += "\n\n"
436 ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
438 # do scripts\bpymodules
440 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
441 bpymoddir = os.listdir(bpymodpath)
443 for bpymoditem in bpymoddir:
444 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
445 if os.path.isdir(bpymodfile) == 0:
446 bpymodfile = os.path.normpath(bpymodfile)
447 bpymodlist.append("File \"%s\"" % bpymodfile)
448 bpymodstring = string.join(bpymodlist, "\n ")
449 bpymodstring += "\n\n"
450 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
452 # do scripts\bpymodules\colladaimex
454 bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
455 bpymoddir = os.listdir(bpymodpath)
457 for bpymoditem in bpymoddir:
458 bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
459 if os.path.isdir(bpymodfile) == 0:
460 bpymodfile=os.path.normpath(bpymodfile)
461 colladalist.append("File \"%s\"" % bpymodfile)
462 bpymodstring = string.join(colladalist, "\n ")
463 bpymodstring += "\n\n"
464 ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
468 bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
469 bpydatadir = os.listdir(bpydatapath)
470 for bpydataitem in bpydatadir:
471 bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
472 if os.path.isdir(bpydatafile) == 0:
473 bpydatalist.append("File \"%s\"" % bpydatafile)
474 bpydatastring = string.join(bpydatalist, "\n ")
475 bpydatastring += "\n\n"
476 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
480 plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
481 plugincludedir = os.listdir(plugincludepath)
482 for plugincludeitem in plugincludedir:
483 plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
484 if os.path.isdir(plugincludefile) == 0:
485 if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
486 plugincludefile = os.path.normpath(plugincludefile)
487 plugincludelist.append("File \"%s\"" % plugincludefile)
488 plugincludestring = string.join(plugincludelist, "\n ")
489 plugincludestring += "\n\n"
490 ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
492 # do scripts\bpydata\config
494 cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
495 cfgdir = os.listdir(cfgpath)
496 for cfgitem in cfgdir:
497 cfgfile = "%s\\%s" % (cfgpath, cfgitem)
498 if os.path.isdir(cfgfile) == 0:
499 cfglist.append("File \"%s\"" % cfgfile)
500 cfgstring = string.join(cfglist, "\n ")
502 ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
506 dotblenddir = os.listdir(inst_dir+"\\.blender")
507 for dotblenditem in dotblenddir:
508 if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
509 dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
511 dotblendstring = string.join(dotblendlist, "\n ")
512 dotblendstring += "\n\n"
513 ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
518 langdir = os.listdir(inst_dir + "\\.blender\\locale")
519 for langitem in langdir:
520 if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
521 langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
522 langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
523 + langitem + "\\LC_MESSAGES\\blender.mo\"")
524 langstring = string.join(langfiles, "\n ")
526 ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
529 ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
530 ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
531 ns_cnt = string.replace(ns_cnt, "VERSION", version)
532 ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
534 tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
535 new_nsis = open(tmpnsi, 'w')
536 new_nsis.write(ns_cnt)
538 print "Preparing nsis file looks ok\n"
541 print "try to launch 'makensis' ...make sure it is on the path \n"
543 cmdline = "makensis " + "\""+tmpnsi+"\""
545 startupinfo = subprocess.STARTUPINFO()
546 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
547 proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
548 stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
549 data, err = proc.communicate()
554 print data.strip().split("\n")[-1]