Thanks a lot. Then I almost had it right, but I had dabo/locale instead of dabo.locale as the directory structure.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul McNett Sent: 22. august 2007 17:58 To: Dabo Users list Subject: Re: [dabo-users] Localization and py2exe Simen Haugen wrote: > I really don't get it.. > I tried to add it to the data_files section, but all that does is copy > the files. > > How should the files be added? With other_resources as something like > this..? > > other_resources = [ > ("dabo/locale/dabo.pot", 1, <read dabo.pot here>), > ("dabo/locale/en/LC_MESSAGES/dabo.mo", 1, <read dabo.mo here>), > ] I've been meaning to add the needed locale bits to the AppWizard-generated setup.py. In the meantime, here's what I'm doing for my app (do a search for 'locale' and you'll see what you need to do): #!/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 glob from distutils.core import setup import py2exe import dabo.icons from App import App daboDir = os.path.split(dabo.__file__)[0] # Find the location of the dabo icons: iconDir = os.path.split(dabo.icons.__file__)[0] iconSubDirs = [] def getIconSubDir(arg, dirname, fnames): if ".svn" not in dirname and "cards" not in dirname.lower() and dirname[-1] != "\\": icons = glob.glob(os.path.join(dirname, "*.png")) if icons: subdir = (os.path.join("resources", dirname[len(arg)+1:]), icons) iconSubDirs.append(subdir) os.path.walk(iconDir, getIconSubDir, iconDir) # locales: localeDir = "%s%slocale" % (daboDir, os.sep) #locales = [("dabo.locale", (os.path.join(daboDir, "locale", "dabo.pot"),))] locales = [] def getLocales(arg, dirname, fnames): if ".svn" not in dirname and dirname[-1] != "\\": #po_files = tuple(glob.glob(os.path.join(dirname, "*.po"))) mo_files = tuple(glob.glob(os.path.join(dirname, "*.mo"))) if mo_files: subdir = os.path.join("dabo.locale", dirname[len(arg)+1:]) locales.append((subdir, mo_files)) os.path.walk(localeDir, getLocales, localeDir) # The applications App object contains all the meta info: app = App(MainFormClass=None) _appName = app.getAppInfo("appName") _appShortName = app.getAppInfo("appShortName") _appFileStem = _appShortName.lower().replace(" ", "_") _appVersion = app.getAppInfo("appVersion") _appDescription = app.getAppInfo("appDescription") _copyright = app.getAppInfo("copyright") _authorName = app.getAppInfo("authorName") _authorEmail = app.getAppInfo("authorEmail") _authorURL = app.getAppInfo("authorURL") _authorPhone = app.getAppInfo("authorPhone") _appComments = ("This is custom software by %s.\r\n" "\r\n" "%s\r\n" "%s\r\n" "%s\r\n") % (_authorName, _authorEmail, _authorURL, _authorPhone) _appIcon = "./resources/icon_green.ico" _script = "shutter_studio.py" manifest = open("shutter_studio.exe.manifest").read() class Target: def __init__(self, **kw): self.__dict__.update(kw) # for the versioninfo resources self.version = _appVersion self.company_name = _authorName self.copyright = _copyright self.name = _appName self.description = _appDescription self.comments = _appComments self.script=_script self.other_resources = [(24, 1, manifest)] if _appIcon is not None: self.icon_resources = [(1, _appIcon)] data_files=[("db/sqlite", glob.glob("db/sqlite/*.sql")), ("resources", glob.glob(os.path.join(iconDir, "*.ico"))), ("resources", glob.glob("resources/*")), ("reports", glob.glob("reports/*"))] data_files.extend(iconSubDirs) data_files.extend(locales) setup(name=_appName, version=_appVersion, description=_appDescription, author=_authorName, author_email=_authorEmail, url=_authorURL, options={"py2exe": {"packages": ["encodings", "wx", "ui", "biz", "db"], "optimize": 2, #"compressed": 1, "excludes": ["matplotlib", "Tkconstants","Tkinter","tcl", "_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTk", "FixTk",], 'typelibs' : [('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)],}}, zipfile=None, windows=[Target()], data_files=data_files ) # Write out the setup.iss file for inno: iss = open("setup.iss.txt").read() % locals() open("setup.iss", "wb").write(iss) -- pkm ~ http://paulmcnett.com [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
