[Pythonmac-SIG] py2app: options 'plugin'/'app'
Tobias Rodäbel
tobias.rodaebel at mac.com
Wed Aug 29 13:40:42 CEST 2007
Hi Ronald,
I was wondering why 'plugin' and 'app' are no py2app options? There
is no other setup command needing them, I guess. I patched py2app/
build_app.py, to have 'plugin' and 'app' as real py2app-options. That
gives the opportunity to define them through setup.cfg as well, they
will be listed via --help etc.
This is my patch:
--- build_app.py 2007-08-29 13:32:15.000000000 +0200
+++ my_build_app.py 2007-08-29 13:33:49.000000000 +0200
@@ -12,6 +12,7 @@
import plistlib
import shlex
from cStringIO import StringIO
+from types import ListType, TupleType
from setuptools import Command
from distutils.util import convert_path
@@ -105,6 +106,12 @@
def FixupTargets(targets, default_attribute):
if not targets:
return targets
+ try:
+ targets = eval(targets)
+ except:
+ pass
+ if type(targets) not in (ListType, TupleType):
+ targets = [targets]
ret = []
for target_def in targets:
if isinstance(target_def, basestring):
@@ -145,8 +152,11 @@
# List of option tuples: long name, short name (None if no short
# name), and help string.
-
user_options = [
+ ("app=", None,
+ "???"),
+ ("plugin=", None,
+ "???"),
('optimize=', 'O',
"optimization level: -O1 for \"python -O\", "
"-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
@@ -227,6 +237,8 @@
]
def initialize_options (self):
+ self.app = None
+ self.plugin = None
self.bdist_base = None
self.xref = False
self.graph = False
@@ -820,8 +832,8 @@
dist = self.distribution
# Convert our args into target objects.
- dist.app = FixupTargets(dist.app, "script")
- dist.plugin = FixupTargets(dist.plugin, "script")
+ dist.app = FixupTargets(self.app, "script")
+ dist.plugin = FixupTargets(self.plugin, "script")
if dist.app and dist.plugin:
# XXX - support apps and plugins?
raise DistutilsOptionError(
What do you think about that? I'm pretty new to py2app. So maybe I
missed something.
Regards,
Tobias
More information about the Pythonmac-SIG
mailing list