Jose' Matos wrote:
> On Wednesday 21 September 2005 14:54, Georg Baum wrote:
>> Jose' Matos wrote:
>> > Passing as destination dir as argument is enough to fix this, right?
>>
>> No, it was a bit more.
>> The attached patch should fix bug 2027 and does the following:
>> - fix wrong syntax in de_Userguide and it_Userguide
>
> Are those the bugs that you have fixed recently in lyx2lyx?
No. I still don't know where they came from, but redoing the conversion with
current lyx2lyx should show.
>> If you want to try it out you should delete lib/doc/*TOC.lyx.
>>
>> Comments?
>
> For me it is OK. :-)
Here is an updated patch. It fixes the problem that the TOC files were not
automatically generated for the distribution. The Makefile now works both
for srcdir=builddir and srcdir!=builddir.
I plan to do the following:
- remove *TOC.lyx from CVS
- add Makefile.depend to CVS (not needed for GNU make, but might be needed
for other flavours of make)
- apply the patch
Is this OK?
Georg
Index: lib/doc/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/doc/ChangeLog,v
retrieving revision 1.35
diff -u -p -r1.35 ChangeLog
--- lib/doc/ChangeLog 28 Sep 2005 09:40:47 -0000 1.35
+++ lib/doc/ChangeLog 28 Sep 2005 13:25:51 -0000
@@ -1,3 +1,13 @@
+2005-09-28 Georg Baum <[EMAIL PROTECTED]>
+
+ * de_UserGuide.lyx, it_UserGuide.lyx: repair invalid syntax, maybe
+ caused by a lyx2lyx bug
+ * Makefile.am: generate TOC files automatically
+ * Makefile.am: rework TOC generation rules to work with srcdir != builddir
+ * depend.py: make it work with srcdir != builddir
+ * depend.py: adjust generated TOCs rule to Makefile.am changes
+ * doc_toc.py: make it work with srcdir != builddir
+
2005-09-28 Jürgen Spitzmüller <[EMAIL PROTECTED]>
* UserGuide.lyx:
Index: lib/doc/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/doc/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- lib/doc/Makefile.am 17 Oct 2004 19:12:32 -0000 1.6
+++ lib/doc/Makefile.am 28 Sep 2005 13:25:52 -0000
@@ -1,31 +1,26 @@
include $(top_srcdir)/config/common.am
-DISTCLEANFILES += LyXConfig.lyx LaTeXConfig.lyx Makefile.depend
+DISTCLEANFILES += LyXConfig.lyx LaTeXConfig.lyx $(TOCs)
-EXTRA_DIST = depend.py doc_toc.py LyXConfig.lyx.in README.Documentation $(docfiles)
+EXTRA_DIST = depend.py doc_toc.py LyXConfig.lyx.in README.Documentation $(DEPENDFILE) $(docfiles)
-docfiles = \
- cs_TOC.lyx \
+docfiles = $(TOCs) \
cs_Tutorial.lyx \
Customization.lyx \
da_Intro.lyx \
- da_TOC.lyx \
de_Customization.lyx \
de_Extended.lyx \
de_FAQ.lyx \
de_Intro.lyx \
- de_TOC.lyx \
de_Tutorial.lyx \
de_UserGuide.lyx \
DocStyle.lyx \
es_Intro.lyx \
- es_TOC.lyx \
es_Tutorial.lyx \
eu_Customization.lyx \
eu_Extended.lyx \
eu_FAQ.lyx \
eu_Intro.lyx \
- eu_TOC.lyx \
eu_Tutorial.lyx \
eu_UserGuide.lyx \
Extended.lyx \
@@ -34,50 +29,36 @@ docfiles = \
fr_Extended.lyx \
fr_FAQ.lyx \
fr_Intro.lyx \
- fr_TOC.lyx \
fr_Tutorial.lyx \
fr_UserGuide.lyx \
he_Intro.lyx \
- he_TOC.lyx \
he_Tutorial.lyx \
hu_Intro.lyx \
- hu_TOC.lyx \
Intro.lyx \
it_Customization.lyx \
it_Intro.lyx \
- it_TOC.lyx \
it_Tutorial.lyx \
it_UserGuide.lyx \
LaTeXConfig.lyx.in \
nl_Intro.lyx \
- nl_TOC.lyx \
nl_Tutorial.lyx \
no_Intro.lyx \
- no_TOC.lyx \
pl_Extended.lyx \
pl_Intro.lyx \
- pl_TOC.lyx \
pl_Tutorial.lyx \
pt_Intro.lyx \
- pt_TOC.lyx \
pt_Tutorial.lyx \
Reference.lyx \
ro_Intro.lyx \
- ro_TOC.lyx \
ru_FAQ.lyx \
ru_Intro.lyx \
- ru_TOC.lyx \
ru_Tutorial.lyx \
- sk_TOC.lyx \
sk_Tutorial.lyx \
sk_UserGuide.lyx \
sl_Intro.lyx \
- sl_TOC.lyx \
sl_Tutorial.lyx \
sv_Intro.lyx \
- sv_TOC.lyx \
sv_Tutorial.lyx \
- TOC.lyx \
Tutorial.lyx \
UserGuide.lyx \
escher-lsd.eps \
@@ -89,16 +70,18 @@ doc_DATA = \
$(docfiles) \
LaTeXConfig.lyx
-# TODO can we instead just #include the DEPENDFILE in this Makefile?
-# problem with this is that the DEPENDFILE that's included won't be the updated
-# one. JMarc should know how to handle this.
-
DEPENDFILE = Makefile.depend
+include $(DEPENDFILE)
+
+TOCs : $(DEPENDFILE) $(TOCs)
+ @echo Made TOCs succesfully.
-TOCs : depend
- make -f $(DEPENDFILE) TOCs
+# Force regeneration of $(DEPENDFILE) when Makefile.am changes because
+# new doc files might have been added
+$(DEPENDFILE): Makefile.am
+ python $(srcdir)/depend.py > $(DEPENDFILE)
-depend:
- python depend.py > $(DEPENDFILE)
+# Force generation of the TOC files for 'make dist'
+distdir: TOCs
-.PHONY: depend
+.PHONY: TOCs
Index: lib/doc/de_UserGuide.lyx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/doc/de_UserGuide.lyx,v
retrieving revision 1.4
diff -u -p -r1.4 de_UserGuide.lyx
--- lib/doc/de_UserGuide.lyx 18 Jul 2005 09:41:53 -0000 1.4
+++ lib/doc/de_UserGuide.lyx 28 Sep 2005 13:25:54 -0000
@@ -10653,8 +10653,6 @@ Umschalt+Alt\InsetSpace ~
\end_layout
\begin_deeper
-\end_layout
-
\begin_deeper
\begin_layout Standard
Index: lib/doc/depend.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/doc/depend.py,v
retrieving revision 1.1
diff -u -p -r1.1 depend.py
--- lib/doc/depend.py 17 Oct 2004 19:12:32 -0000 1.1
+++ lib/doc/depend.py 28 Sep 2005 13:25:54 -0000
@@ -31,12 +31,14 @@ from glob import glob
possible_documents = ("Intro", "FAQ", "Tutorial", "UserGuide", "Extended", "Customization")
lang_pattern = re.compile('^([a-z]{2})_')
-def documents(prefix):
+def documents(srcdir, prefix):
result = []
for file in possible_documents:
- fname = prefix + file + '.lyx'
+ fname = srcdir + '/' + prefix + file + '.lyx'
if os.access(fname, os.F_OK):
result.append(fname)
+ else:
+ result.append(srcdir + '/' + file + '.lyx')
return result
@@ -50,8 +52,9 @@ def main(argv):
# What are the languages available? And its documents?
languages = {}
- for file in glob('*'):
- lang = lang_pattern.match(file)
+ srcdir = os.path.dirname(argv[0])
+ for file in glob(srcdir + '/*'):
+ lang = lang_pattern.match(os.path.basename(file))
if lang:
if lang.group(1) not in languages:
languages[lang.group(1)] = [file]
@@ -63,8 +66,8 @@ def main(argv):
langs.sort()
# The default language is english and doesn't need any prefix
- print 'TOC.lyx:', '.lyx '.join(possible_documents) + '.lyx'
- print '\tpython doc_toc.py'
+ print 'TOC.lyx:', ('.lyx ' + srcdir + '/').join(possible_documents) + '.lyx'
+ print '\tpython %s/doc_toc.py' % srcdir
print
tocs = ['TOC.lyx']
@@ -73,15 +76,17 @@ def main(argv):
toc_name = lang + '_TOC.lyx'
tocs.append(toc_name)
- languages[lang].remove(toc_name)
+ if toc_name in languages[lang]:
+ languages[lang].remove(toc_name)
+ if srcdir + '/' + toc_name in languages[lang]:
+ languages[lang].remove(srcdir + '/' + toc_name)
print toc_name + ':', ' '.join(languages[lang])
- print '\tpython doc_toc.py %s' % lang
+ print '\tpython %s/doc_toc.py %s' % (srcdir, lang)
print
# Write meta-rule to call all the other rules
- print 'TOCs:', ' '.join(tocs)
- print '[EMAIL PROTECTED] Made TOCs succesfully.'
+ print 'TOCs =', ' '.join(tocs)
if __name__ == "__main__":
Index: lib/doc/doc_toc.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/doc/doc_toc.py,v
retrieving revision 1.2
diff -u -p -r1.2 doc_toc.py
--- lib/doc/doc_toc.py 9 Jun 2005 09:58:02 -0000 1.2
+++ lib/doc/doc_toc.py 28 Sep 2005 13:25:54 -0000
@@ -25,7 +25,7 @@
import sys
import os
-sys.path.insert(0,"../lyx2lyx")
+sys.path.insert(0, os.path.dirname(sys.argv[0]) + "/../lyx2lyx")
import parser_tools
import LyX
import depend
@@ -105,9 +105,11 @@ def main(argv):
if lang not in info:
lang = 'en'
+ srcdir = os.path.dirname(sys.argv[0])
+
# Determine existing translated documents for that language.
toc_general = []
- for file in depend.documents(pref):
+ for file in depend.documents(srcdir, pref):
file = LyX.File(input= file)
file.convert()
toc_general.extend(file.get_toc())
Index: lib/doc/it_UserGuide.lyx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/doc/it_UserGuide.lyx,v
retrieving revision 1.2
diff -u -p -r1.2 it_UserGuide.lyx
--- lib/doc/it_UserGuide.lyx 18 Jul 2005 09:42:08 -0000 1.2
+++ lib/doc/it_UserGuide.lyx 28 Sep 2005 13:25:57 -0000
@@ -23257,8 +23257,6 @@ paragrafo
\begin_deeper
-\end_layout
-
\begin_deeper
\begin_layout Standard