"Fossies" - the Fresh Open Source Software Archive

Member "automake-1.16.3/t/python-vars.sh" (19 Nov 2020, 2980 Bytes) of package /linux/misc/automake-1.16.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "python-vars.sh": 1.16.2_vs_1.16.3.

    1 #! /bin/sh
    2 # Copyright (C) 2011-2020 Free Software Foundation, Inc.
    3 #
    4 # This program is free software; you can redistribute it and/or modify
    5 # it under the terms of the GNU General Public License as published by
    6 # the Free Software Foundation; either version 2, or (at your option)
    7 # any later version.
    8 #
    9 # This program is distributed in the hope that it will be useful,
   10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12 # GNU General Public License for more details.
   13 #
   14 # You should have received a copy of the GNU General Public License
   15 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
   16 
   17 # Check that AM_PATH_PYTHON correctly sets all the output variables
   18 # advertised in the manual.
   19 
   20 required=python
   21 . test-init.sh
   22 
   23 # In case the user's config.site defines pythondir or pyexecdir.
   24 CONFIG_SITE=/dev/null; export CONFIG_SITE
   25 
   26 # Update the definition below if the documentation changes.
   27 # Note that the value of the 'pythondir' and 'pyexecdir' variables can
   28 # vary among different python installations, so we need more relaxed
   29 # and ad-hoc checks for them.  Also, more proper "functional" checks
   30 # on them should be done in the 'python-virtualenv.sh' test.
   31 # 
   32 # This version identification is duplicated in python.m4 (and the manual).
   33 PYTHON_VERSION=$($PYTHON -c 'import sys; print("%u.%u" % sys.version_info[:2])') || exit 1
   34 PYTHON_PLATFORM=$($PYTHON -c 'import sys; print(sys.platform)') || exit 1
   35 PYTHON_EXEC_PREFIX='${exec_prefix}'
   36 PYTHON_PREFIX='${prefix}'
   37 pkgpythondir="\${pythondir}/$me"
   38 pkgpyexecdir="\${pyexecdir}/$me"
   39 
   40 pyvars='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
   41         pkgpythondir pkgpyexecdir'
   42 
   43 cat >> configure.ac << 'END'
   44 AC_CONFIG_FILES([vars-got pythondir pyexecdir])
   45 AM_PATH_PYTHON
   46 AC_OUTPUT
   47 END
   48 
   49 cat > my.py << 'END'
   50 def my():
   51     return 1
   52 END
   53 
   54 cat > Makefile.am << 'END'
   55 
   56 python_PYTHON = my.py
   57 
   58 EXTRA_DIST = vars-exp
   59 
   60 check-local: test-in test-am
   61 .PHONY: test-in test-am
   62 
   63 test-in:
   64     cat pythondir
   65     case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
   66     cat pyexecdir
   67     case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
   68     cat $(srcdir)/vars-exp
   69     cat $(builddir)/vars-got
   70     diff $(srcdir)/vars-exp $(builddir)/vars-got
   71 
   72 ## Note: this target's rules will be extended in the "for" loop below.
   73 test-am:
   74     case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
   75     case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
   76 END
   77 
   78 echo @pythondir@ > pythondir.in
   79 echo @pyexecdir@ > pyexecdir.in
   80 
   81 : > vars-exp
   82 : > vars-got.in
   83 
   84 for var in $pyvars; do
   85   eval val=\$$var
   86   echo "var=$val" >> vars-exp
   87   echo "var=@$var@" >> vars-got.in
   88   echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
   89 done
   90 
   91 cat Makefile.am
   92 cat vars-got.in
   93 
   94 $ACLOCAL
   95 $AUTOMAKE --add-missing
   96 
   97 for var in pythondir pyexecdir $pyvars; do
   98   grep "^$var *=" Makefile.in
   99 done
  100 
  101 $AUTOCONF
  102 ./configure PYTHON="$PYTHON"
  103 
  104 $MAKE test-in test-am
  105 $MAKE distcheck
  106 
  107 :