[ python-Feature Requests-900502 ] bundlebuilder: some way to add
non-py files in packages
SourceForge.net
noreply at sourceforge.net
Thu Feb 26 12:36:29 EST 2004
Feature Requests item #900502, was opened at 2004-02-19 13:30
Message generated for change (Comment added) made by etrepum
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=900502&group_id=5470
Category: Macintosh
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Russell Owen (reowen)
Assigned to: Nobody/Anonymous (nobody)
Summary: bundlebuilder: some way to add non-py files in packages
Initial Comment:
I would like some way to load non-python code that is
contained in packages. In other words, suppose I have:
maindir/
helpdir/
__init__.py
index.html
...other python code and help files
I'd like some way to specify that the code in helpdir be
loaded as code (compiled and the source discarded) but that
the other files also be copied over. Presently includePackages
only copies over python files.
The best workaround I've found so far is to specify the
package in two separate arguments to buildapp:
includePackages and resources. That copies everything
(including the python source) and also compiles everything,
so one ends up with both .py and .pyc files. I then look in
that folder and discard the python source after
bundlebuilder is finished. (I suppose that step is optional.)
Simply modifying includePackages so it included non-python
files is my first thought. It might occasionally include stuff
that wasn't wanted, but aside from on occasional README
or something, I doubt it would amount to anything
significant in most cases.
----------------------------------------------------------------------
Comment By: Bob Ippolito (etrepum)
Date: 2004-02-26 12:36
Message:
Logged In: YES
user_id=139309
Yes, there is plenty of existing code that uses this idiom.. but it's awfully
hard for bundlebuilder to detect it automatically. The real solution (that
doesn't require grotesque intelligence in bundlebuilder) is to propose a
new extensible idiom for loading resources, which is currently being
discussed on pythonmac-sig and pygame-users under the subject "python
+ pygame of OSX".
----------------------------------------------------------------------
Comment By: Russell Owen (reowen)
Date: 2004-02-26 12:28
Message:
Logged In: YES
user_id=431773
Because putting resource files in sub-packages makes them very easy to find. For example:
TUI/
__init__.py
Help/
__init__.py
index.html, etc.
(TUI is on the python path)
import os, TUI.Help
helpdir = os.path.dirname(TUI.Help.__file__)
This is all the more useful when one's main .py file gets moved by bundlebuilder from within (in my case) TUI up one level.
Also, many folks may be trying to convert existing code (I was) that uses this trick. It seems a shame to have to rewrite it. Of course one need not actually rewrite it, but a bundlebuilder script becomes quite messy for such code without this requested feature.
----------------------------------------------------------------------
Comment By: Bob Ippolito (etrepum)
Date: 2004-02-25 21:37
Message:
Logged In: YES
user_id=139309
why not keep your code and data in separate folders?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=900502&group_id=5470
More information about the Python-bugs-list
mailing list