From ebdbd5b31a1a80675513f2e488af27a16b8209dc Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 22 Nov 1999 19:22:02 +0000 Subject: [PATCH] Jumbo patch: First cut at Python support (untested). A few miscellaneous bug fixes. --- COPYING | 20 +++++------ ChangeLog | 34 ++++++++++++++++++ Makefile.am | 7 ++-- Makefile.in | 22 +++++------- TODO | 1 - automake.in | 80 ++++++++++++++++++++++++++++++++--------- automake.texi | 94 ++++++++++++++++++++++++++++++++++++++++++++++-- lib/COPYING | 20 +++++------ lib/am/Makefile.am | 7 ++-- lib/am/ltlib.am | 2 +- lib/am/python.am | 40 +++++++++++++++++++++ lib/py-compile | 68 +++++++++++++++++++++++++++++++++++ ltlib.am | 2 +- m4/Makefile.am | 4 +-- m4/Makefile.in | 4 +-- m4/python.m4 | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ py-compile | 68 +++++++++++++++++++++++++++++++++++ python-clean.am | 26 ++++++++++++++ python.am | 40 +++++++++++++++++++++ stamp-vti | 2 +- version.texi | 2 +- 21 files changed, 574 insertions(+), 72 deletions(-) create mode 100644 lib/am/python.am create mode 100755 lib/py-compile create mode 100644 m4/python.m4 create mode 100755 py-compile create mode 100644 python-clean.am create mode 100644 python.am diff --git a/COPYING b/COPYING index d60c31a..a6d7d01 100644 --- a/COPYING +++ b/COPYING @@ -325,16 +325,12 @@ mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice +necessary. Hereny it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Section \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 4aa31e7..c3e0e49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +1999-11-22 Tom Tromey + + * automake.in (handle_single_transform_list): Generate explicit + rule for subdir objects. Fixes new addition to subobj.test. + + * automake.in (handle_lib_objects_cond): Allow LIBOBJS to be + defined by AC_SUBST. Fixes ltlibobjs.test. + + Fix for sourcesub.test: + * automake.in (handle_single_transform_list): Added `var' + argument. If config sub found, give error. + (handle_source_transform): Updated for new + handle_source_transform. + + * py-compile: New file. + * m4/Makefile.am (m4data_DATA): Added python.m4. + * m4/python.m4: New file. + * automake.texi (Uniform): Mention PYTHON. + (Python): New node. + * Makefile.am (amfiles): Added python.am, python-clean.am. + (dist_script_DATA): Added py-compile. + * python.am: New file. + * python-clean.am: New file. + * automake.in (seen_pythondir): New global. + (generate_makefile): Call handle_python. + (handle_python): New function. + (scan_one_configure_file): Set seen_pythondir if AM_PATH_PYTHON + seen. + (am_install_var): Special-case PYTHON like JAVA. + (scan_configure): Check for py-compile. + (initialize_global_constants): Added py-compile to @common_files. + + * ltlib.am (install-@DIR@LTLIBRARIES): Added missing space. + 1999-11-21 Tom Tromey * automake.in (finish_languages): Only generate suffix rule when diff --git a/Makefile.am b/Makefile.am index 6d192d5..f3d2544 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,8 +15,9 @@ data-clean.am data.am dejagnu.am depend.am depend2.am dist.am \ dist-vars.am footer.am header-vars.am header.am java-clean.am java.am \ kr-extra.am library.am libs-clean.am libs.am libtool.am lisp-clean.am \ lisp.am ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am \ -multilib.am program.am progs-clean.am progs.am remake-hdr.am remake.am \ -scripts.am subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am +multilib.am program.am progs-clean.am progs.am python.am \ +python-clean.am remake-hdr.am remake.am scripts.am subdirs.am \ +tags-clean.am tags.am texi-vers.am texinfos.am dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ $(amfiles) @@ -26,7 +27,7 @@ $(amfiles) ## what we want. So we make them executable by hand. scriptdir = $(pkgdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ -mkinstalldirs elisp-comp ylwrap acinstall depcomp compile +mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile install-data-hook: @$(POST_INSTALL) diff --git a/Makefile.in b/Makefile.in index ebd01fb..b897d51 100644 --- a/Makefile.in +++ b/Makefile.in @@ -80,8 +80,9 @@ data-clean.am data.am dejagnu.am depend.am depend2.am dist.am \ dist-vars.am footer.am header-vars.am header.am java-clean.am java.am \ kr-extra.am library.am libs-clean.am libs.am libtool.am lisp-clean.am \ lisp.am ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am \ -multilib.am program.am progs-clean.am progs.am remake-hdr.am remake.am \ -scripts.am subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am +multilib.am program.am progs-clean.am progs.am python.am \ +python-clean.am remake-hdr.am remake.am scripts.am subdirs.am \ +tags-clean.am tags.am texi-vers.am texinfos.am dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ @@ -90,7 +91,7 @@ $(amfiles) scriptdir = $(pkgdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ -mkinstalldirs elisp-comp ylwrap acinstall depcomp compile +mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile TAGS_FILES = automake.in aclocal.in $(amfiles) @@ -118,9 +119,9 @@ DATA = $(dist_pkgdata_DATA) $(dist_script_DATA) DIST_COMMON = README $(dist_pkgdata_DATA) $(dist_script_DATA) AUTHORS \ COPYING ChangeLog INSTALL Makefile.am Makefile.in NEWS README-alpha \ THANKS TODO aclocal.in aclocal.m4 ansi2knr.1 ansi2knr.c automake.in \ -compile config.guess config.sub configure configure.in elisp-comp \ -install-sh mdate-sh missing mkinstalldirs stamp-vti texinfo.tex \ -version.texi ylwrap +compile config.guess config.sub configure configure.in depcomp \ +elisp-comp install-sh mdate-sh missing mkinstalldirs stamp-vti \ +texinfo.tex version.texi ylwrap DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -481,14 +482,14 @@ dist: distdir ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) - $(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) dist-all: distdir -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) - $(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) distdir: $(DISTFILES) @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \ @@ -497,11 +498,6 @@ distdir: $(DISTFILES) fi -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) mkdir $(distdir) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ diff --git a/TODO b/TODO index 250bc67..dd748d7 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ * Document why putting @FOO@ in _SOURCES doesn't work. - Make it an error when the user tries to do this This must be done for 1.5 * if automake -a, and dangling links exist, automake should diff --git a/automake.in b/automake.in index e3b5a2a..15ed221 100755 --- a/automake.in +++ b/automake.in @@ -204,6 +204,9 @@ $package_version_line = 0; # TRUE if we've seen AM_PATH_LISPDIR. $seen_lispdir = 0; +# TRUE if we've seen AM_CHECK_PYTHON. +$seen_pythondir = 0; + # TRUE if we've seen AC_EXEEXT. $seen_exeext = 0; @@ -620,6 +623,7 @@ sub generate_makefile &handle_multilib; &handle_texinfo; &handle_emacs_lisp; + &handle_python; &handle_java; &handle_man_pages; &handle_data; @@ -1117,7 +1121,7 @@ sub check_libobjs_sources # remaining elements are names of objects sub handle_single_transform_list { - local ($derived, $obj, @files) = @_; + local ($var, $derived, $obj, @files) = @_; local (@result) = (); local ($nonansi_obj) = $obj; $nonansi_obj =~ s/_//g; @@ -1127,8 +1131,12 @@ sub handle_single_transform_list # Turn sources into objects. foreach (@files) { - # Skip things that look like configure substitutions. - next if /^\@.*\@$/; + # Configure substitutions in _SOURCES variables are errors. + if (/^\@.*\@$/) + { + &am_line_error ($var, "$var includes configure substitution \`$_'"); + next; + } # If the source file is in a subdirectory then the `.o' is # put into the current directory. @@ -1236,10 +1244,12 @@ sub handle_single_transform_list } # If doing dependency tracking, then we can't print - # the rule. - if ($use_dependencies - && $rule ne '' - && $language_map{$lang . '-autodep'} ne 'no') + # the rule. Also, if we have a subdir object, we need + # to generate an explicit rule. + if (($use_dependencies + && $rule ne '' + && $language_map{$lang . '-autodep'} ne 'no') + || ($r == $LANG_SUBDIR && $directory ne '')) { $rule = ''; local ($obj_sans_ext) = substr ($object, 0, @@ -1418,7 +1428,7 @@ sub handle_source_transform { @files = &variable_value_as_list ($var, $cond); ($temp, @result) = - &handle_single_transform_list ($one_file, $obj, + &handle_single_transform_list ($var, $one_file, $obj, @files); $linker = $temp if $linker eq ''; @@ -1435,8 +1445,8 @@ sub handle_source_transform # Avoid defining needless variables. next if (scalar @files == 0); - ($temp, @result) = &handle_single_transform_list ($one_file, $obj, - @files); + ($temp, @result) = &handle_single_transform_list ($var, $one_file, + $obj, @files); $linker = $temp if $linker eq ''; &define_pretty_variable ($xpfx . $one_file . "_OBJECTS", '', @result) unless $prefix =~ /EXTRA_/; @@ -1451,7 +1461,8 @@ sub handle_source_transform push (@objects, $unxformed . $obj); push (@files, $unxformed . '.c'); - ($temp, @result) = &handle_single_transform_list ($one_file, $obj, + ($temp, @result) = &handle_single_transform_list ($one_file . '_SOURCES', + $one_file, $obj, @files); $linker = $temp if $linker eq ''; &define_pretty_variable ($one_file . "_OBJECTS", '', @result) @@ -1574,7 +1585,8 @@ sub handle_lib_objects_cond push (@dep_list, $lsearch); $seen_libobjs = 1; - if (! keys %libsources) + if (! keys %libsources + && ! &variable_defined ($1 . 'LIBOBJS')) { &am_line_error ($var, "\@$1" . "LIBOBJS\@ seen but never set in \`configure.in'"); } @@ -4120,6 +4132,33 @@ sub handle_emacs_lisp } } +# Handle Python +sub handle_python +{ + local (@pyfiles) = &am_install_var ('-defaultdist', 'python', 'PYTHON', + 'python', 'noinst'); + return if ! @pyfiles; + + # Found some python. + &define_configure_variable ('pythondir'); + &define_configure_variable ('PYTHON'); + + $output_rules .= &file_contents ('python-clean'); + push (@clean, 'python'); + + &am_error ("\`python_PYTHON' defined but \`AM_CHECK_PYTHON' not in \`configure.in'") + if ! $seen_pythondir && &variable_defined ('python_PYTHON'); + + if ($config_aux_dir eq '.' || $config_aux_dir eq '') + { + &define_variable ('py_compile', '$(top_srcdir)/py-compile'); + } + else + { + &define_variable ('py_compile', $config_aux_dir . '/py-compile'); + } +} + # Handle Java. sub handle_java { @@ -4537,6 +4576,7 @@ sub scan_one_configure_file $seen_prog_install = 1 if /AC_PROG_INSTALL/; $seen_lispdir = 1 if /AM_PATH_LISPDIR/; + $seen_pythondir = 1 if /AM_PATH_PYTHON/; if (/A(C|M)_PROG_LIBTOOL/) { @@ -4614,6 +4654,9 @@ sub scan_configure } &am_error ("\`install.sh' is an anachronism; use \`install-sh' instead") if -f $config_aux_path[0] . '/install.sh'; + + &require_config_file ($FOREIGN, 'py-compile') + if $seen_pythondir; } ################################################################ @@ -6515,7 +6558,7 @@ sub initialize_global_constants "libversion.in", "mdate-sh", "mkinstalldirs", "install-sh", 'texinfo.tex', "ansi2knr.c", "ansi2knr.1", 'elisp-comp', 'ylwrap', 'acinclude.m4', @libtoolize_files, - 'missing', 'depcomp', 'compile' + 'missing', 'depcomp', 'compile', 'py-compile' ); # Commonly used files we auto-include, but only sometimes. @@ -6972,9 +7015,11 @@ sub am_install_var # Now that configure substitutions are allowed in where_HOW # variables, it is an error to actually define the primary. We # allow `JAVA', as it is customarily used to mean the Java - # interpreter. This is but one of several Java hacks. + # interpreter. This is but one of several Java hacks. Similarly, + # `PYTHON' is customarily used to mean the Python interpreter. &am_line_error ($primary, "\`$primary' is an anachronism") - if &variable_defined ($primary) && $primary ne 'JAVA'; + if &variable_defined ($primary) + && ($primary ne 'JAVA' && $primary ne 'PYTHON'); # Look for misspellings. It is an error to have a variable ending @@ -7172,7 +7217,8 @@ sub am_install_var } # The JAVA variable is used as the name of the Java interpreter. - if (@used && $primary ne 'JAVA') + # The PYTHON variable is used as the name of the Python interpreter. + if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON') { # Define it. &define_pretty_variable ($primary, '', @used); @@ -7187,7 +7233,7 @@ sub am_install_var # Push here because PRIMARY might be configure time determined. push (@all, '$(' . $primary . ')') - if @used && $primary ne 'JAVA'; + if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; # Make the result unique. This lets the user use conditionals in # a natural way, but still lets us program lazily -- we don't have diff --git a/automake.texi b/automake.texi index 399ec9f..a3ddd12 100644 --- a/automake.texi +++ b/automake.texi @@ -476,11 +476,12 @@ The special prefix @samp{check} indicates that the objects in question should not be built until the @code{make check} command is run. Possible primary names are @samp{PROGRAMS}, @samp{LIBRARIES}, -@samp{LISP}, @samp{SCRIPTS}, @samp{DATA}, @samp{HEADERS}, @samp{MANS}, -and @samp{TEXINFOS}. +@samp{LISP}, @samp{PYTHON}, @samp{SCRIPTS}, @samp{DATA}, @samp{HEADERS}, +@samp{MANS}, and @samp{TEXINFOS}. @vindex PROGRAMS @vindex LIBRARIES @vindex LISP +@vindex PYTHON @vindex SCRIPTS @vindex DATA @vindex HEADERS @@ -2510,6 +2511,7 @@ use in GNU programs, it tries hard to interoperate with other GNU tools. * Guile:: Guile * Libtool:: Libtool * Java:: Java +* Python:: Python @end menu @@ -2595,7 +2597,7 @@ libtool, The Libtool Manual}) with the @samp{LTLIBRARIES} primary. @xref{A Shared Library}. -@node Java, , Libtool, Other GNU Tools +@node Java, Python, Libtool, Other GNU Tools @section Java @cindex _JAVA primary, defined @@ -2618,6 +2620,92 @@ restriction is that, in general, it isn't possible to know which @file{.class} files were generated from which @file{.java} files -- so it would be impossible to know which files to install where. +@node Python, , Java, Other GNU Tools +@section Python + +@cindex _PYTHON primary, defined +@cindex PYTHON primary, defined +@cindex Primary variable, PYTHON + + +Automake provides support for Python modules. Automake will turn on +Python support if the @code{AM_CHECK_PYTHON} macro is used in +@file{configure.in}. The @samp{PYTHON} primary is used to hold a list +of @file{.py} files. Possible prefixes for this primary are +@samp{python_} and @samp{noinst_}. Note that if @code{python_PYTHON} is +defined, then @file{configure.in} must run @code{AM_CHECK_PYTHON}. + +@code{AM_CHECK_PYTHON} takes a single argument --- either the word +@samp{module} or @samp{package}. The first installs files directly into +the @file{site-packages} directory and is used when the @file{.py[co]} +files must be on the @code{PYTHONPATH}. The second is used for modules +distributed as a package, which should be installed in a subdirectory +of @file{site-packages} and contain the @file{__init__.py} file. The +subdirectory name is the same as the name given by @samp{PACKAGE}. + + +@code{AM_CHECK_PYTHON} creates several output variables based on the +Python installation found during configuration. + +@table @samp +@item PYTHON +The name of the Python executable. + +@item PYTHON_VERSION +The Python version number, in the form @var{major}.@var{minor} +(e.g. @samp{1.5}). This is currently the value of +@code{sys.version[:3]}. + +@item PYTHON_PREFIX +The string @code{$prefix}. This term may be used in future work +which needs the contents of Python's @code{sys.prefix}, but general +consensus is to always use the value from configure. + +@item PYTHON_EXEC_PREFIX +The string @code{$exec_prefix}. This term may be used in future work +which needs the contents of Python's @code{sys.exec_prefix}, but general +consensus is to always use the value from configure. + +@item PYTHON_PLATFORM +The canonical name used by Python to describe the operating system, as +given by @code{sys.platform}. This value is sometimes needed when +building Python extensions. + +@item pythondir +The directory name for the top of the standard Python library. + +@item PYTHON_SITE +The location of the platform-independent @file{site-packages} directory, +where `module' files are installed. Note that older versions of Python +(pre-1.5) used @file{$prefix/lib/site-python} so future versions of +Automake's Python support may provide backwards compatibility. + +@item PYTHON_SITE_PACKAGE +The string @code{$PYTHON_SITE/$PACKAGE}. This is the default +installation directory for a Python `package.' + +@item PYTHON_SITE_INSTALL +The top-level directory in which the Python files will be installed. It +will be the value of either @samp{PYTHON_SITE} or @samp{PYTHON_PACKAGE} +depending on the argument given to @code{AM_CHECK_PYTHON}. + +@item PYTHON_SITE_EXEC +The location of the platform-dependent @file{site-packages} directory, +where shared library extensions should be placed. Note that older +versions of Python (pre-1.5) used @file{sharedmodules} so future version +of Automake's Python support may provide backwards compatibility. + +@end table + +@vindex PYCFILES +@vindex PYOFILES + +By default Automake will byte-compile all Python source files to both +@file{.pyc} and @file{.pyo} forms. If you wish to avoid generating the +optimized byte-code files, simply define the variable @code{PYOFILES} to +be empty. Similarly, if you don't wish to generate the standard +byte-compiled files, define the variable @code{PYCFILES} to be empty. + @node Documentation, Install, Other GNU Tools, Top @chapter Building documentation diff --git a/lib/COPYING b/lib/COPYING index d60c31a..a6d7d01 100644 --- a/lib/COPYING +++ b/lib/COPYING @@ -325,16 +325,12 @@ mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice +necessary. Hereny it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Section \ No newline at end of file diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 6d192d5..f3d2544 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -15,8 +15,9 @@ data-clean.am data.am dejagnu.am depend.am depend2.am dist.am \ dist-vars.am footer.am header-vars.am header.am java-clean.am java.am \ kr-extra.am library.am libs-clean.am libs.am libtool.am lisp-clean.am \ lisp.am ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am \ -multilib.am program.am progs-clean.am progs.am remake-hdr.am remake.am \ -scripts.am subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am +multilib.am program.am progs-clean.am progs.am python.am \ +python-clean.am remake-hdr.am remake.am scripts.am subdirs.am \ +tags-clean.am tags.am texi-vers.am texinfos.am dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ $(amfiles) @@ -26,7 +27,7 @@ $(amfiles) ## what we want. So we make them executable by hand. scriptdir = $(pkgdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ -mkinstalldirs elisp-comp ylwrap acinstall depcomp compile +mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile install-data-hook: @$(POST_INSTALL) diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am index f5f5c3c..3b660c3 100644 --- a/lib/am/ltlib.am +++ b/lib/am/ltlib.am @@ -26,7 +26,7 @@ install-@DIR@LTLIBRARIES: $(@DIR@_LTLIBRARIES) ## if the program doesn't have a name that libtool expects. ## Use INSTALL and not INSTALL_DATA because libtool knows the right ## permissions to use. - echo "@LIBTOOL --mode=install@ $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@NDIR@dir)/$$p"; \ + echo " @LIBTOOL --mode=install@ $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@NDIR@dir)/$$p"; \ @LIBTOOL --mode=install@ $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@NDIR@dir)/$$p; \ else :; fi; \ done diff --git a/lib/am/python.am b/lib/am/python.am new file mode 100644 index 0000000..0f47e18 --- /dev/null +++ b/lib/am/python.am @@ -0,0 +1,40 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1999 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +install-@DIR@PYTHON: $(@DIR@_PYTHON) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(@DIR@dir) + @list='$(@DIR@_PYTHON)'; for p in $$list; do\ + if test -f $(srcdir)/$$p; then \ +## Don't perform translation, since script name is important. + echo " $(INSTALL_PROGRAM) $(srcdir)/$$p $(DESTDIR)$(@DIR@dir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(@DIR@dir)/$$p; \ + else :; fi; \ + done +## Byte-compile must be done at install time, since file times are +## encoded in the actual files. + @PYTHON=$(PYTHON) $(py_compile) --basedir $(DESTDIR)$(@DIR@dir) $(@DIR@_PYTHON) + +uninstall-@DIR@PYTHON: + @$(NORMAL_UNINSTALL) + list='$(@DIR@_PYTHON)'; for p in $$list; do \ + rm -f $(DESTDIR)$(@DIR@dir)/$$p; \ +## This is to remove the .pyc and .pyo byte compiled versions (a bit +## of a hack). + rm -f $(DESTDIR)$(@DIR@dir)/$${p}c; \ + rm -f $(DESTDIR)$(@DIR@dir)/$${p}o; \ + done diff --git a/lib/py-compile b/lib/py-compile new file mode 100755 index 0000000..b60649d --- /dev/null +++ b/lib/py-compile @@ -0,0 +1,68 @@ +#!/bin/sh +# called as "py-compile [--basedir DIR] PY_FILES ... + +if [ -z "$PYTHON" ]; then + PYTHON=python +fi + +basedir= + +case "$1" in + --basedir) + basedir=$2 + shift 2 + ;; + --help) + echo "Usage: py-compile [--basedir DIR] PY_FILES ..." + echo "Byte compile some python scripts. This should be performed" + echo "after they have been moved to the final installation location" + exit 0 + ;; + --version) + echo "py-compile version 0.0" + exit 0 + ;; +esac + +if [ $# = 0 ]; then + echo "No files given to $0" 1>&2 + exit 1 +fi + +# if basedir was given, then it should be prepended to filenames before +# byte compilation. +if [ -z "$basedir" ]; then + trans="path = file" +else + trans="path = os.path.join('$basedir', file)" +fi + +$PYTHON -c " +import sys, os, string, py_compile + +files = '''$*''' +print 'Byte-compiling python modules...' +for file in string.split(files): + $trans + if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): + continue + print file, + sys.stdout.flush() + py_compile.compile(path) +print" || exit $? + +# this will fail for python < 1.5, but that doesn't matter ... +$PYTHON -O -c " +import sys, os, string, py_compile + +files = '''$*''' +print 'Byte-compiling python modules (optimised versions) ...' +for file in string.split(files): + $trans + if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): + continue + print file, + sys.stdout.flush() + py_compile.compile(path) +print" 2>/dev/null || : + diff --git a/ltlib.am b/ltlib.am index f5f5c3c..3b660c3 100644 --- a/ltlib.am +++ b/ltlib.am @@ -26,7 +26,7 @@ install-@DIR@LTLIBRARIES: $(@DIR@_LTLIBRARIES) ## if the program doesn't have a name that libtool expects. ## Use INSTALL and not INSTALL_DATA because libtool knows the right ## permissions to use. - echo "@LIBTOOL --mode=install@ $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@NDIR@dir)/$$p"; \ + echo " @LIBTOOL --mode=install@ $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@NDIR@dir)/$$p"; \ @LIBTOOL --mode=install@ $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(@NDIR@dir)/$$p; \ else :; fi; \ done diff --git a/m4/Makefile.am b/m4/Makefile.am index 3f7b750..8f57d90 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -6,7 +6,7 @@ MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \ error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 maintainer.m4 \ -minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 regex.m4 \ -sanity.m4 strtod.m4 termios.m4 winsz.m4 +minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 \ +python.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) diff --git a/m4/Makefile.in b/m4/Makefile.in index 4ccd58c..ef27641 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -73,8 +73,8 @@ MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \ error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 maintainer.m4 \ -minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 regex.m4 \ -sanity.m4 strtod.m4 termios.m4 winsz.m4 +minuso.m4 missing.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 \ +python.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) diff --git a/m4/python.m4 b/m4/python.m4 new file mode 100644 index 0000000..0ee447e --- /dev/null +++ b/m4/python.m4 @@ -0,0 +1,103 @@ +## ------------------------ +## Python file handling +## From Andrew Dalke +## ------------------------ + +dnl AM_PATH_PYTHON([package, module]) +dnl + +dnl Adds support for distributing Python modules or the special form +dnl of a module called a `package.' Modules of the first type are +dnl files ending in `.py' with no '__init__.py' file. This must be +dnl placed on the PYTHONPATH, and the default location is PYTHON_SITE, +dnl or $(prefix)/lib/python$(PYTHON_VERSION)/site-package +dnl +dnl A package module is contained in its own directory. This directory +dnl is named PACKAGE, which was the name given to automake. The full +dnl directory path is PYTHON_SITE_PACKAGE or +dnl $(prefix)/lib/python$(PYTHON_VERSION)/site-package/$(PACKAGE) +dnl where site-package is on the PYTHONPATH. The `__init__.py' file is +dnl located in the directory, along with any other submodules which may +dnl be necessary. + + +AC_DEFUN(AM_PATH_PYTHON, + [ + dnl Find a version of Python. I could check for python versions 1.4 + dnl or earlier, but the default installation locations changed from + dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages + dnl in 1.5, and I don't want to maintain that logic. + + AC_PATH_PROG(PYTHON, python python1.5) + + AC_MSG_CHECKING([local Python configuration]) + + dnl Query Python for its version number. Getting [:3] seems to be + dnl the best way to do this; it's what "site.py" does in the standard + dnl library. Need to change quote character because of [:3] + + AC_SUBST(PYTHON_VERSION) + changequote(<<, >>)dnl + PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` + changequote([, ])dnl + + + dnl Use the values of $prefix and $exec_prefix for the corresponding + dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made + dnl distinct variables so they can be overridden if need be. However, + dnl general consensus is that you shouldn't need this ability. + + AC_SUBST(PYTHON_PREFIX) + PYTHON_PREFIX='${prefix}' + + AC_SUBST(PYTHON_EXEC_PREFIX) + PYTHON_EXEC_PREFIX='${exec_prefix}' + + dnl At times (like when building shared libraries) you may want + dnl to know which OS platform Python thinks this is. + + AC_SUBST(PYTHON_PLATFORM) + PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"` + + + dnl Set up 4 directories: + + dnl pythondir -- location of the standard python libraries + dnl Also lets automake think PYTHON means something. + + AC_SUBST(pythondir) + pythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION + + dnl PYTHON_SITE -- the platform independent site-packages directory + + AC_SUBST(PYTHON_SITE) + PYTHON_SITE=$pythondir/site-packages + + dnl PYTHON_SITE_PACKAGE -- the $PACKAGE directory under PYTHON_SITE + + AC_SUBST(PYTHON_SITE_PACKAGE) + PYTHON_SITE_PACKAGE=$pythondir/site-packages/$PACKAGE + + dnl PYTHON_SITE_EXEC -- platform dependent site-packages dir (eg, for + dnl shared libraries) + + AC_SUBST(PYTHON_SITE_EXEC) + PYTHON_SITE_EXEC=$PYTHON_EXEC_PREFIX"/lib/python"$PYTHON_VERSION/site-packages + + + dnl Configure PYTHON_SITE_INSTALL so it points to either the module + dnl directory or the package subdirectory, depending on the $1 + dnl parameter ("module" or "package"). + + AC_SUBST(PYTHON_SITE_INSTALL) + ifelse($1, module, [PYTHON_SITE_INSTALL=$PYTHON_SITE], + $1, package, [PYTHON_SITE_INSTALL=$PYTHON_SITE_PACKAGE], + [errprint([Unknown option `$1' used in call to AM_PATH_PYTHON. +Valid options are `module' or `package' +])m4exit(4)]) + + + dnl All done. + + AC_MSG_RESULT(looks good) +]) diff --git a/py-compile b/py-compile new file mode 100755 index 0000000..b60649d --- /dev/null +++ b/py-compile @@ -0,0 +1,68 @@ +#!/bin/sh +# called as "py-compile [--basedir DIR] PY_FILES ... + +if [ -z "$PYTHON" ]; then + PYTHON=python +fi + +basedir= + +case "$1" in + --basedir) + basedir=$2 + shift 2 + ;; + --help) + echo "Usage: py-compile [--basedir DIR] PY_FILES ..." + echo "Byte compile some python scripts. This should be performed" + echo "after they have been moved to the final installation location" + exit 0 + ;; + --version) + echo "py-compile version 0.0" + exit 0 + ;; +esac + +if [ $# = 0 ]; then + echo "No files given to $0" 1>&2 + exit 1 +fi + +# if basedir was given, then it should be prepended to filenames before +# byte compilation. +if [ -z "$basedir" ]; then + trans="path = file" +else + trans="path = os.path.join('$basedir', file)" +fi + +$PYTHON -c " +import sys, os, string, py_compile + +files = '''$*''' +print 'Byte-compiling python modules...' +for file in string.split(files): + $trans + if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): + continue + print file, + sys.stdout.flush() + py_compile.compile(path) +print" || exit $? + +# this will fail for python < 1.5, but that doesn't matter ... +$PYTHON -O -c " +import sys, os, string, py_compile + +files = '''$*''' +print 'Byte-compiling python modules (optimised versions) ...' +for file in string.split(files): + $trans + if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): + continue + print file, + sys.stdout.flush() + py_compile.compile(path) +print" 2>/dev/null || : + diff --git a/python-clean.am b/python-clean.am new file mode 100644 index 0000000..91aa2bc --- /dev/null +++ b/python-clean.am @@ -0,0 +1,26 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1999 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +mostlyclean-python: + +clean-python: + -test -z "$(PYCFILES)" || rm -f $(PYCFILES) + -test -z "$(PYOFILES)" || rm -f $(PYOFILES) + +distclean-python: + +maintainer-clean-python: diff --git a/python.am b/python.am new file mode 100644 index 0000000..0f47e18 --- /dev/null +++ b/python.am @@ -0,0 +1,40 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1999 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +install-@DIR@PYTHON: $(@DIR@_PYTHON) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(@DIR@dir) + @list='$(@DIR@_PYTHON)'; for p in $$list; do\ + if test -f $(srcdir)/$$p; then \ +## Don't perform translation, since script name is important. + echo " $(INSTALL_PROGRAM) $(srcdir)/$$p $(DESTDIR)$(@DIR@dir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(@DIR@dir)/$$p; \ + else :; fi; \ + done +## Byte-compile must be done at install time, since file times are +## encoded in the actual files. + @PYTHON=$(PYTHON) $(py_compile) --basedir $(DESTDIR)$(@DIR@dir) $(@DIR@_PYTHON) + +uninstall-@DIR@PYTHON: + @$(NORMAL_UNINSTALL) + list='$(@DIR@_PYTHON)'; for p in $$list; do \ + rm -f $(DESTDIR)$(@DIR@dir)/$$p; \ +## This is to remove the .pyc and .pyo byte compiled versions (a bit +## of a hack). + rm -f $(DESTDIR)$(@DIR@dir)/$${p}c; \ + rm -f $(DESTDIR)$(@DIR@dir)/$${p}o; \ + done diff --git a/stamp-vti b/stamp-vti index d8c30bd..950da01 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 19 November 1999 +@set UPDATED 21 November 1999 @set EDITION 1.4a @set VERSION 1.4a diff --git a/version.texi b/version.texi index d8c30bd..950da01 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 19 November 1999 +@set UPDATED 21 November 1999 @set EDITION 1.4a @set VERSION 1.4a -- 2.7.4