Skip to content

extend compileall to compile single files #52387

Closed

Description

@doko42
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']

    Activity

    1. doko42 commented on Mar 14, 2010

      @doko42
      MemberAuthor

      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?

    2. added
      stdlib
      on Mar 14, 2010
    3. added
      type-feature
      on Mar 14, 2010
    4. warsaw commented on Mar 15, 2010

      @warsaw
      Member

      +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. ;)

    5. doko42 commented on Mar 15, 2010

      @doko42
      MemberAuthor

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

    6. warsaw commented on Mar 15, 2010

      @warsaw
      Member

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

    7. doko42 commented on Mar 16, 2010

      @doko42
      MemberAuthor

      fixed for 2.7 and 3.2

    8. merwok commented on Dec 16, 2010

      @merwok
      Member

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

    9. merwok commented on Dec 16, 2010

      @merwok
      Member

      I also added the missing function description.

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibtype-feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions