summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniel Richard G <oss@teragram.com>2012-08-09 19:46:03 +0800
committerDaniel Veillard <veillard@redhat.com>2012-08-09 19:46:03 +0800
commita2cd8a03ac2ae0b46b51320f6f56f09c23880d7a (patch)
tree990f931fa59bf585e34eaed24eaaa135e513494b /python
parent1564b30e994602a95863d9716be83612580a2fed (diff)
downloadlibxslt-a2cd8a03ac2ae0b46b51320f6f56f09c23880d7a.tar.gz
libxslt-a2cd8a03ac2ae0b46b51320f6f56f09c23880d7a.tar.bz2
libxslt-a2cd8a03ac2ae0b46b51320f6f56f09c23880d7a.zip
Various "make distcheck" and other fixes
Makefile.am: * Use $(VAR), not @VAR@, as the former is the correct form for AC_SUBST'ed variables in Makefile.am files * Touch these *.xml/*.syms files in the "dist-hook" target to prevent them from being regenerated, because the "make dist" process in itself updates the timestamps of the source files when it copies them into $(distdir) * Add EXTRA_LIBS (-lrt on my system) to xsltConf.sh, as this is a required dependency when client applications link against -lxslt (note that the definition of EXTRA_LIBS has been changed; see below) * Removed MAKEFLAGS+=--silent bits, as this is not compatible with non-GNU Make programs autogen.sh: * Add --warnings=all options to automake and autoconf invocations, to better catch potential problems (most of which I've fixed in this patch) configure.in: * Replaced obsolete macros with their current equivalents; for reference, see http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html (I removed AC_ISC_POSIX outright because the doc states it is no longer useful) * test(1) uses "=" as an operator, not "==" * Fixed quoting on an AC_LINK_IFELSE() invocation to quell Autoconf errors * Don't add redundant libraries to EXTRA_LIBS, because (1) this variable already contains LibXSLT's own additional system-library deps, and is useful in that form, and (2) the LibXML2 deps are already handled by Libtool * Don't delete files in srcdir, and don't create the symlink to "Copyright" there either (I don't understand why this is being symlinked in the first place...) doc/Makefile.am: * Can't use wildcards in EXTRA_DIST, because this breaks dependencies (e.g. you can't "make EXSLT/\*.html"), and they only work properly when building inside the source tree; these have been replaced with their expansions. Other entries have been added here in lieu of the wildcards in the dist-hook target, as well as opportunistic use of the $(*PAGES) variables. * Don't define an "all" target, because this steps on Automake's toes; use "all-local" instead * Define and use an "xsltproc" variable to reference an in-tree-built version of xsltproc, instead of e.g. $(bindir)/xsltproc NOTE: The makefile also uses $(XSLTPROC), which names an external instance of the program found at configure time. Some instances of this could probably be changed to $(xsltproc) to remove the dependency on an existing installed program. * Qualified various filenames as appropriate with $(srcdir) * Use $(XMLLINT) consistently instead of $(bindir)/xmllint * In the "libxslt-api.xml ..." rule, cd into $(srcdir) before invoking apibuild.py as this script has to run in srcdir anyway * In the "clean-local" rule, clear out some additional files to allow "make distcheck" to pass * Eliminated the redundant "maintainer-clean-local" rule * Added a "distclean-local" rule to clear out the build directory in an out-of-source build to allow "make distcheck" to pass * Added a "check-extra-dist" target to make it easier to check that EXTRA_DIST isn't missing anything * Use $(MKDIR_P), not $(mkinstalldirs), as the latter name is obsolete * Use $(VAR) instead of @VAR@ * The "dist-hook" target didn't work (if any generated files were in builddir and not in srcdir), and is no longer needed thanks to the comprehensive EXTRA_DIST variable * Added an "uninstall-local" rule to allow "make distcheck" to pass * Updated the .PHONY target list, removed non-existent targets doc/symbols.xml: * Needed to add this bit to make the generation scripts shut up libexslt/Makefile.am: * AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an obsolete name * Moved $(LIBXML_CFLAGS) to AM_CFLAGS, to segregate CFLAGS from CPPFLAGS (Note that $(CFLAGS) need not be added to AM_CFLAGS, because Automake already references both in the build rules) * Use $(VAR) instead of @VAR@ libxslt.pc.in: * Add EXTRA_LIBS (-lrt on my system), as this is a required dependency when client applications link against -lxslt libxslt/Makefile.am: * AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an obsolete name * Moved $(LIBXML_CFLAGS) to AM_CFLAGS, to segregate CFLAGS from CPPFLAGS * Use $(VAR) instead of @VAR@, $(MKDIR_P) instead of $(mkinstalldirs) * Use $(MKDIR_P), not $(mkinstalldirs), as the latter name is obsolete libxslt/xsltutils.c: * Some systems don't know about CLOCK_MONOTONIC; older Solaris knows about CLOCK_HIGHRES. Some systems, alas, have no usable alternative to CLOCK_REALTIME. python/Makefile.am: * AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an obsolete name * Moved $(LIBXML_CFLAGS) to AM_CFLAGS, to segregate CFLAGS from CPPFLAGS * Because libxslt-py.c is (presumably) supposed to be generated every time at build time, don't bundle it in the dist tarball * Use $(VAR) instead of @VAR@ * libxsltclass.py is a generated file, so it doesn't get qualified with $(srcdir) * Use $(MKDIR_P) instead of (mkinstalldirs) * Added an uninstall-local rule so that "make distcheck" passes * Removed the $(srcdir) qualifications in the GENERATED file list, as these files may exist in builddir * In the gen_prog rule, qualify the script invocation with $(srcdir), and set the SRCDIR environment variable so that the script can find the files it needs when builddir != srcdir * Don't define an "all" target, as this steps on Automake's toes python/generator.py: * Get the source directory from the SRCDIR environment variable, and use it appropriately python/tests/Makefile.am: * Set CLEANFILES instead of defining a "clean" rule * Use $(VAR) instead of @VAR@, $(MKDIR_P) instead of $(mkinstalldirs) tests/*/Makefile.am, tests/exslt/*/Makefile.am: * Need to clean up .memdump files for "make distcheck" to pass * Don't define an "all" target, as this steps on Automake's toes tests/REC/Makefile.am: * Added two missing *.stand.out files to EXTRA_DIST tests/XSLTMark/Makefile.am: * Replaced the GNU-Make-specific %.out bit with a more broadly compatible rule (the "dummy" bit shuts up Automake) * Use "$(xsltproc)" instead of "$(top_builddir)/xsltproc/xsltproc" * Use a less $(MAKE)-heavy invocation in the "tests" target * Replaced a conflicting "clean" target with CLEANFILES * Added a dependency on $(xsltproc) to all the test targets * Added a .PHONY target list tests/docbook/Makefile.am: * Ditched the "echo -n" bit, because it wasn't working as advertised * Create output directories for out-of-source builds * "$(basename $$i)" is a typo in a makefile * Don't embed $(srcdir) in $out/$html/$fo/$msg/$xhtml, so that we can refer to these files in builddir or srcdir * Add a trailing "echo" to complete the "echo -n" * Don't output files unconditionally to srcdir (it may be read-only, for starters) tests/plugins/Makefile.am: * AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an obsolete name (Note that the "$(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)" bit that was here can be dropped entirely, because these already appear in xmlsoft_org_xslt_testplugin_la_CFLAGS) * Use noinst_LTLIBRARIES inside the WITH_MODULES conditional instead of EXTRA_LTLIBRARIES, as this is cleaner (and disallows building the plugin if module support is disabled) * Need to clean up *.res files for "make distcheck" to pass * Use the abs_builddir variable conveniently provided to us by Automake instead of a GNU Make $(shell ...) construct xslt-config.in: * Add EXTRA_LIBS (-lrt on my system), as this is a required dependency when client applications link against -lxslt xsltproc/Makefile.am: * AM_CPPFLAGS should be used instead of INCLUDES, as the latter is an obsolete name * Moved $(LIBXML_CFLAGS) into AM_CFLAGS * Use $(VAR) instead of @VAR@ * Need to clean .memdump for "make distcheck" to pass * Added rules to build lib[e]xslt.la if needed, which allows test makefiles to build xsltproc on the fly even if nothing else has been built already * Create .memdump file in the "tests" target, as it's being grepped afterward
Diffstat (limited to 'python')
-rw-r--r--python/Makefile.am41
-rwxr-xr-xpython/generator.py7
-rw-r--r--python/tests/Makefile.am9
3 files changed, 31 insertions, 26 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index fd3ef283..48a6c6e5 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -3,13 +3,14 @@ AUTOMAKE_OPTIONS = 1.4 foreign
SUBDIRS= . tests
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(PYTHON_INCLUDES) \
- $(LIBXML_CFLAGS) \
-I$(top_srcdir)/libxslt \
-I$(top_srcdir) \
-I../libexslt
+AM_CFLAGS = $(LIBXML_CFLAGS)
+
DOCS_DIR = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)
# libxsltclass.txt is generated
DOCS = TODO
@@ -35,38 +36,42 @@ all-local: libxslt.py
python_LTLIBRARIES = libxsltmod.la
-libxsltmod_la_SOURCES = libxslt.c types.c libxslt-py.c
-libxsltmod_la_LIBADD = $(mylibs) @PYTHON_LIBS@
+libxsltmod_la_SOURCES = libxslt.c types.c
+nodist_libxsltmod_la_SOURCES = libxslt-py.c
+libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS)
-libxslt.py: $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py
- cat $(srcdir)/libxsl.py $(srcdir)/libxsltclass.py > libxslt.py
+libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
+ cat $(srcdir)/libxsl.py libxsltclass.py > $@
install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(pythondir)
- @INSTALL@ -m 0644 libxslt.py $(DESTDIR)$(pythondir)
- $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
+ $(MKDIR_P) $(DESTDIR)$(pythondir)
+ $(INSTALL) -m 0644 libxslt.py $(DESTDIR)$(pythondir)
+ $(MKDIR_P) $(DESTDIR)$(DOCS_DIR)
@(for doc in $(DOCS) ; \
- do @INSTALL@ -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done)
+ do $(INSTALL) -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done)
+
+uninstall-local:
+ rm -f $(DESTDIR)$(pythondir)/libxslt.py
+ rm -rf $(DESTDIR)$(DOCS_DIR)
GENERATE = generator.py
API_DESC = $(top_srcdir)/doc/libxslt-api.xml $(srcdir)/libxslt-python-api.xml
-GENERATED= $(srcdir)/libxsltclass.py \
- $(srcdir)/libxslt-export.c \
- $(srcdir)/libxslt-py.c \
- $(srcdir)/libxslt-py.h \
- $(srcdir)/libxsltclass.txt
+GENERATED= libxsltclass.py \
+ libxslt-export.c \
+ libxslt-py.c \
+ libxslt-py.h \
+ libxsltclass.txt
$(GENERATED): gen_prog
gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
- cd $(srcdir) && $(PYTHON) $(GENERATE)
+ SRCDIR=$(srcdir) $(PYTHON) $(srcdir)/$(GENERATE)
touch gen_prog
$(libxsltmod_la_OBJECTS): $(GENERATED)
-else
-all:
endif
+
tests test: all
cd tests && $(MAKE) tests
diff --git a/python/generator.py b/python/generator.py
index 797528fe..c13c8775 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -18,6 +18,7 @@ import os
import xml.sax
debug = 0
+srcdir = os.getenv("SRCDIR", ".")
def getparser():
# Attach parser to an unmarshalling object. return both objects.
@@ -392,14 +393,14 @@ def buildStubs():
global unknown_types
try:
- f = open("libxslt-api.xml")
+ f = open("%s/libxslt-api.xml" % srcdir)
data = f.read()
(parser, target) = getparser()
parser.feed(data)
parser.close()
except IOError, msg:
try:
- f = open("../doc/libxslt-api.xml")
+ f = open("%s/../doc/libxslt-api.xml" % srcdir)
data = f.read()
(parser, target) = getparser()
parser.feed(data)
@@ -413,7 +414,7 @@ def buildStubs():
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject",
"pythonObject", "libxml_")
try:
- f = open("libxslt-python-api.xml")
+ f = open("%s/libxslt-python-api.xml" % srcdir)
data = f.read()
(parser, target) = getparser()
parser.feed(data)
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 24586881..f757774f 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -15,6 +15,8 @@ EXTRAS= \
EXTRA_DIST = $(TESTSPY) $(XMLS) $(EXTRAS)
+CLEANFILES = *.pyc core
+
if WITH_PYTHON
tests: $(TESTSPY)
-@(PYTHONPATH="`pwd`/..:`pwd`/../.libs:$(srcdir)/.."; \
@@ -25,11 +27,8 @@ else
tests:
endif
-clean:
- rm -f *.pyc core
-
install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
+ $(MKDIR_P) $(DESTDIR)$(EXAMPLE_DIR)
-(for test in $(TESTSPY) $(XMLS) $(EXTRAS); \
- do @INSTALL@ -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
+ do $(INSTALL) -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)