On Apr 23, 2008, at 9:05 AM, Christopher Barker wrote:
Brian Berliner wrote:
So, I'm using Xcode 3.0 with Python and Objective-C/Cocoa files
intermixed.
Right now, I just do the Xcode "Build" process, which creates my
foo.app package.
I have no idea how Xcode builds a combined Python/ObjectiveC app. IN
fact, I didn't know it could do it at all -- is it embedding python?
I'm using the Apple-supplied Python in 10.5 Leopard.
And, at least for now, that is good enough, as it reduces my test
burden.
I like that everything is neatly integrated into Xcode.
I just didn't like that I couldn't tweak the Xcode build to pre-
compile the Python files.
Would py2app be appropriate for me,
It sounds like XCode is building your app for you, if so, you don't
need py2app.
Does the resulting app bundle work as a stand-alone on a stock
Leopard install?
I'd take a look in the resulting app bundle and see what's there. It
may only have *.pyc files anyway, so you're done.
Looks like Xcode 3.0 just copies the .py files directly to the
Resources folder in the bundle.
No processing whatsoever.
I can't find any easy way of changing that behaviour.
Anyone?
Yes, the App Bundle that Xcode generates works fine on a stock Leopard
install (since Python is installed with every Leopard system).
I played around with setting up a build rule in Xcode for *.py files,
but that force-compiled every .py file, and it appears that you cannot
compile the "main.py" file and have things still work.
So, instead, I wrote the following "Run Script Phase" for the Target
in Xcode (which runs as a last-step in the build):
================
#!/bin/sh
if [ "$ACTION" != "build" ]; then
echo "$ACTION Complete"
exit 0
fi
build_dir="${CONFIGURATION_BUILD_DIR}/$
{UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [ "${CONFIGURATION_BUILD_DIR}" != "" -a "$
{UNLOCALIZED_RESOURCES_FOLDER_PATH}" != "" -a -d "$build_dir" ]; then
cd "$build_dir"
for python_file in `find * -name '*.py' -print`; do
if [ "$python_file" != "main.py" ]; then
python -m py_compile "$python_file"
rm -f "$python_file"
fi
done
fi
echo "Build Complete!"
exit 0
================
For some reason, I could not build with "python -O", as Python could
not load my modules if they are *.pyo files. Bummer.
This may be good enough to get me going.
Now, any advice on an obfuscator?
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[EMAIL PROTECTED]
-Brian
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig