Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 184 lines (137 sloc) 5.017 kb
#!/usr/bin/env python
import os, shutil, zipfile
from glob import glob
# ----------------------- Helper functions ------------------------
def mkdir(path):
if not os.path.exists(path):
os.mkdir(path)
def recr_mkdir(path):
if not os.path.exists(path):
parent = os.path.split(path)[0]
if parent:
recr_mkdir(parent)
os.mkdir(path)
def rm(path):
if not os.path.exists(path): return
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)
def rm_glob(pattern):
for file in glob(pattern):
rm(file)
copy_file = shutil.copy
def copy_tree(source, dest):
os.system("cp -r "+source+" "+dest)
def copy_glob(pattern, dest):
for file in glob(pattern):
shutil.copy(file, dest)
def walk(dir):
for (dirpath,dirnames,filenames) in os.walk(dir):
for filename in filenames:
yield os.path.join(dirpath,filename)
def zip(path, prefix):
import zipfile
zfile = zipfile.ZipFile(path + '.zip', 'w')
if os.path.isdir(path):
for file in walk(path):
path_in_archive = file[len(prefix):]
zfile.write(file, path_in_archive)
else:
path_in_archive = path[len(prefix):]
zfile.write(path, path_in_archive)
def system(cmd):
import os
#print cmd
os.system(cmd)
# ------------------------------------------------------------
global_version_name = 'alpha2-2'
def deploy_assets(target_dir):
copy_tree('plastic/assets', target_dir+'/assets')
copy_tree('plastic/runtime', target_dir)
copy_tree('plastic/demos', target_dir+'/demos')
# remove some demos that aren't ready yet
unready_demos = ['browser.ca', 'invaders.ca', 'meshtest.ca', 'text.ca', 'tree.ca']
for file in unready_demos:
rm(target_dir+'/demos/'+file)
def deploy_windows_cl():
if not os.path.exists('build/bin/circa.exe'):
print "Skipping circa.exe, not found"
return
os.chdir(os.environ['CIRCA_HOME'])
version_name='circa_win32_cl_'+global_version_name
target_dir='deploy/'+version_name
rm(target_dir)
recr_mkdir(target_dir)
copy_file('build/bin/circa.exe', target_dir)
zip(target_dir, prefix='deploy/')
def deploy_windows_debug():
os.chdir(os.environ['CIRCA_HOME'])
version_name='plastic_win_'+global_version_name+'_debug'
target_dir='deploy/'+version_name
rm(target_dir)
recr_mkdir(target_dir)
copy_file('plastic/windows/Debug/plastic.exe', target_dir+'/plastic.exe')
copy_file('plastic/windows/Debug/plastic.pdb', target_dir+'/plastic.pdb')
copy_tree('"c:/Program Files\Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT"', target_dir)
deploy_assets(target_dir)
#mkdir(target_dir+'/bin')
copy_glob('SDL_deps/bin/*', target_dir)
copy_file('plastic/deps/bin/glew32.dll', target_dir)
zip(target_dir, prefix='deploy/')
def deploy_mac_cl():
os.chdir(os.environ['CIRCA_HOME'])
version_name='circa_osx_intel_'+global_version_name
target_dir='deploy/'+version_name
rm(target_dir)
recr_mkdir(target_dir)
copy_file('build/bin/circa', target_dir)
zip(target_dir, prefix='deploy/')
def deploy_mac_plastic_cl():
os.chdir(os.environ['CIRCA_HOME'])
version_name='plastic_osx_intel_'+global_version_name
target_dir='deploy/'+version_name
rm(target_dir)
recr_mkdir(target_dir)
copy_file('build/bin/plas', target_dir+'/plastic')
deploy_assets(target_dir)
mkdir(target_dir+'/bin')
if False:
dylibs = ['libSDL-1.2.0.dylib',
'libSDL_gfx.0.dylib',
'libSDL_image-1.2.0.dylib',
'libSDL_ttf-2.0.0.dylib',
'libfreetype.6.dylib',
'libz.1.dylib']
def dylib_mappings():
for dylib in dylibs:
old = '/opt/local/lib/'+dylib
new = target_dir+'/bin/'+dylib
yield (old, new)
def update_paths_in_dylib(file):
for (old, new) in dylib_mappings():
system('install_name_tool -change %s %s %s' % (old, new, file))
for (old, new) in dylib_mappings():
copy_file(old, new)
update_paths_in_dylib(new)
update_paths_in_dylib(target_dir+'/plastic')
zip(target_dir, prefix='deploy/')
def deploy_mac_bundle():
os.chdir(os.environ['CIRCA_HOME'])
version_name='plastic_osx_'+global_version_name
bundle_target='deploy/'+version_name+'.app'
rm(bundle_target)
recr_mkdir('deploy')
copy_tree('plastic/mac/build/Release/plastic.app', bundle_target)
deploy_assets(bundle_target+'/Contents/MacOS')
zip(bundle_target, prefix='deploy/')
if __name__ == '__main__':
import sys
if sys.argv[1] == 'windows':
deploy_windows_cl()
deploy_windows_debug()
if sys.argv[1] == 'mac':
deploy_mac_cl()
deploy_mac_plastic_cl()
if sys.argv[1] == 'assets-only':
deploy_assets(sys.argv[2])
Jump to Line
Something went wrong with that request. Please try again.