mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Scons: update_po target now updates po/POTFILES.in
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18075 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
153c9b0461
commit
a6e1dc19a3
@ -734,6 +734,7 @@ if platform_name == 'cygwin':
|
|||||||
# install customized builders
|
# install customized builders
|
||||||
env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
|
env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
|
||||||
env['BUILDERS']['installTOC'] = Builder(action = utils.env_toc)
|
env['BUILDERS']['installTOC'] = Builder(action = utils.env_toc)
|
||||||
|
env['BUILDERS']['potfiles'] = Builder(action = utils.env_potfiles)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
@ -1638,8 +1639,8 @@ if build_support:
|
|||||||
#
|
#
|
||||||
print "Processing files in src/support..."
|
print "Processing files in src/support..."
|
||||||
|
|
||||||
frontend_env.Depends('$BUILDDIR/common/support/package.C', '$BUILDDIR/common/config.h')
|
frontend_env.Depends('$BUILDDIR/common/support/Package.cpp', '$BUILDDIR/common/config.h')
|
||||||
env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRCDIR/src/support/Package.cpp.in')
|
env.substFile('$BUILDDIR/common/support/Package.cpp', '$TOP_SRCDIR/src/support/Package.cpp.in')
|
||||||
|
|
||||||
support = frontend_env.StaticLibrary(
|
support = frontend_env.StaticLibrary(
|
||||||
target = '$LOCALLIBPATH/support',
|
target = '$LOCALLIBPATH/support',
|
||||||
@ -1793,15 +1794,14 @@ if build_tex2lyx:
|
|||||||
print "Processing files in src/tex2lyx..."
|
print "Processing files in src/tex2lyx..."
|
||||||
|
|
||||||
#
|
#
|
||||||
for file in ['FloatList.cpp', 'Floating.cpp', 'Counters.cpp', 'LyXLayout.h', 'LyXLayout.cpp',
|
for file in src_tex2lyx_copied_files + src_tex2lyx_copied_header_files:
|
||||||
'LyXTextClass.h', 'LyXTextClass.cpp', 'Lexer.cpp', 'Lexer.h']:
|
|
||||||
frontend_env.Command('$BUILDDIR/common/tex2lyx/'+file, '$TOP_SRCDIR/src/'+file,
|
frontend_env.Command('$BUILDDIR/common/tex2lyx/'+file, '$TOP_SRCDIR/src/'+file,
|
||||||
[Copy('$TARGET', '$SOURCE')])
|
[Copy('$TARGET', '$SOURCE')])
|
||||||
|
|
||||||
tex2lyx = frontend_env.Program(
|
tex2lyx = frontend_env.Program(
|
||||||
target = '$BUILDDIR/common/tex2lyx/tex2lyx',
|
target = '$BUILDDIR/common/tex2lyx/tex2lyx',
|
||||||
LIBS = ['support'] + boost_libraries + intl_libs + system_libs + qtcore_lib,
|
LIBS = ['support'] + boost_libraries + intl_libs + system_libs + qtcore_lib,
|
||||||
source = ['$BUILDDIR/common/tex2lyx/%s' % x for x in src_tex2lyx_files] + \
|
source = ['$BUILDDIR/common/tex2lyx/%s' % x for x in src_tex2lyx_files + src_tex2lyx_copied_files] + \
|
||||||
utils.createResFromIcon(frontend_env, 'lyx_32x32.ico', '$LOCALLIBPATH/tex2lyx.rc'),
|
utils.createResFromIcon(frontend_env, 'lyx_32x32.ico', '$LOCALLIBPATH/tex2lyx.rc'),
|
||||||
CPPPATH = ['$BUILDDIR/common/tex2lyx', '$CPPPATH'],
|
CPPPATH = ['$BUILDDIR/common/tex2lyx', '$CPPPATH'],
|
||||||
LIBPATH = ['#$LOCALLIBPATH', '$LIBPATH'],
|
LIBPATH = ['#$LOCALLIBPATH', '$LIBPATH'],
|
||||||
@ -1820,8 +1820,8 @@ if build_lyxbase:
|
|||||||
#
|
#
|
||||||
print "Processing files in src..."
|
print "Processing files in src..."
|
||||||
|
|
||||||
env.Depends('$BUILDDIR/common/version.C', '$BUILDDIR/common/config.h')
|
env.Depends('$BUILDDIR/common/version.cpp', '$BUILDDIR/common/config.h')
|
||||||
env.substFile('$BUILDDIR/common/version.C', '$TOP_SRCDIR/src/version.cpp.in')
|
env.substFile('$BUILDDIR/common/version.cpp', '$TOP_SRCDIR/src/version.cpp.in')
|
||||||
|
|
||||||
if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
|
if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
|
||||||
src_post_files.append('ASpell.cpp')
|
src_post_files.append('ASpell.cpp')
|
||||||
@ -1986,6 +1986,22 @@ if update_po:
|
|||||||
if not env['XGETTEXT'] or not env['MSGMERGE'] or not env['MSGUNIQ']:
|
if not env['XGETTEXT'] or not env['MSGMERGE'] or not env['MSGUNIQ']:
|
||||||
print 'xgettext or msgmerge does not exist. Cannot merge po files'
|
print 'xgettext or msgmerge does not exist. Cannot merge po files'
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
# rebuild POTFILES.in
|
||||||
|
POTFILES_in = env.potfiles('$TOP_SRCDIR/po/POTFILES.in',
|
||||||
|
['$TOP_SRCDIR/src/%s' % x for x in src_header_files + src_pre_files + src_post_files if x != 'version.cpp'] + \
|
||||||
|
['$TOP_SRCDIR/src/support/%s' % x for x in src_support_header_files + src_support_files if x != 'Package.cpp'] + \
|
||||||
|
['$TOP_SRCDIR/src/mathed/%s' % x for x in src_mathed_header_files + src_mathed_files] + \
|
||||||
|
['$TOP_SRCDIR/src/insets/%s' % x for x in src_insets_header_files + src_insets_files] + \
|
||||||
|
['$TOP_SRCDIR/src/frontends/%s' % x for x in src_frontends_header_files + src_frontends_files] + \
|
||||||
|
['$TOP_SRCDIR/src/graphics/%s' % x for x in src_graphics_header_files + src_graphics_files] + \
|
||||||
|
['$TOP_SRCDIR/src/frontends/controllers/%s' % x for x in src_frontends_controllers_header_files + src_frontends_controllers_files] + \
|
||||||
|
['$TOP_SRCDIR/src/frontends/qt4/%s' % x for x in src_frontends_qt4_header_files + src_frontends_qt4_files + src_frontends_qt4_moc_files] + \
|
||||||
|
['$TOP_SRCDIR/src/client/%s' % x for x in src_client_header_files + src_client_files ] + \
|
||||||
|
['$TOP_SRCDIR/src/tex2lyx/%s' % x for x in src_tex2lyx_header_files + src_tex2lyx_files ] + \
|
||||||
|
['$TOP_SRCDIR/src/version.cpp.in', '$TOP_SRCDIR/src/support/Package.cpp.in',\
|
||||||
|
'$TOP_SRCDIR/src/ASpell.cpp', '$TOP_SRCDIR/src/ISpell.cpp', '$TOP_SRCDIR/src/PSpell.cpp']
|
||||||
|
)
|
||||||
|
Alias('update_po', POTFILES_in)
|
||||||
# build language_l10n.pot, ui_l10n.pot, layouts_l10n.pot, qt4_l10n.pot
|
# build language_l10n.pot, ui_l10n.pot, layouts_l10n.pot, qt4_l10n.pot
|
||||||
# and combine them to lyx.po
|
# and combine them to lyx.po
|
||||||
env['LYX_POT'] = 'python $TOP_SRCDIR/po/lyx_pot.py'
|
env['LYX_POT'] = 'python $TOP_SRCDIR/po/lyx_pot.py'
|
||||||
@ -2011,6 +2027,7 @@ if update_po:
|
|||||||
--copyright-holder="LyX Developers" \
|
--copyright-holder="LyX Developers" \
|
||||||
--msgid-bugs-address="lyx-devel@lists.lyx.org" ''']
|
--msgid-bugs-address="lyx-devel@lists.lyx.org" ''']
|
||||||
)
|
)
|
||||||
|
env.Depends(lyx_po, POTFILES_in)
|
||||||
# copy lyx.po to lyx.pot
|
# copy lyx.po to lyx.pot
|
||||||
lyx_pot = env.Command('$BUILDDIR/po/lyx.pot', lyx_po,
|
lyx_pot = env.Command('$BUILDDIR/po/lyx.pot', lyx_po,
|
||||||
Copy('$TARGET', '$SOURCE'))
|
Copy('$TARGET', '$SOURCE'))
|
||||||
@ -2030,9 +2047,6 @@ if update_po:
|
|||||||
'$MSGMERGE $TOP_SRCDIR/po/${TARGET.filebase}.po $SOURCE -o $TARGET',
|
'$MSGMERGE $TOP_SRCDIR/po/${TARGET.filebase}.po $SOURCE -o $TARGET',
|
||||||
Copy('$TOP_SRCDIR/po/${TARGET.filebase}.po', '$TARGET')]
|
Copy('$TOP_SRCDIR/po/${TARGET.filebase}.po', '$TARGET')]
|
||||||
)
|
)
|
||||||
# get dependency files from POTFILES.in
|
|
||||||
dep_files = ['$TOP_SRCDIR/%s' % x.strip() for x in open(env.File('$TOP_SRCDIR/po/POTFILES.in').abspath).readlines()]
|
|
||||||
dep_files.append('$TOP_SRCDIR/po/POTFILES.in')
|
|
||||||
# for each po file, generate pot
|
# for each po file, generate pot
|
||||||
for po_file in transfiles:
|
for po_file in transfiles:
|
||||||
# get filename
|
# get filename
|
||||||
@ -2043,7 +2057,7 @@ if update_po:
|
|||||||
if not languages or country in languages:
|
if not languages or country in languages:
|
||||||
# merge po files, the generated lan.po_new file is copied to lan.po file.
|
# merge po files, the generated lan.po_new file is copied to lan.po file.
|
||||||
po = env.msgmerge('$BUILDDIR/po/%s.po' % country, lyx_pot)
|
po = env.msgmerge('$BUILDDIR/po/%s.po' % country, lyx_pot)
|
||||||
env.Depends(po, dep_files)
|
env.Depends(po, POTFILES_in)
|
||||||
Alias('update_po', po)
|
Alias('update_po', po)
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ src_support_files = Split('''
|
|||||||
lyxtime.cpp
|
lyxtime.cpp
|
||||||
mkdir.cpp
|
mkdir.cpp
|
||||||
os.cpp
|
os.cpp
|
||||||
package.C
|
Package.cpp
|
||||||
Path.cpp
|
Path.cpp
|
||||||
qstring_helpers.cpp
|
qstring_helpers.cpp
|
||||||
rename.cpp
|
rename.cpp
|
||||||
@ -243,6 +243,10 @@ src_mathed_header_files = Split('''
|
|||||||
TextPainter.h
|
TextPainter.h
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
src_mathed_extra_files = Split('''
|
||||||
|
InsetFormulaMacro.h
|
||||||
|
InsetFormulaMacro.cpp
|
||||||
|
''')
|
||||||
|
|
||||||
src_mathed_files = Split('''
|
src_mathed_files = Split('''
|
||||||
InsetMath.cpp
|
InsetMath.cpp
|
||||||
@ -361,7 +365,6 @@ src_insets_header_files = Split('''
|
|||||||
InsetSpecialChar.h
|
InsetSpecialChar.h
|
||||||
InsetTabular.h
|
InsetTabular.h
|
||||||
InsetText.h
|
InsetText.h
|
||||||
InsetTheorem.h
|
|
||||||
InsetTOC.h
|
InsetTOC.h
|
||||||
InsetUrl.h
|
InsetUrl.h
|
||||||
InsetVSpace.h
|
InsetVSpace.h
|
||||||
@ -373,6 +376,10 @@ src_insets_header_files = Split('''
|
|||||||
RenderPreview.h
|
RenderPreview.h
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
src_inests_extra_files = Split('''
|
||||||
|
InsetTheorem.h
|
||||||
|
InsetTheorem.cpp
|
||||||
|
''')
|
||||||
|
|
||||||
src_insets_files = Split('''
|
src_insets_files = Split('''
|
||||||
ExternalSupport.cpp
|
ExternalSupport.cpp
|
||||||
@ -730,7 +737,6 @@ src_frontends_qt4_moc_files = Split('''
|
|||||||
|
|
||||||
src_frontends_qt4_header_files = Split('''
|
src_frontends_qt4_header_files = Split('''
|
||||||
Action.h
|
Action.h
|
||||||
BiblioModuleBase.h
|
|
||||||
BulletsModule.h
|
BulletsModule.h
|
||||||
ColorCache.h
|
ColorCache.h
|
||||||
DockView.h
|
DockView.h
|
||||||
@ -743,13 +749,12 @@ src_frontends_qt4_header_files = Split('''
|
|||||||
GuiView.h
|
GuiView.h
|
||||||
GuiWorkArea.h
|
GuiWorkArea.h
|
||||||
InsertTableWidget.h
|
InsertTableWidget.h
|
||||||
About.h
|
QAbout.h
|
||||||
QBibitem.h
|
QBibitem.h
|
||||||
QBibtex.h
|
QBibtex.h
|
||||||
QBox.h
|
QBox.h
|
||||||
QBranch.h
|
QBranch.h
|
||||||
QBranches.h
|
QBranches.h
|
||||||
QBrowseBox.h
|
|
||||||
QChanges.h
|
QChanges.h
|
||||||
QCharacter.h
|
QCharacter.h
|
||||||
QCharacter.h
|
QCharacter.h
|
||||||
@ -931,18 +936,28 @@ src_tex2lyx_header_files = Split('''
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
src_tex2lyx_files = Split('''
|
src_tex2lyx_copied_header_files = Split('''
|
||||||
|
LyXLayout.h
|
||||||
|
LyXTextClass.h
|
||||||
|
Lexer.h
|
||||||
|
''')
|
||||||
|
|
||||||
|
src_tex2lyx_copied_files = Split('''
|
||||||
FloatList.cpp
|
FloatList.cpp
|
||||||
Floating.cpp
|
Floating.cpp
|
||||||
|
Counters.cpp
|
||||||
|
LyXLayout.cpp
|
||||||
|
LyXTextClass.cpp
|
||||||
|
Lexer.cpp
|
||||||
|
''')
|
||||||
|
|
||||||
|
|
||||||
|
src_tex2lyx_files = Split('''
|
||||||
boost.cpp
|
boost.cpp
|
||||||
Context.cpp
|
Context.cpp
|
||||||
Counters.cpp
|
|
||||||
gettext.cpp
|
gettext.cpp
|
||||||
lengthcommon.cpp
|
lengthcommon.cpp
|
||||||
LyXFont.cpp
|
LyXFont.cpp
|
||||||
Lexer.cpp
|
|
||||||
LyXLayout.cpp
|
|
||||||
LyXTextClass.cpp
|
|
||||||
math.cpp
|
math.cpp
|
||||||
preamble.cpp
|
preamble.cpp
|
||||||
table.cpp
|
table.cpp
|
||||||
@ -1166,7 +1181,7 @@ src_pre_files = Split('''
|
|||||||
TransState.cpp
|
TransState.cpp
|
||||||
Undo.cpp
|
Undo.cpp
|
||||||
VCBackend.cpp
|
VCBackend.cpp
|
||||||
version.C
|
version.cpp
|
||||||
VSpace.cpp
|
VSpace.cpp
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
@ -123,6 +123,22 @@ def env_cat(target, source, env):
|
|||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
|
|
||||||
|
def env_potfiles(target, source, env):
|
||||||
|
'''Build po/POTFILES.in'''
|
||||||
|
# command
|
||||||
|
# grep -l '_(\".*\")' `find src \( -name '*.h' -o -name '*.cpp' -o -name '*.cpp.in' \) -print` | grep -v -e "src/support/Package.cpp$$" | sort | uniq
|
||||||
|
# is used under *nix but windows users have to do these all in python
|
||||||
|
target_file = open(str(target[0]), "w")
|
||||||
|
potfiles = []
|
||||||
|
trans = re.compile('_\(".*"\)', re.M)
|
||||||
|
for file in source:
|
||||||
|
if str(file) not in potfiles and trans.search(open(str(file)).read()):
|
||||||
|
potfiles.append(str(file))
|
||||||
|
potfiles.sort()
|
||||||
|
print >> target_file, '\n'.join(potfiles)
|
||||||
|
target_file.close()
|
||||||
|
|
||||||
|
|
||||||
def createResFromIcon(env, icon_file, rc_file):
|
def createResFromIcon(env, icon_file, rc_file):
|
||||||
''' create a rc file with icon, and return res file (windows only) '''
|
''' create a rc file with icon, and return res file (windows only) '''
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
|
@ -371,7 +371,7 @@ ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS)
|
|||||||
LC_ALL=C ; export LC_ALL ; \
|
LC_ALL=C ; export LC_ALL ; \
|
||||||
rm -f $@-t \
|
rm -f $@-t \
|
||||||
&& ( cd $(top_srcdir); \
|
&& ( cd $(top_srcdir); \
|
||||||
grep -l "_(\".*\")" `find src \( -name '*.[ch]' -o -name '*.cpp' -o -name '*.cpp.in' \) -print` |\
|
grep -l "_(\".*\")" `find src \( -name '*.h' -o -name '*.cpp' -o -name '*.cpp.in' \) -print` |\
|
||||||
grep -v -e "src/support/Package.cpp$$" |\
|
grep -v -e "src/support/Package.cpp$$" |\
|
||||||
sort | uniq ) > $@-t \
|
sort | uniq ) > $@-t \
|
||||||
&& mv $@-t $@
|
&& mv $@-t $@
|
||||||
|
Loading…
Reference in New Issue
Block a user