#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-

# \author Juergen Spitzmueller

# This file is a wrapper on bibtex to let LyX
# process every aux file in the temp directory
# except for the master file's.
# This is needed if you use chapterbib with LyX.
# Place this file somewhere in your PATH , then
# open Tools->Preferences->LaTeX in LyX and change
# the "bibtex command" from "bibtex" to "bibtexallx".

import sys, os
for filename in os.listdir("."):
	if filename.endswith('.aux'):
		f = os.path.splitext(filename)[0]
                if f == sys.argv[1]:
                    continue
		os.popen('bibtex ' + f)
