Code

Opened 4 years ago

Closed 13 months ago

#12846 closed New feature (wontfix)

[PATCH] Support for compiled pyc files

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

Description

I am using django bundled with my app in an RPM file, and that RPM only ships pyc files, not py code. Version 1.0.4 had problems with that, and although I haven't tried later versions, browsing the code in trunk it looks like it is still an issue. I will attach a small patch that fixes it.

Thanks,
David Parker

Attachments (2)

pyc-loader.diff (582 bytes) - added by dap 4 years ago.
bytecode_loader.diff (739 bytes) - added by echos 2 years ago.

Download all attachments as: .zip

Change History (12)

Changed 4 years ago by dap

comment:1 Changed 4 years ago by dap

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Support for compiled pyc files (includes patch) to [PATCH] Support for compiled pyc files

I am using django bundled with my app in an RPM file, and that RPM only ships pyc files, not py code (that is supplied in tarball format). Version 1.0.2 and 1.0.4 had problems with that, and although I haven't tried later versions, browsing the code in trunk it looks like it is still an issue. I will attach a small patch that fixes it.

Thanks,
David Parker

comment:2 Changed 4 years ago by Alex

  • Triage Stage changed from Unreviewed to Design decision needed

What's the point in pyc only distribution? And what exactly is broken?

comment:3 Changed 4 years ago by russellm

  • Patch needs improvement set
  • Triage Stage changed from Design decision needed to Accepted

I've seen this before - the use case is "compiled" python, so you can ship your project without shipping source. Bytecode isn't especially good obfuscation in this regard, but it's enough of a barrier to prevent casual prying eyes.

The failure means that none of the management commands can be found. The Django stack itself works fine - you just can't call syncdb etc.

I'm not especially happy with the proposed patch, though. At the very least, it should be searching for $py.class files too, to catch the Jython case. I presume a similar problem will exist for other interpreters. There is a need here for a generic "check this module exists" utility that we can use throughout Django.

There is an analogous problem in admindocs, which uses file system inspection to work out which modules have documentation.

comment:4 follow-up: Changed 4 years ago by Alex

Ah, in that case I suppose this fails with eggs as well?

comment:5 in reply to: ↑ 4 Changed 4 years ago by ubernostrum

Replying to Alex:

Ah, in that case I suppose this fails with eggs as well?

Indeed. Lots of things will break or not work if you install an app as an egg; about that only thing that will work is templates, but only because we ship a special-case template loader that knows how to look inside eggs.

comment:6 Changed 3 years ago by lukeplant

  • Type set to New feature

comment:7 Changed 3 years ago by lukeplant

  • Severity set to Normal

comment:8 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:9 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

Changed 2 years ago by echos

comment:10 Changed 13 months ago by claudep

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

These sorts of requests have been won't fixed in other tickets (see #14952). Closing.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.