dabo Commit
Revision 4764
Date: 2008-12-03 14:44:22 -0800 (Wed, 03 Dec 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4764
Changed:
U trunk/ide/wizards/AppWizard/spec-setup.py.txt
Log:
Added some things to the AppWizard's setup.py, to match closely what I've done
with my app. Notably, on Mac you can 'python setup.py py2app' to make an
application bundle.
Diff:
Modified: trunk/ide/wizards/AppWizard/spec-setup.py.txt
===================================================================
--- trunk/ide/wizards/AppWizard/spec-setup.py.txt 2008-12-03 22:37:47 UTC
(rev 4763)
+++ trunk/ide/wizards/AppWizard/spec-setup.py.txt 2008-12-03 22:44:22 UTC
(rev 4764)
@@ -1,11 +1,32 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+import sys
+
+# ModuleFinder can't handle runtime changes to __path__, but win32com uses them
+try:
+ import py2exe.mf as modulefinder
+ import win32com
+ for p in win32com.__path__[1:]:
+ modulefinder.AddPackagePath("win32com", p)
+ for extra in ["win32com.shell"]: #,"win32com.mapi"
+ __import__(extra)
+ m = sys.modules[extra]
+ for p in m.__path__[1:]:
+ modulefinder.AddPackagePath(extra, p)
+except ImportError:
+ # no build path setup, no worries.
+ pass
+
import os
-import sys
import glob
-from distutils.core import setup
-import py2exe
+if sys.platform.startswith("win"):
+ from distutils.core import setup
+ import py2exe
+else:
+ from setuptools import setup
+ if sys.platform.startswith("darwin"):
+ import py2app
import dabo.icons
from App import App
@@ -39,9 +60,9 @@
# The applications App object contains all the meta info:
app = App(MainFormClass=None)
-app.setup()
_appName = app.getAppInfo("appName")
+_appShortName = app.getAppInfo("appShortName")
_appVersion = app.getAppInfo("appVersion")
_appDescription = app.getAppInfo("appDescription")
_copyright = app.getAppInfo("copyright")
@@ -62,8 +83,8 @@
#_appIcon = "./resources/stock_addressbook.ico"
_script = "%(appName)s.py"
+manifest = open("%(appName)s.exe.manifest").read()
-
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
@@ -76,49 +97,66 @@
self.comments = _appComments
self.script=_script
- self.other_resources=[]
+ self.other_resources=[(24, 1, manifest)]
if _appIcon is not None:
self.icon_resources=[(1, _appIcon)]
-data_files=[(".", ("%(appName)s.exe.manifest",)),
- ("db", ["db/default.cnxml"]),
+data_files=[("db", ["db/default.cnxml"]),
("resources", glob.glob(os.path.join(iconDir, "*.ico"))),
("resources", glob.glob("resources/*")),
("reports", glob.glob("reports/*"))]
data_files.extend(iconSubDirs)
data_files.extend(locales)
-if sys.platform == "win32":
- import py2exe
+if sys.platform.startswith("win"):
+ options = {"py2exe":
+ {"packages": ["encodings", "wx", "ui", "biz", "db"],
+ #"optimize": 1, #compressed: 1,
+ "excludes": ["Tkconstants", "Tkinter", "tcl",
+ "_imagingtk", "PIL._imagingtk",
+ "ImageTk", "PIL.ImageTk",
"FixTk"],
+ "typelibs" :
[('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)]
+ }}
+
setup(name=_appName,
version=_appVersion,
description=_appDescription,
author=_authorName,
author_email=_authorEmail,
url=_authorURL,
- options={"py2exe": {"packages": ["wx.gizmos",
"wx.lib.calendar"],
- "optimize": 2,
- "excludes":
["Tkconstants","Tkinter","tcl",
- "_imagingtk", "PIL._imagingtk",
- "ImageTk", "PIL.ImageTk", "FixTk"]}},
- packages=["ui", "biz", "db"],
+ options=options,
zipfile=None,
windows=[Target()],
data_files=data_files
)
-elif sys.platform == "darwin":
- import py2app
- setup(options={"py2app": {iconfile: _appIcon, packages: ['wx',
'wx.gizmos', 'wx.lib.calendar'],
- site_packages: True, resources: [],
- plist: dict(
- CFBundleName =
"MyAppName",
- CFBundleShortVersionString = "0.2.5",
# must be in X.X.X format
- CFBundleGetInfoString = "MyAppName
0.2.5",
- CFBundleExecutable =
"MyAppName",
- CFBundleIdentifier =
"com.example.myappname",
- ),
- },
- app: [_script]}
+elif sys.platform.startswith("darwin"):
+ options = {"py2app":
+ {"includes": ["App", "__version__", "constants",
"db.updates", "ui", "biz", "encodings",
+ "wx", "wx.lib.calendar", "wx.gizmos"],
+ "optimize": 2,
+ "excludes": ["matplotlib",
"Tkconstants","Tkinter","tcl",
+ "_imagingtk", "PIL._imagingtk",
+ "ImageTk", "PIL.ImageTk", "FixTk", "wxPython",],
+ "argv_emulation": True,
+ "resources": data_files,
+ "plist": dict(CFBundleGetInfoString=_appVersion,
+ CFBundleIdentifier="com.example.%(appName)s",
+ LSPrefersPPC=False,
+ NSHumanReadableCopyright=_copyright),
+ #"iconfile": "resources/logo_green.icns",
+ }}
+
+ setup(name="%(appName)s",
+ app=[_script],
+ version=_appVersion,
+ description=_appDescription,
+ author=_authorName,
+ author_email=_authorEmail,
+ url=_authorURL,
+ options=options,
+ #data_files=data_files,
+ setup_requires=["py2app"]
)
+
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]