New submission from Miro Hrončok <[email protected]>:
We (Fedora's Python SIG) would like to promote usage of
Tools/scripts/pathfix.py (we've even moved it to $PATH) in Fedora RPM build
(a.k.a spec files) instead of various error prone finds + greps + seds.
However when running pathfix.py, it creates backup files (with ~ suffix). This
is mostly unfortunate in RPM build environment, because one needs to clean
those up, otherwise one gets warnings and errors like this:
error: Installed (but unpackaged) file(s) found:
/usr/bin/spam~
Or the file with ~ might even get installed if a more relaxed patter is used in
a %files section that lists what is part of the RPM package.
%{_bindir}/spam-*
We even have shebangs checks/mangling in place and the ~ suffixed file still
has the wrong shebang, resulting in warnings like this:
*** WARNING: mangling shebang in /usr/bin/spam~ from #!/usr/bin/python -Es to
#!/usr/bin/python2 -Es. This will become an ERROR, fix it manually!
Steps to Reproduce:
1. $ echo '#!python' > omg
2. $ Tools/scripts/pathfix.py -i "/usr/bin/python3" -p omg # possibly with
extra flag, see bellow
omg: updating
3. $ ls
Actual results: omg omg~
Expected results: omg
Since the backup feature was here for ages, instead of changing the behavior, I
suggest a flag is added that disables this. 2to3 has exactly the proposed flag
as: "-n, --nobackups Don't write backups for modified files".
This doesn't necessarily need to go into all versions, but I've selected all
that has this problem. Getting it to 3.6+ would be great, however if it goes to
anything later, we'll backport it in the Fedora package.
I have a patch ready, sill send PR.
----------
messages: 312411
nosy: hroncok
priority: normal
severity: normal
status: open
title: Tools/scripts/pathfix.py leaves bunch of ~ suffixed files around with no
opt-out
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32885>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com