Back to index

radiance  4R0+20100331
install.py
Go to the documentation of this file.
00001 
00002 import os
00003 
00004 def install_dir(env, il, sbase, tbase, dir):
00005        fulldir = os.path.join(sbase, dir)
00006        l = os.listdir(fulldir)
00007        instdir = os.path.join(tbase, dir)
00008        for item in l:
00009               if item[0] == '.' or item[-1] in '%~' or item == 'CVS':
00010                      continue
00011               elif os.path.isdir(os.path.join(fulldir, item)):
00012                      install_dir(env, il, sbase, tbase, os.path.join(dir, item))
00013               else:
00014                      inst = env.Install(instdir, os.path.join(fulldir, item))
00015                      il.append(inst)
00016 
00017 def install_rlibfiles(env):
00018        buildrlib = env['RAD_BUILDRLIB']
00019        if buildrlib[0] == '#':
00020               buildrlib = buildrlib[1:]
00021        sbase = os.path.join(os.getcwd(), buildrlib)
00022        il = []
00023        install_dir(env, il, sbase, env['RAD_RLIBDIR'], '')
00024        env.Append(RAD_RLIBINSTALL=il)
00025 
00026 
00027 def install_manfiles(env):
00028        buildman = env['RAD_BUILDMAN']
00029        if buildman[0] == '#':
00030               buildman = buildman[1:]
00031        sbase = os.path.join(os.getcwd(), buildman)
00032        il = []
00033        install_dir(env, il, sbase, env['RAD_MANDIR'], '')
00034        env.Append(RAD_MANINSTALL=il)
00035 
00036 
00037 def install_cshscript(target, source, env):
00038        for t,s in map(None,target,source):
00039               sf = open(str(s), 'r')
00040               tf = open(str(t), 'w')
00041               tf.write(sf.read())
00042               os.chmod(str(t), 00755)
00043