Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11621 closed (fixed)

Django copies .pyo files for a new project/app

Reported by: stevemilner 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 stevemilner 6 years ago.
Does not copy over pyo's
Django-ignore-pyo-and-jython-classfile.diff (574 bytes) - added by fwierzbicki 6 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 6 years ago by stevemilner

Does not copy over pyo's

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by stevemilner

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 6 years ago by stevemilner

Oops ...

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

comment:4 Changed 6 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 6 years ago by fwierzbicki

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

comment:5 Changed 6 years ago by fwierzbicki

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 6 years ago by leosoto

  • Keywords jython added

comment:7 Changed 6 years ago by btaylordesign

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 follow-up: Changed 6 years ago by lukeplant

  • Resolution set to fixed
  • Status changed from new to closed

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 6 years ago by leosoto

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 6 years ago by lukeplant

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 6 years ago by stevemilner

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