From f6f58564f7c69f1d7a28bdb600bf1e582827675d Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sun, 6 May 2007 13:12:25 +0000 Subject: [PATCH] improved path handling. Allow to pass the source directory on the 2007-05-06 Sven Neumann * tools/defcheck.py: improved path handling. Allow to pass the source directory on the command-line. * Makefile.am (check-defs): pass $(top_srcdir) to defcheck.py. (validate-authors): validate authors.xml in the srcdir. * menus/Makefile.am (validate): changed output for consistency. svn path=/trunk/; revision=22432 --- ChangeLog | 10 ++++++++++ Makefile.am | 9 +++++---- menus/Makefile.am | 2 +- tools/defcheck.py | 38 +++++++++++++++++++++++++++----------- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2031e61d77..de8d50832a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-05-06 Sven Neumann + + * tools/defcheck.py: improved path handling. Allow to pass the + source directory on the command-line. + + * Makefile.am (check-defs): pass $(top_srcdir) to defcheck.py. + (validate-authors): validate authors.xml in the srcdir. + + * menus/Makefile.am (validate): changed output for consistency. + 2007-05-06 Sven Neumann * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): --enable-gtk-doc diff --git a/Makefile.am b/Makefile.am index 4f367dffca..8727c55fb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -89,13 +89,14 @@ gimpinstall-@GIMP_TOOL_VERSION@: $(LN_S) $(srcdir)/install-sh $(srcdir)/gimpinstall-@GIMP_TOOL_VERSION@ check-defs: - @$(PYTHON) $(top_srcdir)/tools/defcheck.py || \ - ( echo "* .def files inconsistent *"; exit 1; ) + @$(PYTHON) $(top_srcdir)/tools/defcheck.py $(top_srcdir) || \ + ( echo "*** .def files inconsistent ***"; exit 1; ) validate-authors: if HAVE_XMLLINT - @$(XMLLINT) --noout --valid authors.xml || \ - ( echo "* authors.xml INVALID *"; exit 1; ) + @cd $(srcdir); \ + $(XMLLINT) --noout --valid authors.xml || \ + ( echo "*** authors.xml INVALID ***"; exit 1; ) endif all-local: AUTHORS diff --git a/menus/Makefile.am b/menus/Makefile.am index 87f04a8645..8e29c09e8b 100644 --- a/menus/Makefile.am +++ b/menus/Makefile.am @@ -65,7 +65,7 @@ if HAVE_XMLLINT @cd $(srcdir); \ for menu in $(menudata_DATA); do \ $(XMLLINT) --noout --valid $$menu || \ - ( echo "* $$menu INVALID *"; exit 1; ) ; \ + ( echo "*** $$menu INVALID ***"; exit 1; ) ; \ done endif diff --git a/tools/defcheck.py b/tools/defcheck.py index d7ada67483..6b63f88ee9 100755 --- a/tools/defcheck.py +++ b/tools/defcheck.py @@ -19,16 +19,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -This is a hack to check the consistency of the .def files compared to the -resp. libraries. +This is a hack to check the consistency of the .def files compared to +the respective libraries. -Invoke in the top level of the gimp source after compiling the GIMP. -Needs the tool "nm" to work. +Invoke in the top level of the gimp source tree after compiling GIMP. +If srcdir != builddir, run it in the build directory and pass the name +of the source directory on the command-line. + +Needs the tool "nm" to work """ import sys, commands +from os import path + def_files = ( "libgimpbase/gimpbase.def", "libgimpcolor/gimpcolor.def", @@ -43,16 +48,27 @@ def_files = ( have_errors = 0 -for df in def_files: - directory, rest = df.split ("/") - basename, extension = rest.split (".") - libname = directory + "/.libs/lib" + basename + "-*.so" +srcdir = None +if len(sys.argv) > 1: + srcdir = sys.argv[1] + if not path.exists(srcdir): + print "Directory '%s' does not exist" % srcdir + sys.exit (-1) +for df in def_files: + directory, name = path.split (df) + basename, extension = name.split (".") + libname = path.join(directory, ".libs", "lib" + basename + "-*.so") + + filename = df + if srcdir: + filename = path.join(srcdir, df) try: - defsymbols = file (df).read ().split ()[1:] + defsymbols = file (filename).read ().split ()[1:] except IOError, message: print message - print "You need to run this script from the toplevel source directory." + if not srcdir: + print "You should run this script from the toplevel source directory." sys.exit (-1) doublesymbols = [] @@ -80,7 +96,7 @@ for df in def_files: if unsortindex >= 0 or missing_defs or missing_nms or doublesymbols: print - print "Problem found in", df + print "Problem found in", filename if missing_defs: print " the following symbols are in the library,"