--- Begin Message ---
Subject: |
noinst_PYTHON breaks uninstall of Python files |
Date: |
Thu, 22 Sep 2016 11:48:00 +0200 |
Hi Friends!
> $ cat configure.ac
> AC_INIT([foo], [1.0])
> AM_INIT_AUTOMAKE([1.15 foreign])
> AM_PATH_PYTHON
> AC_OUTPUT([Makefile])
> $ cat Makefile.am
> noinst_PYTHON = foo.py
> python_PYTHON = bar.py
> $ autoreconf -fi
> $ grep am__pep3147_tweak Makefile.in
> py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \
> $
Now, if I remove the noinst, am__pep3147_tweak is properly defined.
> $ cat Makefile.am
> python_PYTHON = bar.py
> $ autoreconf -fi
> $ grep am__pep3147_tweak Makefile.in
> am__pep3147_tweak = \
> py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \
> $
At runtime, it results in:
> $ make uninstall-nodist_vcsn_tools_pythonPYTHON
> make: Entering directory `_build/36s'
> /bin/sh: command substitution: line 7: syntax error: unexpected end of file
>
> ( cd '/opt/gostai/lib/python3.5/site-packages/vcsn_tools' && rm -f config.py
> )
> ( cd '/opt/gostai/lib/python3.5/site-packages/vcsn_tools' && rm -f
> config.pyc )
> ( cd '/opt/gostai/lib/python3.5/site-packages/vcsn_tools' && rm -f
> config.pyo )
> ( cd '/opt/gostai/lib/python3.5/site-packages/vcsn_tools' && rm -f c )
> ( cd '/opt/gostai/lib/python3.5/site-packages/vcsn_tools' && rm -f o )
> Compilation finished: /Users/akim/src/lrde/2: build-for-darwin -j3
> uninstall-nodist_vcsn_tools_pythonPYTHON
That’s Automake 1.15. Of course the `c` and `o` are errors, resulting
from the missing definition of am__pep3147_tweak (as is the unexpected
end of file).
Sure, I can use noinst_SCRIPTS etc., but it was handy for me to have
a variable for all my Python build-scripts.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#24507: noinst_PYTHON breaks uninstall of Python files |
Date: |
Wed, 5 Jul 2023 10:00:26 -0600 |
Hi Akim (hope all is well with you) and all,
Back on your report https://bugs.gnu.org/24507 from a mere seven years ago ...
> $ cat Makefile.am
> noinst_PYTHON = foo.py
> python_PYTHON = bar.py
...
> $ make uninstall-nodist_vcsn_tools_pythonPYTHON
> make: Entering directory `_build/36s'
> /bin/sh: command substitution: line 7: syntax error: unexpected end of
file
Bogdan's patch (below) worked for me too, while not breaking any other
existing test, so I installed it.
bd> I don't fully understand the cause,
Me either.
but I guess that the "if %?INSTALL%" block gets ignored when
"noinst" is present,
I guess so. Just based on the names. If there is any real explanation of
those weird %?FOO% and ?FOO? conditionals, I haven't found it.
including the "?FIRST?" it contains, which
defines the missing "am__pep3147_tweak".
Thank you very much for analyzing it and finding the patch.
Closing. --karl
2023-07-01 Bogdan <bogdro_rep@gmx.us>
python: support noinst_PYTHON preceding foo_PYTHON.
This change fixes https://bugs.gnu.org/24507.
* lib/am/python.am (am__pep3147_tweak): remove conditional
on %?INSTALL%.
* t/python-pr10995.sh: test with make uninstall.
diff --git a/lib/am/python.am b/lib/am/python.am
index 98f95af1b..19f268efc 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -94,11 +94,11 @@ endif %?INSTALL%
## Uninstalling. ##
## -------------- ##
-if %?INSTALL%
-
?FIRST?am__pep3147_tweak = \
?FIRST? sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.pyc
__pycache__/&.*.pyo|'
+if %?INSTALL%
+
.PHONY uninstall-am: uninstall-%DIR%PYTHON
uninstall-%DIR%PYTHON:
@$(NORMAL_UNINSTALL)
diff --git a/t/python-pr10995.sh b/t/python-pr10995.sh
index 324be916e..abeb8a124 100644
--- a/t/python-pr10995.sh
+++ b/t/python-pr10995.sh
@@ -17,6 +17,9 @@
# Test automake bug#10995: am__py_compile doesn't get correctly defined
# when there a 'noinst_PYTHON' declaration precedes a 'foo_PYTHON'
# declaration.
+# Test also automake bug#24507: am__pep3147_tweak doesn't get correctly
+# defined when there a 'noinst_PYTHON' declaration precedes a 'foo_PYTHON'
+# declaration and 'make uninstall' fails functionally (just shows errors).
required=python
. test-init.sh
@@ -53,4 +56,7 @@ py_installed --not inst/py/no.pyc
$MAKE disttest
+LC_ALL=C run_make -M uninstall
+grep 'command substitution' output && exit 1
+
:
compile finished at Wed Jul 5 08:59:29 2023
--- End Message ---