2
0

python10.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #! /bin/sh
  2. # Copyright (C) 2004-2017 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 <http://www.gnu.org/licenses/>.
  16. # Test _PYTHON with conditionals.
  17. required=python
  18. . test-init.sh
  19. cat >>configure.ac <<'EOF'
  20. AM_PATH_PYTHON
  21. AM_CONDITIONAL([ONE], [test "x$one" = x1])
  22. AC_OUTPUT
  23. EOF
  24. cat > Makefile.am <<'END'
  25. if ONE
  26. mydir=$(prefix)/my
  27. my_PYTHON = one.py
  28. else
  29. yourdir=$(prefix)/your
  30. your_PYTHON = two.py
  31. endif
  32. one.py:
  33. echo 'def one(): return 1' >$@
  34. two.py:
  35. echo 'def two(): return 1' >$@
  36. .PHONY: disttest
  37. disttest: distdir
  38. ls -l $(distdir)
  39. test -f $(distdir)/one.py
  40. test -f $(distdir)/two.py
  41. END
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE --add-missing
  45. inst=inst_
  46. mkdir inst_ build_
  47. cd build_
  48. cwd=$(pwd) || fatal_ "getting current working directory"
  49. ../configure --prefix="$cwd/$inst" one=0
  50. $MAKE install
  51. test -f "$inst/your/two.py"
  52. py_installed "$inst/your/two.pyc"
  53. py_installed "$inst/your/two.pyo"
  54. py_installed --not "$inst/my/one.py"
  55. py_installed --not "$inst/my/one.pyc"
  56. py_installed --not "$inst/my/one.pyo"
  57. $MAKE uninstall
  58. py_installed --not "$inst/your/two.py"
  59. py_installed --not "$inst/your/two.pyc"
  60. py_installed --not "$inst/your/two.pyo"
  61. ../configure --prefix=$cwd/"$inst" one=1
  62. $MAKE install
  63. py_installed --not "$inst/your/two.py"
  64. py_installed --not "$inst/your/two.pyc"
  65. py_installed --not "$inst/your/two.pyo"
  66. test -f "$inst/my/one.py"
  67. py_installed "$inst/my/one.pyc"
  68. py_installed "$inst/my/one.pyo"
  69. $MAKE uninstall
  70. py_installed --not "$inst/my/one.py"
  71. py_installed --not "$inst/my/one.pyc"
  72. py_installed --not "$inst/my/one.pyo"
  73. $MAKE disttest
  74. :