Package: scons
Version: 2.3.1-1
Followup-For: Bug #749716

Dear Maintainer,

I've managed to get to the core of the error and I'm providing a patch that
solves this issue.

The problem lies on InternalLaTeXAuxAction function, which decides what to
do with .aux files generated by previous latex invocation.

For some reason, it decides to call bibtex over .aux files if and only if
they contain the word 'bibdata' inside them.

This may be enough for those cases where \bibliography is one of the last
commands on the main file. However, in some cases such as what I describe,
(I have a bibliography under the first subfile included by main file, and
after this file there come lots of sections, subsections, more included
files, etc) this command must be executed over all .aux files, for any of
this can contain a \bibliography command, \cite commands, etc.

This patch omits this test (if content.find("bibdata") != -1:) and simply
invokes bibtex (or biber) over all auxiliary files.

I think this should also be indeed faster, for file reading is performed by
SCons, although bibtex (or biber) must still process all the files.



-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages scons depends on:
pn  python:any  <none>

scons recommends no packages.

scons suggests no packages.

-- no debconf information

*** fix-bibtex-call.patch
diff -urNp scons-2.3.1.orig/engine/SCons/Tool/tex.py 
scons-2.3.1/engine/SCons/Tool/tex.py
--- scons-2.3.1.orig/engine/SCons/Tool/tex.py   2014-03-02 20:19:50.000000000 
+0100
+++ scons-2.3.1/engine/SCons/Tool/tex.py        2014-06-23 15:12:51.100738449 
+0200
@@ -336,15 +336,13 @@ def InternalLaTeXAuxAction(XXXLaTeXActio
                 already_bibtexed.append(auxfilename)
                 target_aux = os.path.join(targetdir, auxfilename)
                 if os.path.isfile(target_aux):
-                    content = open(target_aux, "rb").read()
-                    if content.find("bibdata") != -1:
-                        if Verbose:
-                            print "Need to run bibtex on ",auxfilename
-                        bibfile = 
env.fs.File(SCons.Util.splitext(target_aux)[0])
-                        result = BibTeXAction(bibfile, bibfile, env)
-                        if result != 0:
-                            check_file_error_message(env['BIBTEX'], 'blg')
-                        must_rerun_latex = True
+                    if Verbose:
+                        print "Need to run bibtex on ",auxfilename
+                    bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0])
+                    result = BibTeXAction(bibfile, bibfile, env)
+                    if result != 0:
+                        check_file_error_message(env['BIBTEX'], 'blg')
+                    must_rerun_latex = True
 
         # Now decide if biber will need to be run.
         # When the backend for biblatex is biber (by choice or default) the
@@ -359,15 +357,13 @@ def InternalLaTeXAuxAction(XXXLaTeXActio
                 already_bibtexed.append(bcffilename)
                 target_bcf = os.path.join(targetdir, bcffilename)
                 if os.path.isfile(target_bcf):
-                    content = open(target_bcf, "rb").read()
-                    if content.find("bibdata") != -1:
-                        if Verbose:
-                            print "Need to run biber on ",bcffilename
-                        bibfile = 
env.fs.File(SCons.Util.splitext(target_bcf)[0])
-                        result = BiberAction(bibfile, bibfile, env)
-                        if result != 0:
-                            check_file_error_message(env['BIBER'], 'blg')
-                        must_rerun_latex = True
+                    if Verbose:
+                        print "Need to run biber on ",bcffilename
+                    bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0])
+                    result = BiberAction(bibfile, bibfile, env)
+                    if result != 0:
+                        check_file_error_message(env['BIBER'], 'blg')
+                    must_rerun_latex = True
 
         # Now decide if latex will need to be run again due to index.
         if check_MD5(suffix_nodes['.idx'],'.idx') or (count == 1 and 
run_makeindex):


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to