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

extend compileall to compile single files #52387

Closed
doko42 opened this issue Mar 14, 2010 · 7 comments
Closed

extend compileall to compile single files #52387

doko42 opened this issue Mar 14, 2010 · 7 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@doko42
Copy link
Member

doko42 commented Mar 14, 2010

BPO 8140
Nosy @warsaw, @doko42, @merwok, @davidmalcolm
Files
  • compileall.py.diff: proposed patch
  • compileall.py.diff
  • 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 = 'https://github.com/doko42'
    closed_at = <Date 2010-03-16.01:27:28.931>
    created_at = <Date 2010-03-14.19:41:31.667>
    labels = ['type-feature', 'library']
    title = 'extend compileall to compile single files'
    updated_at = <Date 2010-12-16.06:15:41.132>
    user = 'https://github.com/doko42'

    bugs.python.org fields:

    activity = <Date 2010-12-16.06:15:41.132>
    actor = 'eric.araujo'
    assignee = 'doko'
    closed = True
    closed_date = <Date 2010-03-16.01:27:28.931>
    closer = 'doko'
    components = ['Library (Lib)']
    creation = <Date 2010-03-14.19:41:31.667>
    creator = 'doko'
    dependencies = []
    files = ['16548', '16556']
    hgrepos = []
    issue_num = 8140
    keywords = ['patch']
    message_count = 7.0
    messages = ['101064', '101117', '101122', '101129', '101145', '124104', '124107']
    nosy_count = 4.0
    nosy_names = ['barry', 'doko', 'eric.araujo', 'dmalcolm']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue8140'
    versions = ['Python 2.7', 'Python 3.2']

    @doko42
    Copy link
    Member Author

    doko42 commented Mar 14, 2010

    when byte-compiling files in a deb/rpm package distributed e.g. in a Linux distribution, it is sometimes wanted to only touch the files found in the deb/rpm, which can be a subset of the files in a directory. the attached patch now lets compileall accept files as arguments as well and adds the recognition of @<filelist> and @- to expand the arguments with the contents of the file (@- meaning to read for stdin). Is this ok for 2.7, and a port of that to 3.2?

    @doko42 doko42 added the stdlib Python modules in the Lib dir label Mar 14, 2010
    @ezio-melotti ezio-melotti added the type-feature A feature request or enhancement label Mar 14, 2010
    @warsaw
    Copy link
    Member

    warsaw commented Mar 15, 2010

    +1 on this functionality being added for 2.7 and 3.2. You also mentioned in pvt email that it would be better to patch compileall.py than py_compile.py to take advantage of the quiet and force options (which seems good to me).

    I have a few comments on the diff:

    • It no longer applies cleanly to trunk. There was a recent commit that removed an unnecessary catch of KeyboardInterrupt, and I think that's what's causing the hunk reject.

    • I don't like @filename and @- as the syntax for reading the compilation list from a file. Since -f is already taken, what about adding -i<file> which tells it where to take the list from? Of course '-i -' would mean stdin.

    • Please add tests for the new functionality to test_compileall.py

    Bonus points for updating this to modern Python <wink>. E.g. using True/False instead of 1/0, and 'OSError as error' instead of 'os.error, e'. But don't worry about that too much; I'll probably take that on as part of my PEP-3147 work. ;)

    @doko42
    Copy link
    Member Author

    doko42 commented Mar 15, 2010

    changed the @ syntax to an option -i, and added a test for compile_file/compile_dir.

    @warsaw
    Copy link
    Member

    warsaw commented Mar 15, 2010

    Looks good to me, and should help distros, so +1.

    @doko42
    Copy link
    Member Author

    doko42 commented Mar 16, 2010

    fixed for 2.7 and 3.2

    @doko42 doko42 closed this as completed Mar 16, 2010
    @merwok
    Copy link
    Member

    merwok commented Dec 16, 2010

    I have added versionadded directives that were missing in the doc.

    @merwok
    Copy link
    Member

    merwok commented Dec 16, 2010

    I also added the missing function description.

    @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
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants