From 3d529f4ea2b0de42aa2144dbe904e564b7b0b813 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Mon, 20 Aug 2012 23:30:34 +0200 Subject: Imported Upstream version 2.2.0 --- LICENSE | 2 +- SConstruct | 12 +- bin/import-test.py | 4 +- bin/linecount.py | 4 +- bin/restore.sh | 30 +- bin/scons-doc.py | 2 +- bin/scons-proc.py | 4 +- bin/update-release-info.py | 23 +- doc/SConscript | 2 +- doc/design/scons.mod | 2 +- doc/developer/architecture.xml | 2 +- doc/developer/branches.xml | 2 +- doc/developer/copyright.xml | 2 +- doc/developer/cycle.xml | 2 +- doc/developer/main.xml | 2 +- doc/developer/packaging.xml | 2 +- doc/developer/preface.xml | 2 +- doc/developer/sourcetree.xml | 2 +- doc/developer/testing.xml | 2 +- doc/man/scons-time.1 | 6 +- doc/man/scons.1 | 6 +- doc/man/sconsign.1 | 6 +- doc/python10/scons.mod | 2 +- doc/scons.mod | 2 +- doc/user/MANIFEST | 1 + doc/user/README | 2 +- doc/user/actions.in | 2 +- doc/user/actions.xml | 2 +- doc/user/add-method.in | 4 +- doc/user/add-method.xml | 4 +- doc/user/alias.in | 2 +- doc/user/alias.xml | 2 +- doc/user/ant.in | 2 +- doc/user/ant.xml | 2 +- doc/user/build-install.in | 20 +- doc/user/build-install.xml | 20 +- doc/user/builders-built-in.in | 2 +- doc/user/builders-built-in.xml | 2 +- doc/user/builders-commands.in | 2 +- doc/user/builders-commands.xml | 2 +- doc/user/builders-writing.in | 8 +- doc/user/builders-writing.xml | 8 +- doc/user/builders.in | 2 +- doc/user/builders.xml | 2 +- doc/user/caching.in | 2 +- doc/user/caching.xml | 2 +- doc/user/command-line.in | 32 +- doc/user/command-line.xml | 32 +- doc/user/copyright.in | 2 +- doc/user/copyright.xml | 2 +- doc/user/depends.in | 10 +- doc/user/depends.xml | 10 +- doc/user/environments.in | 8 +- doc/user/environments.xml | 8 +- doc/user/errors.in | 2 +- doc/user/errors.xml | 2 +- doc/user/example.in | 2 +- doc/user/example.xml | 2 +- doc/user/factories.in | 2 +- doc/user/factories.xml | 2 +- doc/user/file-removal.in | 2 +- doc/user/file-removal.xml | 2 +- doc/user/functions.in | 2 +- doc/user/functions.xml | 2 +- doc/user/gettext.in | 351 +++++++++++++++++ doc/user/gettext.xml | 334 ++++++++++++++++ doc/user/hierarchy.in | 4 +- doc/user/hierarchy.xml | 4 +- doc/user/install.in | 2 +- doc/user/install.xml | 2 +- doc/user/java.in | 2 +- doc/user/java.xml | 2 +- doc/user/less-simple.in | 2 +- doc/user/less-simple.xml | 2 +- doc/user/libraries.in | 2 +- doc/user/libraries.xml | 2 +- doc/user/main.in | 8 +- doc/user/main.xml | 8 +- doc/user/make.in | 2 +- doc/user/make.xml | 2 +- doc/user/mergeflags.in | 2 +- doc/user/mergeflags.xml | 2 +- doc/user/misc.in | 2 +- doc/user/misc.xml | 2 +- doc/user/nodes.in | 2 +- doc/user/nodes.xml | 2 +- doc/user/output.in | 2 +- doc/user/output.xml | 2 +- doc/user/parseconfig.in | 2 +- doc/user/parseconfig.xml | 2 +- doc/user/parseflags.in | 2 +- doc/user/parseflags.xml | 2 +- doc/user/preface.in | 2 +- doc/user/preface.xml | 2 +- doc/user/python.in | 2 +- doc/user/python.xml | 2 +- doc/user/repositories.in | 2 +- doc/user/repositories.xml | 2 +- doc/user/run.in | 2 +- doc/user/run.xml | 2 +- doc/user/scanners.in | 2 +- doc/user/scanners.xml | 2 +- doc/user/sconf.in | 2 +- doc/user/sconf.xml | 2 +- doc/user/separate.in | 2 +- doc/user/separate.xml | 2 +- doc/user/sideeffect.in | 2 +- doc/user/sideeffect.xml | 2 +- doc/user/simple.in | 6 +- doc/user/simple.xml | 6 +- doc/user/sourcecode.in | 2 +- doc/user/sourcecode.xml | 2 +- doc/user/tasks.in | 2 +- doc/user/tasks.xml | 2 +- doc/user/tools.in | 2 +- doc/user/tools.xml | 2 +- doc/user/troubleshoot.in | 2 +- doc/user/troubleshoot.xml | 2 +- doc/user/variables.in | 2 +- doc/user/variables.xml | 2 +- doc/user/variants.in | 2 +- doc/user/variants.xml | 2 +- src/Announce.txt | 30 +- src/CHANGES.txt | 52 ++- src/LICENSE.txt | 2 +- src/README.txt | 18 +- src/RELEASE.txt | 109 +++--- src/engine/MANIFEST-xml.in | 5 + src/engine/MANIFEST.in | 6 + src/engine/SCons/Action.py | 6 +- src/engine/SCons/Action.xml | 2 +- src/engine/SCons/ActionTests.py | 4 +- src/engine/SCons/Builder.py | 4 +- src/engine/SCons/BuilderTests.py | 4 +- src/engine/SCons/CacheDir.py | 4 +- src/engine/SCons/CacheDirTests.py | 4 +- src/engine/SCons/Conftest.py | 2 +- src/engine/SCons/Debug.py | 4 +- src/engine/SCons/Defaults.py | 4 +- src/engine/SCons/Defaults.xml | 2 +- src/engine/SCons/DefaultsTests.py | 4 +- src/engine/SCons/Environment.py | 36 +- src/engine/SCons/Environment.xml | 2 +- src/engine/SCons/EnvironmentTests.py | 4 +- src/engine/SCons/Errors.py | 4 +- src/engine/SCons/ErrorsTests.py | 4 +- src/engine/SCons/Executor.py | 4 +- src/engine/SCons/ExecutorTests.py | 4 +- src/engine/SCons/Job.py | 4 +- src/engine/SCons/JobTests.py | 4 +- src/engine/SCons/Memoize.py | 4 +- src/engine/SCons/MemoizeTests.py | 4 +- src/engine/SCons/Node/Alias.py | 4 +- src/engine/SCons/Node/AliasTests.py | 4 +- src/engine/SCons/Node/FS.py | 6 +- src/engine/SCons/Node/FSTests.py | 4 +- src/engine/SCons/Node/NodeTests.py | 4 +- src/engine/SCons/Node/Python.py | 4 +- src/engine/SCons/Node/PythonTests.py | 4 +- src/engine/SCons/Node/__init__.py | 7 +- src/engine/SCons/Options/BoolOption.py | 4 +- src/engine/SCons/Options/EnumOption.py | 4 +- src/engine/SCons/Options/ListOption.py | 4 +- src/engine/SCons/Options/PackageOption.py | 4 +- src/engine/SCons/Options/PathOption.py | 4 +- src/engine/SCons/Options/__init__.py | 4 +- src/engine/SCons/PathList.py | 4 +- src/engine/SCons/PathListTests.py | 4 +- src/engine/SCons/Platform/PlatformTests.py | 4 +- src/engine/SCons/Platform/__init__.py | 4 +- src/engine/SCons/Platform/__init__.xml | 2 +- src/engine/SCons/Platform/aix.py | 4 +- src/engine/SCons/Platform/cygwin.py | 4 +- src/engine/SCons/Platform/darwin.py | 4 +- src/engine/SCons/Platform/hpux.py | 4 +- src/engine/SCons/Platform/irix.py | 4 +- src/engine/SCons/Platform/os2.py | 4 +- src/engine/SCons/Platform/posix.py | 4 +- src/engine/SCons/Platform/posix.xml | 2 +- src/engine/SCons/Platform/sunos.py | 4 +- src/engine/SCons/Platform/sunos.xml | 2 +- src/engine/SCons/Platform/win32.py | 17 +- src/engine/SCons/Platform/win32.xml | 2 +- src/engine/SCons/SConf.py | 4 +- src/engine/SCons/SConfTests.py | 6 +- src/engine/SCons/SConsign.py | 4 +- src/engine/SCons/SConsignTests.py | 4 +- src/engine/SCons/Scanner/C.py | 4 +- src/engine/SCons/Scanner/CTests.py | 4 +- src/engine/SCons/Scanner/D.py | 4 +- src/engine/SCons/Scanner/Dir.py | 4 +- src/engine/SCons/Scanner/DirTests.py | 4 +- src/engine/SCons/Scanner/Fortran.py | 4 +- src/engine/SCons/Scanner/FortranTests.py | 4 +- src/engine/SCons/Scanner/IDL.py | 4 +- src/engine/SCons/Scanner/IDLTests.py | 4 +- src/engine/SCons/Scanner/LaTeX.py | 9 +- src/engine/SCons/Scanner/LaTeXTests.py | 4 +- src/engine/SCons/Scanner/Prog.py | 4 +- src/engine/SCons/Scanner/ProgTests.py | 4 +- src/engine/SCons/Scanner/RC.py | 4 +- src/engine/SCons/Scanner/RCTests.py | 4 +- src/engine/SCons/Scanner/ScannerTests.py | 4 +- src/engine/SCons/Scanner/__init__.py | 4 +- src/engine/SCons/Scanner/__init__.xml | 2 +- src/engine/SCons/Script/Interactive.py | 4 +- src/engine/SCons/Script/Main.py | 9 +- src/engine/SCons/Script/Main.xml | 2 +- src/engine/SCons/Script/MainTests.py | 4 +- src/engine/SCons/Script/SConsOptions.py | 4 +- src/engine/SCons/Script/SConscript.py | 4 +- src/engine/SCons/Script/SConscript.xml | 2 +- src/engine/SCons/Script/SConscriptTests.py | 4 +- src/engine/SCons/Script/__init__.py | 4 +- src/engine/SCons/Sig.py | 4 +- src/engine/SCons/Subst.py | 4 +- src/engine/SCons/Subst.xml | 2 +- src/engine/SCons/SubstTests.py | 4 +- src/engine/SCons/Taskmaster.py | 35 +- src/engine/SCons/TaskmasterTests.py | 95 ++++- src/engine/SCons/Tool/386asm.py | 4 +- src/engine/SCons/Tool/386asm.xml | 2 +- src/engine/SCons/Tool/BitKeeper.py | 4 +- src/engine/SCons/Tool/BitKeeper.xml | 2 +- src/engine/SCons/Tool/CVS.py | 4 +- src/engine/SCons/Tool/CVS.xml | 2 +- src/engine/SCons/Tool/FortranCommon.py | 4 +- src/engine/SCons/Tool/GettextCommon.py | 429 +++++++++++++++++++++ src/engine/SCons/Tool/JavaCommon.py | 4 +- src/engine/SCons/Tool/JavaCommonTests.py | 4 +- src/engine/SCons/Tool/MSCommon/__init__.py | 4 +- src/engine/SCons/Tool/MSCommon/arch.py | 4 +- src/engine/SCons/Tool/MSCommon/common.py | 4 +- src/engine/SCons/Tool/MSCommon/netframework.py | 4 +- src/engine/SCons/Tool/MSCommon/sdk.py | 4 +- src/engine/SCons/Tool/MSCommon/vc.py | 19 +- src/engine/SCons/Tool/MSCommon/vs.py | 31 +- src/engine/SCons/Tool/Perforce.py | 4 +- src/engine/SCons/Tool/Perforce.xml | 2 +- src/engine/SCons/Tool/PharLapCommon.py | 4 +- src/engine/SCons/Tool/PharLapCommonTests.py | 4 +- src/engine/SCons/Tool/RCS.py | 4 +- src/engine/SCons/Tool/RCS.xml | 2 +- src/engine/SCons/Tool/SCCS.py | 4 +- src/engine/SCons/Tool/SCCS.xml | 2 +- src/engine/SCons/Tool/Subversion.py | 4 +- src/engine/SCons/Tool/Subversion.xml | 2 +- src/engine/SCons/Tool/ToolTests.py | 4 +- src/engine/SCons/Tool/__init__.py | 4 +- src/engine/SCons/Tool/__init__.xml | 2 +- src/engine/SCons/Tool/aixc++.py | 4 +- src/engine/SCons/Tool/aixc++.xml | 2 +- src/engine/SCons/Tool/aixcc.py | 4 +- src/engine/SCons/Tool/aixcc.xml | 2 +- src/engine/SCons/Tool/aixf77.py | 4 +- src/engine/SCons/Tool/aixf77.xml | 2 +- src/engine/SCons/Tool/aixlink.py | 4 +- src/engine/SCons/Tool/aixlink.xml | 2 +- src/engine/SCons/Tool/applelink.py | 4 +- src/engine/SCons/Tool/applelink.xml | 2 +- src/engine/SCons/Tool/ar.py | 4 +- src/engine/SCons/Tool/ar.xml | 2 +- src/engine/SCons/Tool/as.py | 4 +- src/engine/SCons/Tool/as.xml | 2 +- src/engine/SCons/Tool/bcc32.py | 4 +- src/engine/SCons/Tool/bcc32.xml | 2 +- src/engine/SCons/Tool/c++.py | 4 +- src/engine/SCons/Tool/c++.xml | 2 +- src/engine/SCons/Tool/cc.py | 4 +- src/engine/SCons/Tool/cc.xml | 2 +- src/engine/SCons/Tool/cvf.py | 4 +- src/engine/SCons/Tool/cvf.xml | 2 +- src/engine/SCons/Tool/default.py | 4 +- src/engine/SCons/Tool/default.xml | 2 +- src/engine/SCons/Tool/dmd.py | 4 +- src/engine/SCons/Tool/dmd.xml | 2 +- src/engine/SCons/Tool/dvi.py | 4 +- src/engine/SCons/Tool/dvi.xml | 2 +- src/engine/SCons/Tool/dvipdf.py | 4 +- src/engine/SCons/Tool/dvipdf.xml | 2 +- src/engine/SCons/Tool/dvips.py | 4 +- src/engine/SCons/Tool/dvips.xml | 2 +- src/engine/SCons/Tool/f03.py | 4 +- src/engine/SCons/Tool/f03.xml | 2 +- src/engine/SCons/Tool/f77.py | 4 +- src/engine/SCons/Tool/f77.xml | 2 +- src/engine/SCons/Tool/f90.py | 4 +- src/engine/SCons/Tool/f90.xml | 2 +- src/engine/SCons/Tool/f95.py | 4 +- src/engine/SCons/Tool/f95.xml | 2 +- src/engine/SCons/Tool/filesystem.py | 4 +- src/engine/SCons/Tool/fortran.py | 4 +- src/engine/SCons/Tool/fortran.xml | 2 +- src/engine/SCons/Tool/g++.py | 4 +- src/engine/SCons/Tool/g++.xml | 2 +- src/engine/SCons/Tool/g77.py | 4 +- src/engine/SCons/Tool/g77.xml | 2 +- src/engine/SCons/Tool/gas.py | 4 +- src/engine/SCons/Tool/gas.xml | 2 +- src/engine/SCons/Tool/gcc.py | 4 +- src/engine/SCons/Tool/gcc.xml | 2 +- src/engine/SCons/Tool/gettext.py | 45 +++ src/engine/SCons/Tool/gettext.xml | 200 ++++++++++ src/engine/SCons/Tool/gfortran.py | 4 +- src/engine/SCons/Tool/gfortran.xml | 2 +- src/engine/SCons/Tool/gnulink.py | 4 +- src/engine/SCons/Tool/gnulink.xml | 2 +- src/engine/SCons/Tool/gs.py | 4 +- src/engine/SCons/Tool/gs.xml | 2 +- src/engine/SCons/Tool/hpc++.py | 4 +- src/engine/SCons/Tool/hpc++.xml | 2 +- src/engine/SCons/Tool/hpcc.py | 4 +- src/engine/SCons/Tool/hpcc.xml | 2 +- src/engine/SCons/Tool/hplink.py | 4 +- src/engine/SCons/Tool/hplink.xml | 2 +- src/engine/SCons/Tool/icc.py | 4 +- src/engine/SCons/Tool/icc.xml | 2 +- src/engine/SCons/Tool/icl.py | 4 +- src/engine/SCons/Tool/icl.xml | 2 +- src/engine/SCons/Tool/ifl.py | 4 +- src/engine/SCons/Tool/ifl.xml | 2 +- src/engine/SCons/Tool/ifort.py | 4 +- src/engine/SCons/Tool/ifort.xml | 2 +- src/engine/SCons/Tool/ilink.py | 4 +- src/engine/SCons/Tool/ilink.xml | 2 +- src/engine/SCons/Tool/ilink32.py | 4 +- src/engine/SCons/Tool/ilink32.xml | 2 +- src/engine/SCons/Tool/install.py | 4 +- src/engine/SCons/Tool/install.xml | 2 +- src/engine/SCons/Tool/intelc.py | 4 +- src/engine/SCons/Tool/intelc.xml | 2 +- src/engine/SCons/Tool/ipkg.py | 4 +- src/engine/SCons/Tool/jar.py | 4 +- src/engine/SCons/Tool/jar.xml | 2 +- src/engine/SCons/Tool/javac.py | 14 +- src/engine/SCons/Tool/javac.xml | 2 +- src/engine/SCons/Tool/javacTests.py | 102 +++++ src/engine/SCons/Tool/javah.py | 4 +- src/engine/SCons/Tool/javah.xml | 2 +- src/engine/SCons/Tool/latex.py | 4 +- src/engine/SCons/Tool/latex.xml | 2 +- src/engine/SCons/Tool/lex.py | 4 +- src/engine/SCons/Tool/lex.xml | 2 +- src/engine/SCons/Tool/link.py | 4 +- src/engine/SCons/Tool/link.xml | 2 +- src/engine/SCons/Tool/linkloc.py | 4 +- src/engine/SCons/Tool/linkloc.xml | 2 +- src/engine/SCons/Tool/m4.py | 4 +- src/engine/SCons/Tool/m4.xml | 2 +- src/engine/SCons/Tool/masm.py | 4 +- src/engine/SCons/Tool/masm.xml | 2 +- src/engine/SCons/Tool/midl.py | 4 +- src/engine/SCons/Tool/midl.xml | 2 +- src/engine/SCons/Tool/mingw.py | 12 +- src/engine/SCons/Tool/mingw.xml | 2 +- src/engine/SCons/Tool/msgfmt.py | 102 +++++ src/engine/SCons/Tool/msgfmt.xml | 102 +++++ src/engine/SCons/Tool/msginit.py | 114 ++++++ src/engine/SCons/Tool/msginit.xml | 168 ++++++++ src/engine/SCons/Tool/msgmerge.py | 98 +++++ src/engine/SCons/Tool/msgmerge.xml | 158 ++++++++ src/engine/SCons/Tool/mslib.py | 4 +- src/engine/SCons/Tool/mslib.xml | 2 +- src/engine/SCons/Tool/mslink.py | 21 +- src/engine/SCons/Tool/mslink.xml | 4 +- src/engine/SCons/Tool/mssdk.py | 4 +- src/engine/SCons/Tool/mssdk.xml | 2 +- src/engine/SCons/Tool/msvc.py | 4 +- src/engine/SCons/Tool/msvc.xml | 2 +- src/engine/SCons/Tool/msvs.py | 81 ++-- src/engine/SCons/Tool/msvs.xml | 2 +- src/engine/SCons/Tool/msvsTests.py | 4 +- src/engine/SCons/Tool/mwcc.py | 4 +- src/engine/SCons/Tool/mwcc.xml | 2 +- src/engine/SCons/Tool/mwld.py | 4 +- src/engine/SCons/Tool/mwld.xml | 2 +- src/engine/SCons/Tool/nasm.py | 4 +- src/engine/SCons/Tool/nasm.xml | 2 +- src/engine/SCons/Tool/packaging.xml | 2 +- src/engine/SCons/Tool/packaging/__init__.py | 4 +- src/engine/SCons/Tool/packaging/__init__.xml | 2 +- src/engine/SCons/Tool/packaging/ipk.py | 4 +- src/engine/SCons/Tool/packaging/msi.py | 4 +- src/engine/SCons/Tool/packaging/rpm.py | 4 +- src/engine/SCons/Tool/packaging/src_tarbz2.py | 4 +- src/engine/SCons/Tool/packaging/src_targz.py | 4 +- src/engine/SCons/Tool/packaging/src_zip.py | 4 +- src/engine/SCons/Tool/packaging/tarbz2.py | 4 +- src/engine/SCons/Tool/packaging/targz.py | 4 +- src/engine/SCons/Tool/packaging/zip.py | 4 +- src/engine/SCons/Tool/pdf.py | 4 +- src/engine/SCons/Tool/pdf.xml | 2 +- src/engine/SCons/Tool/pdflatex.py | 4 +- src/engine/SCons/Tool/pdflatex.xml | 2 +- src/engine/SCons/Tool/pdftex.py | 4 +- src/engine/SCons/Tool/pdftex.xml | 2 +- src/engine/SCons/Tool/qt.py | 4 +- src/engine/SCons/Tool/qt.xml | 2 +- src/engine/SCons/Tool/rmic.py | 4 +- src/engine/SCons/Tool/rmic.xml | 2 +- src/engine/SCons/Tool/rpcgen.py | 4 +- src/engine/SCons/Tool/rpcgen.xml | 2 +- src/engine/SCons/Tool/rpm.py | 4 +- src/engine/SCons/Tool/sgiar.py | 4 +- src/engine/SCons/Tool/sgiar.xml | 2 +- src/engine/SCons/Tool/sgic++.py | 4 +- src/engine/SCons/Tool/sgic++.xml | 2 +- src/engine/SCons/Tool/sgicc.py | 4 +- src/engine/SCons/Tool/sgicc.xml | 2 +- src/engine/SCons/Tool/sgilink.py | 4 +- src/engine/SCons/Tool/sgilink.xml | 2 +- src/engine/SCons/Tool/sunar.py | 4 +- src/engine/SCons/Tool/sunar.xml | 2 +- src/engine/SCons/Tool/sunc++.py | 4 +- src/engine/SCons/Tool/sunc++.xml | 2 +- src/engine/SCons/Tool/suncc.py | 4 +- src/engine/SCons/Tool/suncc.xml | 2 +- src/engine/SCons/Tool/sunf77.py | 4 +- src/engine/SCons/Tool/sunf77.xml | 2 +- src/engine/SCons/Tool/sunf90.py | 4 +- src/engine/SCons/Tool/sunf90.xml | 2 +- src/engine/SCons/Tool/sunf95.py | 4 +- src/engine/SCons/Tool/sunf95.xml | 2 +- src/engine/SCons/Tool/sunlink.py | 4 +- src/engine/SCons/Tool/sunlink.xml | 2 +- src/engine/SCons/Tool/swig.py | 4 +- src/engine/SCons/Tool/swig.xml | 2 +- src/engine/SCons/Tool/tar.py | 4 +- src/engine/SCons/Tool/tar.xml | 2 +- src/engine/SCons/Tool/tex.py | 90 ++++- src/engine/SCons/Tool/tex.xml | 2 +- src/engine/SCons/Tool/textfile.py | 4 +- src/engine/SCons/Tool/textfile.xml | 4 +- src/engine/SCons/Tool/tlib.py | 4 +- src/engine/SCons/Tool/tlib.xml | 2 +- src/engine/SCons/Tool/wix.py | 4 +- src/engine/SCons/Tool/xgettext.py | 333 ++++++++++++++++ src/engine/SCons/Tool/xgettext.xml | 288 ++++++++++++++ src/engine/SCons/Tool/yacc.py | 4 +- src/engine/SCons/Tool/yacc.xml | 2 +- src/engine/SCons/Tool/zip.py | 4 +- src/engine/SCons/Tool/zip.xml | 2 +- src/engine/SCons/Util.py | 18 +- src/engine/SCons/UtilTests.py | 4 +- src/engine/SCons/Variables/BoolVariable.py | 4 +- src/engine/SCons/Variables/BoolVariableTests.py | 4 +- src/engine/SCons/Variables/EnumVariable.py | 4 +- src/engine/SCons/Variables/EnumVariableTests.py | 4 +- src/engine/SCons/Variables/ListVariable.py | 4 +- src/engine/SCons/Variables/ListVariableTests.py | 4 +- src/engine/SCons/Variables/PackageVariable.py | 4 +- src/engine/SCons/Variables/PackageVariableTests.py | 4 +- src/engine/SCons/Variables/PathVariable.py | 4 +- src/engine/SCons/Variables/PathVariableTests.py | 4 +- src/engine/SCons/Variables/VariablesTests.py | 4 +- src/engine/SCons/Variables/__init__.py | 4 +- src/engine/SCons/Warnings.py | 4 +- src/engine/SCons/WarningsTests.py | 4 +- src/engine/SCons/__init__.py | 14 +- src/engine/SCons/compat/__init__.py | 4 +- src/engine/SCons/compat/_scons_builtins.py | 4 +- src/engine/SCons/compat/_scons_collections.py | 4 +- src/engine/SCons/compat/_scons_dbm.py | 4 +- src/engine/SCons/compat/_scons_hashlib.py | 4 +- src/engine/SCons/compat/_scons_io.py | 4 +- src/engine/SCons/cpp.py | 4 +- src/engine/SCons/cppTests.py | 4 +- src/engine/SCons/exitfuncs.py | 4 +- src/script/scons-time.py | 4 +- src/script/scons.bat | 6 +- src/script/scons.py | 14 +- src/script/sconsign.py | 14 +- src/setup.py | 6 +- src/test_aegistests.py | 4 +- src/test_files.py | 4 +- src/test_interrupts.py | 4 +- src/test_pychecker.py | 4 +- src/test_setup.py | 4 +- src/test_strings.py | 8 +- 479 files changed, 4133 insertions(+), 1019 deletions(-) create mode 100644 doc/user/gettext.in create mode 100644 doc/user/gettext.xml create mode 100644 src/engine/SCons/Tool/GettextCommon.py create mode 100644 src/engine/SCons/Tool/gettext.py create mode 100644 src/engine/SCons/Tool/gettext.xml create mode 100644 src/engine/SCons/Tool/javacTests.py create mode 100644 src/engine/SCons/Tool/msgfmt.py create mode 100644 src/engine/SCons/Tool/msgfmt.xml create mode 100644 src/engine/SCons/Tool/msginit.py create mode 100644 src/engine/SCons/Tool/msginit.xml create mode 100644 src/engine/SCons/Tool/msgmerge.py create mode 100644 src/engine/SCons/Tool/msgmerge.xml create mode 100644 src/engine/SCons/Tool/xgettext.py create mode 100644 src/engine/SCons/Tool/xgettext.xml diff --git a/LICENSE b/LICENSE index c0de36f..c9b6473 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/SConstruct b/SConstruct index ab6e2d5..43aae5b 100644 --- a/SConstruct +++ b/SConstruct @@ -5,13 +5,13 @@ # When this gets changed, you must also change the copyright_years string # in QMTest/TestSCons.py so the test scripts look for the right string. -copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011' +copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012' # This gets inserted into the man pages to reflect the month of release. -month_year = 'September 2011' +month_year = 'August 2012' # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -43,7 +43,7 @@ import sys import tempfile project = 'scons' -default_version = '2.1.0' +default_version = '2.2.0' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years platform = distutils.util.get_platform() @@ -794,7 +794,7 @@ for p in [ scons ]: # # Now run everything in src_file through the sed command we - # concocted to expand SConstruct, 2.1.0, etc. + # concocted to expand SConstruct, 2.2.0, etc. # for b in src_files: s = p['filemap'].get(b, b) @@ -1066,7 +1066,7 @@ for p in [ scons ]: commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY sdist --formats=%s" % \ ','.join(distutils_formats)) - commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst") + commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name win32 --user-access-control auto") env.Command(distutils_targets, build_src_files, commands) diff --git a/bin/import-test.py b/bin/import-test.py index cb95ff2..014d0f3 100644 --- a/bin/import-test.py +++ b/bin/import-test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # tree2test.py - turn a directory tree into TestSCons code # @@ -25,7 +25,7 @@ # """ triple-quotes will need to have their contents edited by hand. # -__revision__ = "bin/import-test.py 5357 2011/09/09 21:31:03 bdeegan" +__revision__ = "bin/import-test.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" import os.path import sys diff --git a/bin/linecount.py b/bin/linecount.py index 7121ebd..26b7b77 100644 --- a/bin/linecount.py +++ b/bin/linecount.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Count statistics about SCons test and source files. This must be run # against a fully-populated tree (for example, one that's been freshly @@ -23,7 +23,7 @@ # interesting one for most purposes. from __future__ import division -__revision__ = "bin/linecount.py 5357 2011/09/09 21:31:03 bdeegan" +__revision__ = "bin/linecount.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" import os.path diff --git a/bin/restore.sh b/bin/restore.sh index 3aab7ae..2efb22e 100644 --- a/bin/restore.sh +++ b/bin/restore.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh # -# Simple hack script to restore __revision__, __COPYRIGHT_, 2.1.0 +# Simple hack script to restore __revision__, __COPYRIGHT_, 2.2.0 # and other similar variables to what gets checked in to source. This # comes in handy when people send in diffs based on the released source. # @@ -22,9 +22,9 @@ header() { for i in `find $DIRS -name '*.py'`; do header $i ed $i <\n', '-->') input = xml_preamble + content + xml_postamble try: - saxparser.parse(StringIO(input)) + saxparser.parse(StringIO(unicode(input))) except: sys.stderr.write("error in %s\n" % f) raise diff --git a/bin/update-release-info.py b/bin/update-release-info.py index 1c84466..cc4fa4e 100644 --- a/bin/update-release-info.py +++ b/bin/update-release-info.py @@ -36,7 +36,7 @@ In 'post' mode, files are prepared for the next release cycle: src/Announce.txt. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -57,7 +57,7 @@ In 'post' mode, files are prepared for the next release cycle: # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "bin/update-release-info.py 5357 2011/09/09 21:31:03 bdeegan" +__revision__ = "bin/update-release-info.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" import os import sys @@ -108,24 +108,17 @@ if DEBUG: print 'release date', release_date if mode == 'develop' and version_tuple[3] != 'alpha': version_tuple == version_tuple[:3] + ('alpha', 0) -if version_tuple[3] != 'final': +if len(version_tuple) > 3 and version_tuple[3] != 'final': if mode == 'develop': version_tuple = version_tuple[:4] + ('yyyymmdd',) else: yyyy,mm,dd,_,_,_ = release_date version_tuple = version_tuple[:4] + ((yyyy*100 + mm)*100 + dd,) - -import pdb -pdb.set_trace() - -if mode == 'final' or mode == 'release': - version_string = '.'.join(map(str, version_tuple[0:3])) +version_string = '.'.join(map(str, version_tuple)) +if len(version_tuple) > 3: + version_type = version_tuple[3] else: - version_string = '.'.join(map(str, version_tuple)) - -version_type = version_tuple[3] - - + version_type = 'final' if DEBUG: print 'version string', version_string if version_type not in ['alpha', 'beta', 'candidate', 'final']: @@ -194,9 +187,7 @@ class UpdateFile(object): ''' XXX ''' - if DEBUG: print "content before:%s"%self.content self.content = self.match_rel.sub(replacement, self.content, count) - if DEBUG: print "content after :%s"%self.content # Determine the release date and the pattern to match a date # Mon, 05 Jun 2010 21:17:15 -0700 diff --git a/doc/SConscript b/doc/SConscript index 54b620e..1206e6f 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -3,7 +3,7 @@ # # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the diff --git a/doc/design/scons.mod b/doc/design/scons.mod index 33538fb..d059d71 100644 --- a/doc/design/scons.mod +++ b/doc/design/scons.mod @@ -1,6 +1,6 @@ + + + The &t-link-gettext; toolset supports internationalization and localization + of SCons-based projects. Builders provided by &t-link-gettext; automatize + generation and updates of translation files. You can manage translations and + translation templates similarly to how it's done with autotools. + + +
+ Prerequisites + + To follow examples provided in this chapter set up your operating system to + support two or more languages. In following examples we use locales + en_US, de_DE, and + pl_PL. + + + + Ensure, that you have GNU gettext + utilities installed on your system. + + + + To edit translation files you may wish to install poedit editor. + +
+ +
+ Simple project + + Let's start with a very simple project, the "Hello world" program + for example + + + /* hello.c */ + #include <stdio.h> + int main(int argc, char* argv[]) + { + printf("Hello world\n"); + return 0; + } + + + + Prepare a SConstruct to compile the program + as usual. + + + # SConstruct + env = Environment() + hello = Program(["hello.c"]) + + + + + + Now we'll convert the project to a multi-lingual one. If you don't + already have GNU gettext + utilities installed, install them from your preffered + package repository, or download from + http://ftp.gnu.org/gnu/gettext/. For the purpose of this example, + you should have following three locales installed on your system: + en_US, de_DE and + pl_PL. On debian, for example, you may enable certain + locales through dpkg-reconfigure locales. + + + + First prepare the hello.c program for + internationalization. Change the previous code so it reads as follows: + + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + return 0; + } + + + Detailed recipes for such conversion can + be found at + http://www.gnu.org/software/gettext/manual/gettext.html#Sources. + The gettext("...") has two purposes. + First, it marks messages for the xgettext(1) program, which + we will use to extract from the sources the messages for localization. + Second, it calls the gettext library internals to + translate the message at runtime. + + + + Now we shall instruct SCons how to generate and maintain translation files. + For that, use the &b-link-Translate; builder and &b-link-MOFiles; builder. + The first one takes source files, extracts internationalized + messages from them, creates so-called POT file + (translation template), and then creates PO translation + files, one for each requested language. Later, during the development + lifecycle, the builder keeps all these files up-to date. The + &b-link-MOFiles; builder compiles the PO files to binary + form. Then install the MO files under directory + called locale. + + + The completed + SConstruct is as follows: + + + # SConstruct + env = Environment( tools = ['default', 'gettext'] ) + hello = env.Program(["hello.c"]) + env['XGETTEXTFLAGS'] = [ + '--package-name=%s' % 'hello', + '--package-version=%s' % '1.0', + ] + po = env.Translate(["pl","en", "de"], ["hello.c"], POAUTOINIT = 1) + mo = env.MOFiles(po) + InstallAs(["locale/en/LC_MESSAGES/hello.mo"], ["en.mo"]) + InstallAs(["locale/pl/LC_MESSAGES/hello.mo"], ["pl.mo"]) + InstallAs(["locale/de/LC_MESSAGES/hello.mo"], ["de.mo"]) + + + + + Generate the translation files with scons po-update. + You should see the output from SCons simillar to this: + + user@host:$ scons po-update + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (new file) + msginit --no-translator -l pl -i messages.pot -o pl.po + Created pl.po. + msginit --no-translator -l en -i messages.pot -o en.po + Created en.po. + msginit --no-translator -l de -i messages.pot -o de.po + Created de.po. + scons: done building targets. + + + + + If everything is right, you should see following new files. + + user@host:$ ls *.po* + de.po en.po messages.pot pl.po + + + + + Open en.po in poedit and provide + the English translation to message "Hello world\n". Do the + same for de.po (deutsch) and + pl.po (polish). Let the translations be, for example: + + + en: "Welcome to beautiful world!\n" + + + de: "Hallo Welt!\n" + + + pl: "Witaj swiecie!\n" + + + + + Now compile the project by executing scons. The + output should be similar to this: + + user@host:$ scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o de.mo de.po + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + SCons automatically compiled the PO files to binary format + MO, and the InstallAs lines installed + these files under locale folder. + + + Your program should be now ready. You may try it as follows (linux): + + user@host:$ LANG=en_US.UTF-8 ./hello + Welcome to beautiful world + + + user@host:$ LANG=de_DE.UTF-8 ./hello + Hallo Welt + + + user@host:$ LANG=pl_PL.UTF-8 ./hello + Witaj swiecie + + + + To demonstrate the further life of translation files, let's change Polish + translation (poedit pl.po) to "Witaj drogi + swiecie\n". Run scons to see how scons + reacts to this + + user@host:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + Now, open hello.c and add another one + printf line with new message. + + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + return 0; + } + + + + + Compile project with scons. This time, the + msgmerge(1) program is used by SCons to update + PO file. The output from compilation is like: + + user@host:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (messages in file were outdated) + msgmerge --update de.po messages.pot + ... done. + msgfmt -c -o de.mo de.po + msgmerge --update en.po messages.pot + ... done. + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgmerge --update pl.po messages.pot + ... done. + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + The next example demonstrates what happens if we change the source code + in such way that the internationalized messages do not change. The answer + is that none of translation files (POT, + PO) are touched (i.e. no content changes, no + creation/modification time changed and so on). Let's append another + line to the program (after the last printf), so its code becomes: + + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + printf("----------------\n"); + return a; + } + + + Compile the project. You'll see on your screen + + user@host:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Not writting 'messages.pot' (messages in file found to be up-to-date) + gcc -o hello.o -c hello.c + gcc -o hello hello.o + scons: done building targets. + + As you see, the internationalized messages ditn't change, so the + POT and the rest of translation files have not + even been touched. + +
diff --git a/doc/user/gettext.xml b/doc/user/gettext.xml new file mode 100644 index 0000000..ebaf3c0 --- /dev/null +++ b/doc/user/gettext.xml @@ -0,0 +1,334 @@ + + + + The &t-link-gettext; toolset supports internationalization and localization + of SCons-based projects. Builders provided by &t-link-gettext; automatize + generation and updates of translation files. You can manage translations and + translation templates similarly to how it's done with autotools. + + +
+ Prerequisites + + To follow examples provided in this chapter set up your operating system to + support two or more languages. In following examples we use locales + en_US, de_DE, and + pl_PL. + + + + Ensure, that you have GNU gettext + utilities installed on your system. + + + + To edit translation files you may wish to install poedit editor. + +
+ +
+ Simple project + + Let's start with a very simple project, the "Hello world" program + for example + + /* hello.c */ + #include <stdio.h> + int main(int argc, char* argv[]) + { + printf("Hello world\n"); + return 0; + } + + + Prepare a SConstruct to compile the program + as usual. + + # SConstruct + env = Environment() + hello = Program(["hello.c"]) + + + + + Now we'll convert the project to a multi-lingual one. If you don't + already have GNU gettext + utilities installed, install them from your preffered + package repository, or download from + http://ftp.gnu.org/gnu/gettext/. For the purpose of this example, + you should have following three locales installed on your system: + en_US, de_DE and + pl_PL. On debian, for example, you may enable certain + locales through dpkg-reconfigure locales. + + + + First prepare the hello.c program for + internationalization. Change the previous code so it reads as follows: + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + return 0; + } + + Detailed recipes for such conversion can + be found at + http://www.gnu.org/software/gettext/manual/gettext.html#Sources. + The gettext("...") has two purposes. + First, it marks messages for the xgettext(1) program, which + we will use to extract from the sources the messages for localization. + Second, it calls the gettext library internals to + translate the message at runtime. + + + + Now we shall instruct SCons how to generate and maintain translation files. + For that, use the &b-link-Translate; builder and &b-link-MOFiles; builder. + The first one takes source files, extracts internationalized + messages from them, creates so-called POT file + (translation template), and then creates PO translation + files, one for each requested language. Later, during the development + lifecycle, the builder keeps all these files up-to date. The + &b-link-MOFiles; builder compiles the PO files to binary + form. Then install the MO files under directory + called locale. + + + The completed + SConstruct is as follows: + + # SConstruct + env = Environment( tools = ['default', 'gettext'] ) + hello = env.Program(["hello.c"]) + env['XGETTEXTFLAGS'] = [ + '--package-name=%s' % 'hello', + '--package-version=%s' % '1.0', + ] + po = env.Translate(["pl","en", "de"], ["hello.c"], POAUTOINIT = 1) + mo = env.MOFiles(po) + InstallAs(["locale/en/LC_MESSAGES/hello.mo"], ["en.mo"]) + InstallAs(["locale/pl/LC_MESSAGES/hello.mo"], ["pl.mo"]) + InstallAs(["locale/de/LC_MESSAGES/hello.mo"], ["de.mo"]) + + + + Generate the translation files with scons po-update. + You should see the output from SCons simillar to this: + + user@host:$ scons po-update + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (new file) + msginit --no-translator -l pl -i messages.pot -o pl.po + Created pl.po. + msginit --no-translator -l en -i messages.pot -o en.po + Created en.po. + msginit --no-translator -l de -i messages.pot -o de.po + Created de.po. + scons: done building targets. + + + + + If everything is right, you should see following new files. + + user@host:$ ls *.po* + de.po en.po messages.pot pl.po + + + + + Open en.po in poedit and provide + the English translation to message "Hello world\n". Do the + same for de.po (deutsch) and + pl.po (polish). Let the translations be, for example: + + + en: "Welcome to beautiful world!\n" + + + de: "Hallo Welt!\n" + + + pl: "Witaj swiecie!\n" + + + + + Now compile the project by executing scons. The + output should be similar to this: + + user@host:$ scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o de.mo de.po + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + SCons automatically compiled the PO files to binary format + MO, and the InstallAs lines installed + these files under locale folder. + + + Your program should be now ready. You may try it as follows (linux): + + user@host:$ LANG=en_US.UTF-8 ./hello + Welcome to beautiful world + + + user@host:$ LANG=de_DE.UTF-8 ./hello + Hallo Welt + + + user@host:$ LANG=pl_PL.UTF-8 ./hello + Witaj swiecie + + + + To demonstrate the further life of translation files, let's change Polish + translation (poedit pl.po) to "Witaj drogi + swiecie\n". Run scons to see how scons + reacts to this + + user@host:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + Now, open hello.c and add another one + printf line with new message. + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + return 0; + } + + + + Compile project with scons. This time, the + msgmerge(1) program is used by SCons to update + PO file. The output from compilation is like: + + user@host:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Writting 'messages.pot' (messages in file were outdated) + msgmerge --update de.po messages.pot + ... done. + msgfmt -c -o de.mo de.po + msgmerge --update en.po messages.pot + ... done. + msgfmt -c -o en.mo en.po + gcc -o hello.o -c hello.c + gcc -o hello hello.o + Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" + Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" + msgmerge --update pl.po messages.pot + ... done. + msgfmt -c -o pl.mo pl.po + Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" + scons: done building targets. + + + + The next example demonstrates what happens if we change the source code + in such way that the internationalized messages do not change. The answer + is that none of translation files (POT, + PO) are touched (i.e. no content changes, no + creation/modification time changed and so on). Let's append another + line to the program (after the last printf), so its code becomes: + + /* hello.c */ + #include <stdio.h> + #include <libintl.h> + #include <locale.h> + int main(int argc, char* argv[]) + { + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + printf("----------------\n"); + return a; + } + + Compile the project. You'll see on your screen + + user@host:$scons + scons: Reading SConscript files ... + scons: done reading SConscript files. + scons: Building targets ... + Entering '/home/ptomulik/projects/tmp' + xgettext --package-name=hello --package-version=1.0 -o - hello.c + Leaving '/home/ptomulik/projects/tmp' + Not writting 'messages.pot' (messages in file found to be up-to-date) + gcc -o hello.o -c hello.c + gcc -o hello hello.o + scons: done building targets. + + As you see, the internationalized messages ditn't change, so the + POT and the rest of translation files have not + even been touched. + +
diff --git a/doc/user/hierarchy.in b/doc/user/hierarchy.in index 950bc8a..855c54a 100644 --- a/doc/user/hierarchy.in +++ b/doc/user/hierarchy.in @@ -1,6 +1,6 @@ + + +This is actually a toolset, which supports internationalization and +localization of sofware being constructed with SCons. The toolset loads +following tools: + + + + &t-link-xgettext; - to extract internationalized messages from source code to + POT file(s), + + + &t-link-msginit; - may be optionally used to initialize PO + files, + + + &t-link-msgmerge; - to update PO files, that already contain + translated messages, + + &t-link-msgfmt; - to compile textual PO file to binary + installable MO file. + + + +When you enable &t-gettext;, it internally loads all abovementioned tools, +so you're encouraged to see their individual documentation. + +Each of the above tools provides its own builder(s) which may be used to +perform particular activities related to software internationalization. You +may be however interested in top-level builder +&b-Translate; described few paragraphs later. + +To use &t-gettext; tools add 'gettext' tool to your +environment: + + env = Environment( tools = ['default', 'gettext'] ) + + + + + + + + + + + +This pseudo-builder belongs to &t-link-gettext; toolset. The builder extracts +internationalized messages from source files, updates POT +template (if necessary) and then updates PO translations (if +necessary). If &cv-link-POAUTOINIT; is set, missing PO files +will be automatically created (i.e. without translator person intervention). +The variables &cv-link-LINGUAS_FILE; and &cv-link-POTDOMAIN; are taken into +acount too. All other construction variables used by &b-link-POTUpdate;, and +&b-link-POUpdate; work here too. + +Example 1. +The simplest way is to specify input files and output languages inline in +a SCons script when invoking &b-Translate; + +# SConscript in 'po/' directory +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) + + +Example 2. +If you wish, you may also stick to conventional style known from +autotools, i.e. using +POTFILES.in and LINGUAS files + +# LINGUAS +en pl +#end + + + +# POTFILES.in +a.cpp +b.cpp +# end + + + +# SConscript +env = Environment( tools = ["default", "gettext"] ) +env['POAUTOINIT'] = 1 +env['XGETTEXTPATH'] = ['../'] +env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') + + +The last approach is perhaps the recommended one. It allows easily split +internationalization/localization onto separate SCons scripts, where a script +in source tree is responsible for translations (from sources to +PO files) and script(s) under variant directories are +responsible for compilation of PO to MO +files to and for installation of MO files. The "gluing +factor" synchronizing these two scripts is then the content of +LINGUAS file. Note, that the updated +POT and PO files are usually going to be +committed back to the repository, so they must be updated within the source +directory (and not in variant directories). Additionaly, the file listing of +po/ directory contains LINGUAS file, +so the source tree looks familiar to translators, and they may work with the +project in their usual way. + +Example 3. +Let's prepare a development tree as below + + project/ + + SConstruct + + build/ + + src/ + + po/ + + SConscript + + SConscript.i18n + + POTFILES.in + + LINGUAS + +with build being variant directory. Write the top-level +SConstruct script as follows + + # SConstruct + env = Environment( tools = ["default", "gettext"] ) + VariantDir('build', 'src', duplicate = 0) + env['POAUTOINIT'] = 1 + SConscript('src/po/SConscript.i18n', exports = 'env') + SConscript('build/po/SConscript', exports = 'env') + +the src/po/SConscript.i18n as + + # src/po/SConscript.i18n + Import('env') + env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../']) + +and the src/po/SConscript + + # src/po/SConscript + Import('env') + env.MOFiles(LINGUAS_FILE = 1) + +Such setup produces POT and PO files +under source tree in src/po/ and binary +MO files under variant tree in +build/po/. This way the POT and +PO files are separated from other output files, which must +not be committed back to source repositories (e.g. MO +files). + +In above example, the PO files are not updated, +nor created automatically when you issue scons '.' command. +The files must be updated (created) by hand via scons +po-update and then MO files can be compiled by +running scons '.'. + + + + + + +The &cv-POTDOMAIN; defines default domain, used to generate +POT filename as &cv-POTDOMAIN;.pot when +no POT file name is provided by the user. This applies to +&b-link-POTUpdate;, &b-link-POInit; and &b-link-POUpdate; builders (and +builders, that use them, e.g. &b-Translate;). Normally (if &cv-POTDOMAIN; is +not defined), the builders use messages.pot as default +POT file name. + + + + + +The &cv-POAUTOINIT; variable, if set to True (on non-zero +numeric value), let the &t-link-msginit; tool to automatically initialize +missing PO files with +msginit(1). This applies to both, +&b-link-POInit; and &b-link-POUpdate; builders (and others that use any of +them). + + + + + +The &cv-LINGUAS_FILE; defines file(s) containing list of additional linguas +to be processed by &b-link-POInit;, &b-link-POUpdate; or &b-link-MOFiles; +builders. It also affects &b-link-Translate; builder. If the variable contains +a string, it defines name of the list file. The &cv-LINGUAS_FILE; may be a +list of file names as well. If &cv-LINGUAS_FILE; is set to +True (or non-zero numeric value), the list will be read from +default file named +LINGUAS. + + + diff --git a/src/engine/SCons/Tool/gfortran.py b/src/engine/SCons/Tool/gfortran.py index 143af4c..2f9bddc 100644 --- a/src/engine/SCons/Tool/gfortran.py +++ b/src/engine/SCons/Tool/gfortran.py @@ -10,7 +10,7 @@ selection method. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -32,7 +32,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/gfortran.py 5357 2011/09/09 21:31:03 bdeegan" +__revision__ = "src/engine/SCons/Tool/gfortran.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" import SCons.Util diff --git a/src/engine/SCons/Tool/gfortran.xml b/src/engine/SCons/Tool/gfortran.xml index a6a6850..8544c31 100644 --- a/src/engine/SCons/Tool/gfortran.xml +++ b/src/engine/SCons/Tool/gfortran.xml @@ -1,5 +1,5 @@ + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides scons +interface to msgfmt(1) command, which generates binary +message catalog (MO) from a textual translation description +(PO). + + +MOSUFFIX +MSGFMT +MSGFMTCOM +MSGFMTCOMSTR +MSGFMTFLAGS +POSUFFIX + + +LINGUAS_FILE + + + + + +This builder belongs to &t-link-msgfmt; tool. The builder compiles +PO files to MO files. + +Example 1. +Create pl.mo and en.mo by compiling +pl.po and en.po: + + # ... + env.MOFiles(['pl', 'en']) + + +Example 2. +Compile files for languages defined in LINGUAS file: + + # ... + env.MOFiles(LINGUAS_FILE = 1) + + +Example 3. +Create pl.mo and en.mo by compiling +pl.po and en.po plus files for +languages defined in LINGUAS file: + + # ... + env.MOFiles(['pl', 'en'], LINGUAS_FILE = 1) + + +Example 4. +Compile files for languages defined in LINGUAS file +(another version): + + # ... + env['LINGUAS_FILE'] = 1 + env.MOFiles() + + + + + + +Suffix used for MO files (default: '.mo'). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +Absolute path to msgfmt(1) binary, found by +Detect(). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +Complete command line to run msgfmt(1) program. +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +String to display when msgfmt(1) is invoked +(default: '', which means ``print &cv-link-MSGFMTCOM;''). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + + + + +Additional flags to msgfmt(1). +See &t-link-msgfmt; tool and &b-link-MOFiles; builder. + + diff --git a/src/engine/SCons/Tool/msginit.py b/src/engine/SCons/Tool/msginit.py new file mode 100644 index 0000000..210fbca --- /dev/null +++ b/src/engine/SCons/Tool/msginit.py @@ -0,0 +1,114 @@ +""" msginit tool + +Tool specific initialization of msginit tool. +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "src/engine/SCons/Tool/msginit.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" + +import SCons.Warnings +import SCons.Builder +import re + +############################################################################# +def _optional_no_translator_flag(env): + """ Return '--no-translator' flag if we run *msginit(1)* in non-interactive + mode.""" + import SCons.Util + if env.has_key('POAUTOINIT'): + autoinit = env['POAUTOINIT'] + else: + autoinit = False + if autoinit: + return [SCons.Util.CLVar('--no-translator')] + else: + return [SCons.Util.CLVar('')] +############################################################################# + +############################################################################# +def _POInitBuilder(env, **kw): + """ Create builder object for `POInit` builder. """ + import SCons.Action + from SCons.Tool.GettextCommon import _init_po_files, _POFileBuilder + action = SCons.Action.Action(_init_po_files, None) + return _POFileBuilder(env, action=action, target_alias='$POCREATE_ALIAS') +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POInitBuilderWrapper(env, target=None, source=_null, **kw): + """ Wrapper for _POFileBuilder. We use it to make user's life easier. + + This wrapper checks for `$POTDOMAIN` construction variable (or override in + `**kw`) and treats it appropriatelly. + """ + if source is _null: + if 'POTDOMAIN' in kw: + domain = kw['POTDOMAIN'] + elif env.has_key('POTDOMAIN'): + domain = env['POTDOMAIN'] + else: + domain = 'messages' + source = [ domain ] # NOTE: Suffix shall be appended automatically + return env._POInitBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate the `msginit` tool """ + import SCons.Util + from SCons.Tool.GettextCommon import _detect_msginit + env['MSGINIT'] = _detect_msginit(env) + msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' + # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded + # (sometimes we really don't need it) + env.SetDefault( + POSUFFIX = ['.po'], + POTSUFFIX = ['.pot'], + _MSGINITLOCALE = '${TARGET.filebase}', + _MSGNoTranslator = _optional_no_translator_flag, + MSGINITCOM = msginitcom, + MSGINITCOMSTR = '', + MSGINITFLAGS = [ ], + POAUTOINIT = False, + POCREATE_ALIAS = 'po-create' + ) + env.Append( BUILDERS = { '_POInitBuilder' : _POInitBuilder(env) } ) + env.AddMethod(_POInitBuilderWrapper, 'POInit') + env.AlwaysBuild(env.Alias('$POCREATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msginit_exists + return _msginit_exists(env) +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/msginit.xml b/src/engine/SCons/Tool/msginit.xml new file mode 100644 index 0000000..34b2795 --- /dev/null +++ b/src/engine/SCons/Tool/msginit.xml @@ -0,0 +1,168 @@ + + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides +scons interface to msginit(1) program, which creates new +PO file, initializing the meta information with values from +user's environment (or options). + + +MSGINIT +MSGINITCOM +MSGINITCOMSTR +MSGINITFLAGS +POAUTOINIT +POCREATE_ALIAS +POSUFFIX +POTSUFFIX +_MSGINITLOCALE + + +POTDOMAIN +LINGUAS_FILE +POAUTOINIT + + + + + +This builder belongs to &t-link-msginit; tool. The builder initializes missing +PO file(s) if &cv-link-POAUTOINIT; is set. If +&cv-link-POAUTOINIT; is not set (default), &b-POInit; prints instruction for +user (that is supposed to be a translator), telling how the +PO file should be initialized. In normal projects +you should not use &b-POInit; and use &b-link-POUpdate; +instead. &b-link-POUpdate; chooses intelligently between +msgmerge(1) and msginit(1). &b-POInit; +always uses msginit(1) and should be regarded as builder for +special purposes or for temporary use (e.g. for quick, one time initialization +of a bunch of PO files) or for tests. + +Target nodes defined through &b-POInit; are not built by default (they're +Ignored from '.' node) but are added to +special Alias ('po-create' by default). +The alias name may be changed through the &cv-link-POCREATE_ALIAS; +construction variable. All PO files defined through +&b-POInit; may be easily initialized by scons po-create. + +Example 1. +Initialize en.po and pl.po from +messages.pot: + + # ... + env.POInit(['en', 'pl']) # messages.pot --> [en.po, pl.po] + + +Example 2. +Initialize en.po and pl.po from +foo.pot: + + # ... + env.POInit(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.po] + + +Example 3. +Initialize en.po and pl.po from +foo.pot but using &cv-link-POTDOMAIN; construction +variable: + + # ... + env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] + + +Example 4. +Initialize PO files for languages defined in +LINGUAS file. The files will be initialized from template +messages.pot: + + # ... + env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file + + +Example 5. +Initialize en.po and pl.pl +PO files plus files for languages defined in +LINGUAS file. The files will be initialized from template +messages.pot: + + # ... + env.POInit(['en', 'pl'], LINGUAS_FILE = 1) + + +Example 6. +You may preconfigure your environment first, and then initialize +PO files: + + # ... + env['POAUTOINIT'] = 1 + env['LINGUAS_FILE'] = 1 + env['POTDOMAIN'] = 'foo' + env.POInit() + +which has same efect as: + + # ... + env.POInit(POAUTOINIT = 1, LINGUAS_FILE = 1, POTDOMAIN = 'foo') + + + + + + + +Common alias for all PO files created with &b-POInit; +builder (default: 'po-create'). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Suffix used for PO files (default: '.po') +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Path to msginit(1) program (found via +Detect()). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Complete command line to run msginit(1) program. +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +String to display when msginit(1) is invoked +(default: '', which means ``print &cv-link-MSGINITCOM;''). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +List of additional flags to msginit(1) (default: +[]). +See &t-link-msginit; tool and &b-link-POInit; builder. + + + + + +Internal ``macro''. Computes locale (language) name based on target filename +(default: '${TARGET.filebase}' ). + +See &t-link-msginit; tool and &b-link-POInit; builder. + diff --git a/src/engine/SCons/Tool/msgmerge.py b/src/engine/SCons/Tool/msgmerge.py new file mode 100644 index 0000000..2bc89f4 --- /dev/null +++ b/src/engine/SCons/Tool/msgmerge.py @@ -0,0 +1,98 @@ +""" msgmerget tool + +Tool specific initialization for `msgmerge` tool. +""" + +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__revision__ = "src/engine/SCons/Tool/msgmerge.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" + +############################################################################# +def _update_or_init_po_files(target, source, env): + """ Action function for `POUpdate` builder """ + import SCons.Action + from SCons.Tool.GettextCommon import _init_po_files + for tgt in target: + if tgt.rexists(): + action = SCons.Action.Action('$MSGMERGECOM', '$MSGMERGECOMSTR') + else: + action = _init_po_files + status = action([tgt], source, env) + if status : return status + return 0 +############################################################################# + +############################################################################# +def _POUpdateBuilder(env, **kw): + """ Create an object of `POUpdate` builder """ + import SCons.Action + from SCons.Tool.GettextCommon import _POFileBuilder + action = SCons.Action.Action(_update_or_init_po_files, None) + return _POFileBuilder(env, action=action, target_alias='$POUPDATE_ALIAS') +############################################################################# + +############################################################################# +from SCons.Environment import _null +############################################################################# +def _POUpdateBuilderWrapper(env, target=None, source=_null, **kw): + """ Wrapper for `POUpdate` builder - make user's life easier """ + if source is _null: + if 'POTDOMAIN' in kw: + domain = kw['POTDOMAIN'] + elif env.has_key('POTDOMAIN') and env['POTDOMAIN']: + domain = env['POTDOMAIN'] + else: + domain = 'messages' + source = [ domain ] # NOTE: Suffix shall be appended automatically + return env._POUpdateBuilder(target, source, **kw) +############################################################################# + +############################################################################# +def generate(env,**kw): + """ Generate the `xgettext` tool """ + from SCons.Tool.GettextCommon import _detect_msgmerge + env['MSGMERGE'] = _detect_msgmerge(env) + env.SetDefault( + POTSUFFIX = ['.pot'], + POSUFFIX = ['.po'], + MSGMERGECOM = '$MSGMERGE $MSGMERGEFLAGS --update $TARGET $SOURCE', + MSGMERGECOMSTR = '', + MSGMERGEFLAGS = [ ], + POUPDATE_ALIAS = 'po-update' + ) + env.Append(BUILDERS = { '_POUpdateBuilder':_POUpdateBuilder(env) }) + env.AddMethod(_POUpdateBuilderWrapper, 'POUpdate') + env.AlwaysBuild(env.Alias('$POUPDATE_ALIAS')) +############################################################################# + +############################################################################# +def exists(env): + """ Check if the tool exists """ + from SCons.Tool.GettextCommon import _msgmerge_exists + return _msgmerge_exists(env) +############################################################################# + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/msgmerge.xml b/src/engine/SCons/Tool/msgmerge.xml new file mode 100644 index 0000000..43a5b69 --- /dev/null +++ b/src/engine/SCons/Tool/msgmerge.xml @@ -0,0 +1,158 @@ + + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides +scons interface to msgmerge(1) command, which merges two +Uniform style .po files together. + + +MSGMERGE +MSGMERGECOM +MSGMERGECOMSTR +MSGMERGEFLAGS +POSUFFIX +POTSUFFIX +POUPDATE_ALIAS + + +POTDOMAIN +LINGUAS_FILE +POAUTOINIT + + + + + +The builder belongs to &t-link-msgmerge; tool. The builder updates +PO files with msgmerge(1), or initializes +missing PO files as described in documentation of +&t-link-msginit; tool and &b-link-POInit; builder (see also +&cv-link-POAUTOINIT;). Note, that &b-POUpdate; does not add its +targets to po-create alias as &b-link-POInit; +does. + +Target nodes defined through &b-POUpdate; are not built by default +(they're Ignored from '.' node). Instead, +they are added automatically to special Alias +('po-update' by default). The alias name may be changed +through the &cv-link-POUPDATE_ALIAS; construction variable. You can easilly +update PO files in your project by scons +po-update. + +Example 1. +Update en.po and pl.po from +messages.pot template (see also &cv-link-POTDOMAIN;), +assuming that the later one exists or there is rule to build it (see +&b-link-POTUpdate;): + + # ... + env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po] + + +Example 2. +Update en.po and pl.po from +foo.pot template: + + # ... + env.POUpdate(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.pl] + + +Example 3. +Update en.po and pl.po from +foo.pot (another version): + + # ... + env.POUpdate(['en', 'pl'], POTDOMAIN='foo') # foo.pot -- > [en.po, pl.pl] + + +Example 4. +Update files for languages defined in LINGUAS file. The +files are updated from messages.pot template: + + # ... + env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file + + +Example 5. +Same as above, but update from foo.pot template: + + # ... + env.POUpdate(LINGUAS_FILE = 1, source = ['foo']) + + +Example 6. +Update en.po and pl.po plus files for +languages defined in LINGUAS file. The files are updated +from messages.pot template: + + # produce 'en.po', 'pl.po' + files defined in 'LINGUAS': + env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1) + + +Example 7. +Use &cv-link-POAUTOINIT; to automatically initialize PO file +if it doesn't exist: + + # ... + env.POUpdate(LINGUAS_FILE = 1, POAUTOINIT = 1) + + +Example 8. +Update PO files for languages defined in +LINGUAS file. The files are updated from +foo.pot template. All necessary settings are +pre-configured via environment. + + # ... + env['POAUTOINIT'] = 1 + env['LINGUAS_FILE'] = 1 + env['POTDOMAIN'] = 'foo' + env.POUpdate() + + + + + + + + +Common alias for all PO files being defined with +&b-link-POUpdate; builder (default: 'po-update'). +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +Absolute path to msgmerge(1) binary as found by +Detect(). +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +Complete command line to run msgmerge(1) command. +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +String to be displayed when msgmerge(1) is invoked +(default: '', which means ``print &cv-link-MSGMERGECOM;''). +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + + + + +Additional flags to msgmerge(1) command. +See &t-link-msgmerge; tool and &b-link-POUpdate; builder. + + diff --git a/src/engine/SCons/Tool/mslib.py b/src/engine/SCons/Tool/mslib.py index cbd1cd7..82ea503 100644 --- a/src/engine/SCons/Tool/mslib.py +++ b/src/engine/SCons/Tool/mslib.py @@ -9,7 +9,7 @@ selection method. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/mslib.py 5357 2011/09/09 21:31:03 bdeegan" +__revision__ = "src/engine/SCons/Tool/mslib.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" import SCons.Defaults import SCons.Tool diff --git a/src/engine/SCons/Tool/mslib.xml b/src/engine/SCons/Tool/mslib.xml index a25bb6d..0ab927d 100644 --- a/src/engine/SCons/Tool/mslib.xml +++ b/src/engine/SCons/Tool/mslib.xml @@ -1,5 +1,5 @@ + + +This scons tool is a part of scons &t-link-gettext; toolset. It provides +scons interface to xgettext(1) +program, which extracts internationalized messages from source code. The tool +provides &b-POTUpdate; builder to make PO +Template files. + + +POTSUFFIX +POTUPDATE_ALIAS +XGETTEXTCOM +XGETTEXTCOMSTR +XGETTEXTFLAGS +XGETTEXTFROM +XGETTEXTFROMPREFIX +XGETTEXTFROMSUFFIX +XGETTEXTPATH +XGETTEXTPATHPREFIX +XGETTEXTPATHSUFFIX +_XGETTEXTDOMAIN +_XGETTEXTFROMFLAGS +_XGETTEXTPATHFLAGS + + +POTDOMAIN + + + + + +The builder belongs to &t-link-xgettext; tool. The builder updates target +POT file if exists or creates one if it doesn't. The node is +not built by default (i.e. it is Ignored from +'.'), but only on demand (i.e. when given +POT file is required or when special alias is invoked). This +builder adds its targe node (messages.pot, say) to a +special alias (pot-update by default, see +&cv-link-POTUPDATE_ALIAS;) so you can update/create them easily with +scons pot-update. The file is not written until there is no +real change in internationalized messages (or in comments that enter +POT file). + + You may see xgettext(1) being invoked by the +&t-link-xgettext; tool even if there is no real change in internationalized +messages (so the POT file is not being updated). This +happens every time a source file has changed. In such case we invoke +xgettext(1) and compare its output with the content of +POT file to decide whether the file should be updated or +not. + +Example 1. +Let's create po/ directory and place following +SConstruct script there: + + # SConstruct in 'po/' subdir + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp']) + env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp']) + +Then invoke scons few times: + + user@host:$ scons # Does not create foo.pot nor bar.pot + user@host:$ scons foo.pot # Updates or creates foo.pot + user@host:$ scons pot-update # Updates or creates foo.pot and bar.pot + user@host:$ scons -c # Does not clean foo.pot nor bar.pot. + +the results shall be as the comments above say. + +Example 2. +The &b-POTUpdate; builder may be used with no target specified, in which +case default target messages.pot will be used. The +default target may also be overriden by setting &cv-link-POTDOMAIN; construction +variable or providing it as an override to &b-POTUpdate; builder: + + # SConstruct script + env = Environment( tools = ['default', 'xgettext'] ) + env['POTDOMAIN'] = "foo" + env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ... + env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot + + +Example 3. +The sources may be specified within separate file, for example +POTFILES.in: + + # POTFILES.in in 'po/' subdirectory + ../a.cpp + ../b.cpp + # end of file + +The name of the file (POTFILES.in) containing the list of +sources is provided via &cv-link-XGETTEXTFROM;: + + # SConstruct file in 'po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in') + + +Example 4. +You may use &cv-link-XGETTEXTPATH; to define source search path. Assume, for +example, that you have files a.cpp, +b.cpp, po/SConstruct, +po/POTFILES.in. Then your POT-related +files could look as below: + + # POTFILES.in in 'po/' subdirectory + a.cpp + b.cpp + # end of file + + + + # SConstruct file in 'po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../') + + +Example 5. +Multiple search directories may be defined within a list, i.e. +XGETTEXTPATH = ['dir1', 'dir2', ...]. The order in the list +determines the search order of source files. The path to the first file found +is used. + +Let's create 0/1/po/SConstruct script: + + # SConstruct file in '0/1/po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../']) + +and 0/1/po/POTFILES.in: + + # POTFILES.in in '0/1/po/' subdirectory + a.cpp + # end of file + +Write two *.cpp files, the first one is +0/a.cpp: + + /* 0/a.cpp */ + gettext("Hello from ../../a.cpp") + +and the second is 0/1/a.cpp: + + /* 0/1/a.cpp */ + gettext("Hello from ../a.cpp") + +then run scons. You'll obtain 0/1/po/messages.pot with the +message "Hello from ../a.cpp". When you reverse order in +$XGETTEXTFOM, i.e. when you write SConscript as + + # SConstruct file in '0/1/po/' subdirectory + env = Environment( tools = ['default', 'xgettext'] ) + env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) + then the messages.pot will contain +msgid "Hello from ../../a.cpp" line and not +msgid "Hello from ../a.cpp". + + + + + + + + +Suffix used for PO Template files (default: '.pot'). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Name of the common phony target for all PO Templates created with +&b-link-POUpdate; (default: 'pot-update'). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Path to xgettext(1) program (found via +Detect()). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Complete xgettext command line. +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +A string that is shown when xgettext(1) command is invoked +(default: '', which means "print &cv-link-XGETTEXTCOM;"). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Additional flags to xgettext(1). +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +Name of file containing list of xgettext(1)'s source +files. Autotools' users know this as POTFILES.in so they +will in most cases set XGETTEXTFROM="POTFILES.in" here. +The &cv-XGETTEXTFROM; files have same syntax and semantics as the well known +GNU POTFILES.in. +See &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +List of directories, there xgettext(1) will look for +source files (default: []). + +This variable works only together with &cv-link-XGETTEXTFROM; + +See also &t-link-xgettext; tool and &b-link-POTUpdate; builder. + + + + + +This flag is used to add single search path to +xgettext(1)'s commandline (default: +'-D'). + + + + + +(default: '') + + + + + +This flag is used to add single &cv-link-XGETTEXTFROM; file to +xgettext(1)'s commandline (default: +'-f'). + + + + + +(default: '') + + + + + +Internal "macro". Generates xgettext domain name +form source and target (default: '${TARGET.filebase}'). + + + + + +Internal "macro". Genrates list of -D<dir> flags +from the &cv-link-XGETTEXTPATH; list. + + + + + +Internal "macro". Generates list of -f<file> flags +from &cv-link-XGETTEXTFROM;. + + + + diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py index 60e1a83..580fe76 100644 --- a/src/engine/SCons/Tool/yacc.py +++ b/src/engine/SCons/Tool/yacc.py @@ -9,7 +9,7 @@ selection method. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -31,7 +31,7 @@ selection method. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/yacc.py 5357 2011/09/09 21:31:03 bdeegan" +__revision__ = "src/engine/SCons/Tool/yacc.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" import os.path diff --git a/src/engine/SCons/Tool/yacc.xml b/src/engine/SCons/Tool/yacc.xml index b69afbc..c4d2762 100644 --- a/src/engine/SCons/Tool/yacc.xml +++ b/src/engine/SCons/Tool/yacc.xml @@ -1,5 +1,5 @@