GNU bug report logs - #24507
noinst_PYTHON breaks uninstall of Python files

Previous Next

Package: automake;

Reported by: Akim Demaille <akim <at> lrde.epita.fr>

Date: Thu, 22 Sep 2016 09:49:01 UTC

Severity: normal

Tags: confirmed

Done: Karl Berry <karl <at> freefriends.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24507 in the body.
You can then email your comments to 24507 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#24507; Package automake. (Thu, 22 Sep 2016 09:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Akim Demaille <akim <at> lrde.epita.fr>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Thu, 22 Sep 2016 09:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Akim Demaille <akim <at> lrde.epita.fr>
To: Automake Bugs <bug-automake <at> gnu.org>
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.





Added tag(s) confirmed. Request was from Mike Frysinger <vapier <at> gentoo.org> to control <at> debbugs.gnu.org. (Sun, 20 Feb 2022 19:56:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#24507; Package automake. (Wed, 22 Mar 2023 16:57:02 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bogdan <bogdro_rep <at> gmx.us>
To: automake-patches <at> gnu.org, 24507 <at> debbugs.gnu.org
Subject: [bug#24507][PATCH] noinst_PYTHON breaks uninstall of Python files
Date: Wed, 22 Mar 2023 17:56:28 +0100
[Message part 1 (text/plain, inline)]
Hi, Automakers.

 The attached patch fixes bug#24507.

 I don't fully understand the cause, but I guess that the "if 
%?INSTALL%" block gets ignored when "noinst" is present, including the 
"?FIRST?" it contains, which defines the missing "am__pep3147_tweak".

 Anyway, moving the "?FIRST?" block with the declaration of 
"am__pep3147_tweak" outside the "if %?INSTALL%" block fixes the issue. 
All tests with "py" in the name pass.

 This isn't the first time either. The test I've updated was for a 
similar case - bug#10995 ("am__py_compile doesn't get correctly 
defined when there a 'noinst_PYTHON' declaration precedes a 
'foo_PYTHON' declaration"), that's probably why "am__py_compile" is in 
its own "?FIRST?" block at the top now.

 No other language XX.am files seem to have "?FIRST?" inside an "if" 
block.

-- 
Regards - Bogdan ('bogdro') D.                 (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux):    http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft  http://bogdro.evai.pl/soft4asm
www.Xiph.org  www.TorProject.org  www.LibreOffice.org  www.GnuPG.org
[automake-fix-py-uninst-mail.diff (text/x-patch, attachment)]

Information forwarded to bug-automake <at> gnu.org:
bug#24507; Package automake. (Wed, 22 Mar 2023 16:57:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#24507; Package automake. (Wed, 05 Jul 2023 16:01:02 GMT) Full text and rfc822 format available.

Message #16 received at 24507 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: akim.demaille <at> gmail.com, bogdro_rep <at> gmx.us
Cc: 24507 <at> debbugs.gnu.org
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 <at> 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




Reply sent to Karl Berry <karl <at> freefriends.org>:
You have taken responsibility. (Wed, 05 Jul 2023 16:01:02 GMT) Full text and rfc822 format available.

Notification sent to Akim Demaille <akim <at> lrde.epita.fr>:
bug acknowledged by developer. (Wed, 05 Jul 2023 16:01:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Aug 2023 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.