Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: option to keep/add flags to pathfix. #81245

Closed
PatrikKopkan mannequin opened this issue May 27, 2019 · 10 comments
Closed

Feature request: option to keep/add flags to pathfix. #81245

PatrikKopkan mannequin opened this issue May 27, 2019 · 10 comments
Labels
3.8 only security fixes 3.9 only security fixes type-feature A feature request or enhancement

Comments

@PatrikKopkan
Copy link
Mannequin

PatrikKopkan mannequin commented May 27, 2019

BPO 37064
Nosy @vstinner, @hroncok, @PatrikKopkan
PRs
  • bpo-37064: adds option to keep/add flags to pathfix. #13591
  • bpo-37064: add option -k to Tools/scripts/pathfix.py #15548
  • bpo-37064: Skip test_tools.test_pathfix if installed #15705
  • bpo-37064: add option -a to Tools/Scripts/pathfix.py #15717
  • [3.8] bpo-37064: Add -k and -a options to pathfix.py tool #16387
  • [3.8] bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705) #16389
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-09-25.13:23:39.909>
    created_at = <Date 2019-05-27.13:09:47.853>
    labels = ['type-feature', '3.8', '3.9']
    title = 'Feature request: option to keep/add flags to pathfix.'
    updated_at = <Date 2019-09-25.14:12:35.454>
    user = 'https://github.com/PatrikKopkan'

    bugs.python.org fields:

    activity = <Date 2019-09-25.14:12:35.454>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-09-25.13:23:39.909>
    closer = 'vstinner'
    components = ['Demos and Tools']
    creation = <Date 2019-05-27.13:09:47.853>
    creator = 'pkopkan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37064
    keywords = ['patch']
    message_count = 10.0
    messages = ['343622', '343628', '351202', '351206', '351212', '353186', '353190', '353193', '353194', '353201']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'hroncok', 'pkopkan']
    pr_nums = ['13591', '15548', '15705', '15717', '16387', '16389']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue37064'
    versions = ['Python 3.8', 'Python 3.9']

    @PatrikKopkan
    Copy link
    Mannequin Author

    PatrikKopkan mannequin commented May 27, 2019

    Hello,
    Pathfix is nice simple tool for changing shebang lines. However, it is lacking a way how to keep/add flags making this tool impractical sometimes.

    @hroncok hroncok mannequin added 3.8 only security fixes 3.9 only security fixes labels May 27, 2019
    @SilentGhost SilentGhost mannequin added the type-feature A feature request or enhancement label May 27, 2019
    @PatrikKopkan
    Copy link
    Mannequin Author

    PatrikKopkan mannequin commented May 27, 2019

    Example:
    pathfix.py -i /usr/bin/python ./directory --> would change the shebang of
    every script in this directory recursively to #! /usr/bin/python. That's handy but if you would have script like this: #! /usr/bin/env -flags and
    wanted to keep the flags.
    You would need to run again pathfix: pathfix.py -i '/usr/bin/python -flags' ./directory. That is not that bad for one script but with increasing number of scripts, differences of flags between the scripts it gets harder.

    @vstinner
    Copy link
    Member

    vstinner commented Sep 5, 2019

    New changeset 50254ac by Victor Stinner (PatrikKopkan) in branch 'master':
    bpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548)
    50254ac

    @vstinner
    Copy link
    Member

    vstinner commented Sep 5, 2019

    The newly added test fails if Python is installed:

    https://buildbot.python.org/all/#/builders/188/builds/927

    ======================================================================
    FAIL: test_pathfix (test.test_tools.test_pathfix.TestPathfixFunctional)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py", line 36, in test_pathfix
        self.pathfix(
      File "/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py", line 24, in pathfix
        self.assertEqual(proc.returncode, 0, proc)
    AssertionError: 2 != 0 : CompletedProcess(args=['/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9', '/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py', '-i', '/usr/bin/python3', '-n', '@test_1589863_tmp'], returncode=2, stdout=b'', stderr=b"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9: can't open file '/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py': [Errno 2] No such file or directory\n")

    ======================================================================
    FAIL: test_pathfix_keeping_flags (test.test_tools.test_pathfix.TestPathfixFunctional)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py", line 50, in test_pathfix_keeping_flags
        self.pathfix(
      File "/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/python3.9/test/test_tools/test_pathfix.py", line 24, in pathfix
        self.assertEqual(proc.returncode, 0, proc)
    AssertionError: 2 != 0 : CompletedProcess(args=['/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9', '/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py', '-i', '/usr/bin/python3', '-k', '-n', '@test_1589863_tmp'], returncode=2, stdout=b'', stderr=b"/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/bin/python3.9: can't open file '/home/buildbot/buildarea/3.x.cstratak-fedora.installed/build/target/lib/Tools/scripts/pathfix.py': [Errno 2] No such file or directory\n")

    @vstinner
    Copy link
    Member

    vstinner commented Sep 5, 2019

    New changeset 3f43cef by Victor Stinner in branch 'master':
    bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705)
    3f43cef

    @vstinner
    Copy link
    Member

    New changeset 1dc1acb by Victor Stinner (PatrikKopkan) in branch 'master':
    bpo-37064: Add option -a to pathfix.py tool (GH-15717)
    1dc1acb

    @vstinner
    Copy link
    Member

    I wrote PR 16387 to backport pathfix changes from Python 3.8. The changes add tests which make me confident that it's safe to backport the changes. Currently, pathfix has no test at all in Python 3.8.

    @vstinner
    Copy link
    Member

    New changeset c71c54c by Victor Stinner in branch '3.8':
    bpo-37064: Add -k and -a options to pathfix.py tool (GH-16387)
    c71c54c

    @vstinner
    Copy link
    Member

    Thanks Patrik Kopkan for your contributions! It's now part of 3.8 and master branches. Your work will be part of the incoming Python 3.8.0 final release.

    @vstinner
    Copy link
    Member

    New changeset 2e566bf by Victor Stinner in branch '3.8':
    bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705) (GH-16389)
    2e566bf

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant