]> git.lyx.org Git - lyx.git/blobdiff - development/scons/scons_utils.py
gettext support, fast_start option, scons all, mingw bug fix and some cleanup for...
[lyx.git] / development / scons / scons_utils.py
index 5f44b9b1cb618f4a2dee9de04359ad4663f9ab45..6cb37c670e8c33b69bb23a254c975a5cadf0a019 100644 (file)
@@ -72,6 +72,7 @@ def env_subst(target, source, env):
 
 
 def env_filecopy(target, source, env):
+  ''' target can be a directory '''
   shutil.copy(str(source[0]), str(target[0]))
 
 
@@ -139,10 +140,6 @@ int mkstemp(char*);
 #endif
 #endif
 
-#ifdef __EMX__
-#  include "support/os2_defines.h"
-#endif
-
 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
 #  define USE_BOOST_FORMAT 1
 #else
@@ -295,40 +292,15 @@ def checkBoostLibraries(conf, lib, pathes):
   return ('','')
 
 
-import SCons.Node
-def processLang(env, folder):
-  """ Process translations (.po files) in a po/ dir 
-    This is copied from KDE knetstats-1.5/admin/kde.py
-
-       FIXME: imcomplete
-  """
-  import glob
-  dir=SCons.Node.FS.default_fs.Dir(folder).srcnode()
-  fld=dir.srcnode()
-  tmptransfiles = glob.glob(str(fld)+'/*.po')
-  
-  transfiles=[]
-  if env.has_key('_BUILDDIR_'):
-    bdir=env['_BUILDDIR_']
-    for dir in env.make_list(tmptransfiles):
-      transfiles.append( env.join(bdir, dir) )
-  else: 
-    transfiles=tmptransfiles
-
-  env['MSGFMT'] = 'msgfmt'
-  env['BUILDERS']['Transfiles']=SCons.Builder.Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po')
-  languages=None
-  # FIXME: KDE has this ARGS thing...
-  #if env['ARGS'] and env['ARGS'].has_key('languages'):
-  #  languages=env.make_list(env['ARGS']['languages'])
-  mydir=SCons.Node.FS.default_fs.Dir('.')
-  for f in transfiles:
-    fname=f.replace(mydir.abspath, '')
-    file=SCons.Node.FS.default_fs.File(fname)
-    country = SCons.Util.splitext(file.name)[0]
-    if not languages or country in languages:
-      result = env.Transfiles(file)
-  # FIXME
+def checkMsgFmt(conf):
+  ''' check the existence of command msgfmt '''
+  conf.Message('Checking for gettext command msgfmt...')
+  res = conf.TryAction('msgfmt --help')
+  conf.Result(res[0])
+  if res[0]:
+    return 'msgfmt'
+  else:
+    return None
 
 
 def installCygwinLDScript(path):
@@ -617,47 +589,6 @@ def setLoggedSpawn(env, logfile = '', longarg=False, info=''):
   # replace the old SPAWN by the new function
   env['SPAWN'] = ls.spawn
 
-#
-# Install program with permission
-# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/InstallTargets
-# 
-import SCons
-from SCons.Script.SConscript import SConsEnvironment
-
-SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod,
-  lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
-
-def installPerm(target, source, env, perm):
-  ''' install program with permission, will copy
-    files recursively if needed '''
-  # FIXME: mixed use of scons and python interfaces?
-  target_dir = str(target[0])
-  if os.path.isfile(target_dir):
-    print "Target should be a directory: ", target_dir
-    return
-  if not os.path.isdir(target_dir):
-    os.makedirs(target_dir)
-  objs = []
-  for fnode in source:
-    fname = str(fnode)
-    print "Installing", fname, "to", target_dir
-    if os.path.isfile(fname):
-      objs.append(os.path.join(target_dir, fname))
-      shutil.copy(fname, target_dir)
-    elif os.path.isdir(fname):
-      # FIXME: directory permission is not set
-      if os.path.isdir(os.path.join(target_dir, fname)):
-        shutil.rmtree(os.path.join(target_dir, fname))
-      shutil.copytree(fname, target_dir)
-  #for i in objs:
-  #  env.AddPostAction(File(i), env.Chmod(i, perm))
-  return target
-
-def env_installProg(target, source, env):
-  installPerm(target, source, env, 0755)
-
-def env_installFile(target, source, env):
-  installPerm(target, source, env, 0644)
 
 ## def DistSources(env, node):
 ##     env.DistFiles(_get_sources(env, node))