Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11621 closed (fixed)

Django copies .pyo files for a new project/app

Reported by: Steve Milner Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords: jython
Cc: ivazqueznet@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Ignacio Vazquez-Abrams noted that if pyo files are present Django copys them into projects/apps. Currently, core.management.base stops pyc's from being copied but does not stop pyo's. Ignacio proposed adding the same block on pyo's (see patch attached).

RH Bugzilla Bug

Attachments (2)

Django-ignore-pyo-bz-495046.patch (593 bytes) - added by Steve Milner 7 years ago.
Does not copy over pyo's
Django-ignore-pyo-and-jython-classfile.diff (574 bytes) - added by Frank Wierzbicki 7 years ago.
Turn Steve Milner's second idea into a patch, as it helps Jython too

Download all attachments as: .zip

Change History (13)

Changed 7 years ago by Steve Milner

Does not copy over pyo's

comment:1 Changed 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Steve Milner

What if we switched this on it's ear and instead and did:

    if !f.endswith('.py'):

that way other implementations (such as jython) which may create files with different bytecode suffixes don't get items copied as well. Just a thought.

comment:3 Changed 7 years ago by Steve Milner

Oops ...

    if not f.endswith('.py'):

comment:4 Changed 7 years ago by crankycoder@…

This bug actually causes breakage in Django 1.0.x on Jython. The startproject and startapp commands incorrectly use the '.pyc' filter and end up *rewriting* the Jython generated class files.

Can we get this applied to the 1.0.x branch quickly?

Changed 7 years ago by Frank Wierzbicki

Turn Steve Milner's second idea into a patch, as it helps Jython too

comment:5 Changed 7 years ago by Frank Wierzbicki

A third possibility (If there are files other than .py that need processing) is to just add an "or f.endswith("$py.class") to the list for Jython. I'll put that patch together if it will speed things along...

comment:6 Changed 7 years ago by Leo Soto M.

Keywords: jython added

comment:7 Changed 7 years ago by Brandon Taylor

I'm seeing the same thing for 1.0.3 on Jython 2.5.0. After creating a new project, I'm unable to runserver until I delete the initial .class files

comment:8 Changed 7 years ago by Luke Plant

Resolution: fixed
Status: newclosed

Fixed in r11483.

(is the post-commit hook that should write this message broken?)

Because 1.1 is released, 1.0.X will now only receive security bug fixes, so this won't be backported (unless policy changes).

comment:9 in reply to:  8 Changed 7 years ago by Leo Soto M.

Replying to lukeplant:

Fixed in r11483.

(is the post-commit hook that should write this message broken?)

Because 1.1 is released, 1.0.X will now only receive security bug fixes, so this won't be backported (unless policy changes).

That's a shame. I understand that Django is run by volunteers and you can't afford to make all the releases we want. The problem here is that Django 1.1 hasn't been tested with Jython as extensively as 1.0, so we Jython users are a bit in the dark now :(

comment:10 Changed 7 years ago by Luke Plant

Replying to leosoto:

That's a shame. I understand that Django is run by volunteers and you can't afford to make all the releases we want. The problem here is that Django 1.1 hasn't been tested with Jython as extensively as 1.0, so we Jython users are a bit in the dark now :(

Changing the policy regarding backporting would make more work for our release manager, so I'm loathe to suggest that.

Perhaps someone from the community could set up a git/hg mirror that is "1.0.X plus Jython fixes"? With mercurial at least, it is pretty easy to do - just clone http://bitbucket.org/mirror/django-10x/, create a 'jython_fixes' branch (or something like that) which has hand-selected backports (like changeset r11483) added to it. Provided the fixes for Jython are small, merging from django-1.0.X will be very easy.

comment:11 Changed 7 years ago by Steve Milner

For the moment we are applying the original patch to all Fedora built Django packages using the rpm patch directive. On next update we will test and apply the updated patch by Frank.

Note: See TracTickets for help on using tickets.
Back to Top