classification
Title: pathfix.py does not find Python scripts that have '-' in its filename
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, petr.viktorin, rpluem, vstinner
Priority: normal Keywords: patch

Created on 2019-10-02 09:15 by rpluem, last changed 2020-11-25 14:36 by petr.viktorin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16536 merged rpluem, 2019-10-02 09:42
PR 16718 merged miss-islington, 2019-10-11 13:37
PR 16719 merged vstinner, 2019-10-11 13:49
Messages (9)
msg353728 - (view) Author: Rüdiger Plüm (rpluem) * Date: 2019-10-02 09:15
Tools/scripts/pathfix.py does not find Python scripts that contain a '-' in their filename when working recursively.
This is caused by the regular expression used to detect whether a filename is a Python script:

r'^[a-zA-Z0-9_]+\.py$'

r'^[a-zA-Z0-9_-]+\.py$'

fixes this. I am not sure if you want to allow further characters in script names like spaces or other special characters. The pull request I will create will only fix the '-' issue.
msg354451 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-11 13:36
New changeset 2b7dc40b2af6578181808ba73c1533fc114e55df by Victor Stinner (Ruediger Pluem) in branch 'master':
bpo-38347: find pathfix for Python scripts whose name contain a '-' (GH-16536)
https://github.com/python/cpython/commit/2b7dc40b2af6578181808ba73c1533fc114e55df
msg354454 - (view) Author: miss-islington (miss-islington) Date: 2019-10-11 13:56
New changeset 73665b41470532f873315d5ae39906160192320d by Miss Islington (bot) in branch '3.8':
bpo-38347: find pathfix for Python scripts whose name contain a '-' (GH-16536)
https://github.com/python/cpython/commit/73665b41470532f873315d5ae39906160192320d
msg354461 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-11 15:37
New changeset ed189ce49423f15ba8774ff174c15d03d12bc807 by Victor Stinner in branch '3.7':
bpo-38347: find pathfix for Python scripts whose name contain a '-' (GH-16536) (GH-16719)
https://github.com/python/cpython/commit/ed189ce49423f15ba8774ff174c15d03d12bc807
msg354462 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-11 15:37
Thanks Ruediger Pluem: I merged your change into master and backported to 3.8 and 3.7. For the 3.7 backport, I skipped tests.
msg354486 - (view) Author: Rüdiger Plüm (rpluem) * Date: 2019-10-11 18:59
Welcome Victor Stinner. Any chance to get it also backported to 3.6 as I guess this would increase the chance to see it in RedHat 8 where I hit the issue?
msg354494 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-11 20:56
> Welcome Victor Stinner. Any chance to get it also backported to 3.6 as I guess this would increase the chance to see it in RedHat 8 where I hit the issue?

Python 3.6 doesn't accept bugfixes upstream.

If you are a Red Hat customer, you can contact the support to request a backport. Or you can copy the file from the master branch :-)
msg354865 - (view) Author: Rüdiger Plüm (rpluem) * Date: 2019-10-18 07:35
Thanks for the information. I opened a support request.
msg381834 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2020-11-25 14:36
Note that the pathfix comment says:

# Directories are searched recursively for files whose name looks
# like a python module.

Files with a dash are *not* Python modules, since they can't be imported. Should the comment (which is the only documentation for pathfix, AFAIK) be updated to say it looks for the .py suffix?
History
Date User Action Args
2020-11-25 14:36:12petr.viktorinsetnosy: + petr.viktorin
messages: + msg381834
2019-10-18 07:35:08rpluemsetmessages: + msg354865
2019-10-11 20:56:34vstinnersetmessages: + msg354494
2019-10-11 18:59:01rpluemsetmessages: + msg354486
2019-10-11 15:37:39vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg354462

stage: patch review -> resolved
2019-10-11 15:37:09vstinnersetmessages: + msg354461
2019-10-11 13:56:51miss-islingtonsetnosy: + miss-islington
messages: + msg354454
2019-10-11 13:49:25vstinnersetpull_requests: + pull_request16296
2019-10-11 13:37:53miss-islingtonsetpull_requests: + pull_request16295
2019-10-11 13:36:55vstinnersetmessages: + msg354451
2019-10-02 10:00:39vstinnersetnosy: + vstinner
2019-10-02 09:42:07rpluemsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16125
2019-10-02 09:15:35rpluemcreate