fix for bug 3970
[blender-staging.git] / tools / scons / bs / bs_bincopy.py
1 # bincopy target
2 import sys
3 import os
4 import shutil
5 import bs_globals
6
7 def docopyit(env, target, source):
8         """
9         Copy the blender binaries to a specified location
10         """
11         if bs_globals.docopy==0 or bs_globals.copyto=='':
12                 print "The bincopy target has been activated with corrupt data"
13                 sys.exit()
14                 
15         blender = 'blender'
16         blenderplayer = 'blenderplayer'
17         
18         # make sure bs_globals.copyto exists
19         if os.path.isdir(bs_globals.copyto) == 0:
20                 os.makedirs(bs_globals.copyto)
21                 
22         if sys.platform in ['win32', 'cygwin']:
23                 blender = 'blender.exe'
24                 blenderplayer = 'blenderplayer.exe'
25         
26         shutil.copy(blender, bs_globals.copyto + os.sep + blender)
27         if bs_globals.user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
28                 shutil.copy(blenderplayer, bs_globals.copyto + os.sep + blenderplayer)
29
30 def BlenderCopy(target):
31         #~ if sys.platform == 'darwin':
32                 #~ copy_env = bs_globals.init_env.Copy()
33                 #~ Mappit = app_env.Command('appit', bs_globals.appname, appit)
34                 #~ if bs_globals.user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
35                         #~ app_env.Depends(Mappit, bs_globals.playername)
36                 #~ app_env.Alias("release", Mappit)
37         if sys.platform in ['win32', 'linux2', 'linux-i386', 'freebsd4', 'freebsd5','cygwin']:
38                 copy_env = bs_globals.init_env.Copy()
39                 copyit = copy_env.Command('blendercopy', bs_globals.appname, docopyit)
40                 if bs_globals.user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
41                         copy_env.Depends(copyit, bs_globals.playername)
42                 copy_env.Alias("bincopy", copyit)
43         else:
44                 print "Check the scons implementation for bincopy, copydo if everything is setup correctly for your platform"
45