Install the .mo files under the wxPython package directory for MSW
since there is no standard place for them like on other platforms. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19462 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -19,6 +19,7 @@ from wxPython.html import wxHtmlWindow
|
|||||||
|
|
||||||
import images
|
import images
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@@ -702,6 +703,11 @@ class MyApp(wxApp):
|
|||||||
Create and show the splash screen. It will then create and show
|
Create and show the splash screen. It will then create and show
|
||||||
the main frame when it is time to do so.
|
the main frame when it is time to do so.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#import locale
|
||||||
|
#self.locale = wxLocale(wxLANGUAGE_FRENCH)
|
||||||
|
#locale.setlocale(locale.LC_ALL, 'fr')
|
||||||
|
|
||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
splash = MySplashScreen()
|
splash = MySplashScreen()
|
||||||
splash.Show()
|
splash.Show()
|
||||||
|
@@ -98,6 +98,8 @@ Source: "wxPython\lib\PyCrust\*.txt"; DestDir: "{app}\wxPython\lib\PyCrust
|
|||||||
Source: "wxPython\lib\PyCrust\*.ico"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
|
Source: "wxPython\lib\PyCrust\*.ico"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
|
||||||
Source: "wxPython\lib\colourchooser\*.py"; DestDir: "{app}\wxPython\lib\colourchooser"; Components: core
|
Source: "wxPython\lib\colourchooser\*.py"; DestDir: "{app}\wxPython\lib\colourchooser"; Components: core
|
||||||
|
|
||||||
|
%(LOCALE)s
|
||||||
|
|
||||||
Source: "demo\*.py"; DestDir: "{app}\wxPython\demo"; Components: demo
|
Source: "demo\*.py"; DestDir: "{app}\wxPython\demo"; Components: demo
|
||||||
Source: "demo\*.xml"; DestDir: "{app}\wxPython\demo"; Components: demo
|
Source: "demo\*.xml"; DestDir: "{app}\wxPython\demo"; Components: demo
|
||||||
Source: "demo\*.txt"; DestDir: "{app}\wxPython\demo"; Components: demo
|
Source: "demo\*.txt"; DestDir: "{app}\wxPython\demo"; Components: demo
|
||||||
@@ -348,6 +350,22 @@ def find_DLLs():
|
|||||||
return WXDLL, PYTHONVER
|
return WXDLL, PYTHONVER
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def build_locale_string():
|
||||||
|
template = 'Source: "%s"; DestDir: "{app}\%s"; Components: core'
|
||||||
|
stringlst = []
|
||||||
|
|
||||||
|
def walk_helper(lst, dirname, files):
|
||||||
|
for f in files:
|
||||||
|
filename = os.path.join(dirname, f)
|
||||||
|
if not os.path.isdir(filename):
|
||||||
|
lst.append( template % (filename, dirname) )
|
||||||
|
|
||||||
|
os.path.walk('wxPython\\locale', walk_helper, stringlst)
|
||||||
|
return '\n'.join(stringlst)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -366,6 +384,7 @@ def main():
|
|||||||
SYSDIR = r"C:\WINNT\SYSTEM32"
|
SYSDIR = r"C:\WINNT\SYSTEM32"
|
||||||
ISSFILE = "__wxPython.iss"
|
ISSFILE = "__wxPython.iss"
|
||||||
IFSFILE = "__wxPython.ifs"
|
IFSFILE = "__wxPython.ifs"
|
||||||
|
LOCALE = build_locale_string()
|
||||||
|
|
||||||
if PYTHONVER >= "2.2":
|
if PYTHONVER >= "2.2":
|
||||||
IF22 = r"InstallDir := InstallDir + '\Lib\site-packages';"
|
IF22 = r"InstallDir := InstallDir + '\Lib\site-packages';"
|
||||||
|
@@ -6,6 +6,8 @@ from distutils.core import setup, Extension
|
|||||||
from distutils.file_util import copy_file
|
from distutils.file_util import copy_file
|
||||||
from distutils.dir_util import mkpath
|
from distutils.dir_util import mkpath
|
||||||
from distutils.dep_util import newer
|
from distutils.dep_util import newer
|
||||||
|
from distutils.spawn import spawn
|
||||||
|
from distutils.command.install_data import install_data
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# flags and values that affect this script
|
# flags and values that affect this script
|
||||||
@@ -21,7 +23,7 @@ LONG_DESCRIPTION = """\
|
|||||||
wxPython is a GUI toolkit for Python that is a wrapper around the
|
wxPython is a GUI toolkit for Python that is a wrapper around the
|
||||||
wxWindows C++ GUI library. wxPython provides a large variety of
|
wxWindows C++ GUI library. wxPython provides a large variety of
|
||||||
window types and controls, all implemented with a native look and
|
window types and controls, all implemented with a native look and
|
||||||
feel (and native runtime speed) on the platforms it is supported
|
feel (by using the native widgets) on the platforms it is supported
|
||||||
on.
|
on.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -135,6 +137,7 @@ def libFlag():
|
|||||||
|
|
||||||
PKGDIR = 'wxPython'
|
PKGDIR = 'wxPython'
|
||||||
wxpExtensions = []
|
wxpExtensions = []
|
||||||
|
DATA_FILES = []
|
||||||
|
|
||||||
force = '--force' in sys.argv or '-f' in sys.argv
|
force = '--force' in sys.argv or '-f' in sys.argv
|
||||||
debug = '--debug' in sys.argv or '-g' in sys.argv
|
debug = '--debug' in sys.argv or '-g' in sys.argv
|
||||||
@@ -215,12 +218,9 @@ def Verify_WX_CONFIG():
|
|||||||
WX_CONFIG = 'wx-config'
|
WX_CONFIG = 'wx-config'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]):
|
def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]):
|
||||||
"""Run SWIG the way I want it done"""
|
"""Run SWIG the way I want it done"""
|
||||||
from distutils.file_util import copy_file
|
|
||||||
from distutils.dep_util import newer
|
|
||||||
from distutils.spawn import spawn
|
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(dir, gendir)):
|
if not os.path.exists(os.path.join(dir, gendir)):
|
||||||
os.mkdir(os.path.join(dir, gendir))
|
os.mkdir(os.path.join(dir, gendir))
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
|
|||||||
i_file = '/'.join(i_file.split('\\'))
|
i_file = '/'.join(i_file.split('\\'))
|
||||||
|
|
||||||
cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file]
|
cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file]
|
||||||
print ' '.join(cmd)
|
msg(' '.join(cmd))
|
||||||
spawn(cmd)
|
spawn(cmd)
|
||||||
|
|
||||||
# copy the generated python file to the package directory
|
# copy the generated python file to the package directory
|
||||||
@@ -264,6 +264,40 @@ def contrib_copy_tree(src, dest, verbose=0):
|
|||||||
copy_tree(src, dest, update=1, verbose=verbose)
|
copy_tree(src, dest, update=1, verbose=verbose)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class smart_install_data(install_data):
|
||||||
|
def run(self):
|
||||||
|
#need to change self.install_dir to the actual library dir
|
||||||
|
install_cmd = self.get_finalized_command('install')
|
||||||
|
self.install_dir = getattr(install_cmd, 'install_lib')
|
||||||
|
return install_data.run(self)
|
||||||
|
|
||||||
|
|
||||||
|
def build_locale_dir(destdir, verbose=1):
|
||||||
|
"""Build a locale dir under the wxPython package for MSW"""
|
||||||
|
moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo'))
|
||||||
|
for src in moFiles:
|
||||||
|
lang = os.path.splitext(os.path.basename(src))[0]
|
||||||
|
dest = opj(destdir, lang, 'LC_MESSAGES')
|
||||||
|
mkpath(dest, verbose=verbose)
|
||||||
|
copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose)
|
||||||
|
|
||||||
|
|
||||||
|
def build_locale_list(srcdir):
|
||||||
|
# get a list of all files under the srcdir, to be used for install_data
|
||||||
|
def walk_helper(lst, dirname, files):
|
||||||
|
for f in files:
|
||||||
|
filename = opj(dirname, f)
|
||||||
|
if not os.path.isdir(filename):
|
||||||
|
lst.append( (dirname, [filename]) )
|
||||||
|
file_list = []
|
||||||
|
os.path.walk(srcdir, walk_helper, file_list)
|
||||||
|
return file_list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# sanity checks
|
# sanity checks
|
||||||
|
|
||||||
@@ -510,6 +544,11 @@ if IN_CVS_TREE: # update the license files
|
|||||||
copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0)
|
copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0)
|
||||||
|
|
||||||
|
|
||||||
|
if os.name == 'nt':
|
||||||
|
build_locale_dir(opj(PKGDIR, 'locale'))
|
||||||
|
DATA_FILES += build_locale_list(opj(PKGDIR, 'locale'))
|
||||||
|
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
rc_file = ['src/wxc.rc']
|
rc_file = ['src/wxc.rc']
|
||||||
else:
|
else:
|
||||||
@@ -1174,8 +1213,11 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
options = { 'build' : { 'build_base' : BUILD_BASE }},
|
options = { 'build' : { 'build_base' : BUILD_BASE }},
|
||||||
|
|
||||||
##data_files = TOOLS,
|
|
||||||
scripts = SCRIPTS,
|
scripts = SCRIPTS,
|
||||||
|
|
||||||
|
cmdclass = { 'install_data': smart_install_data},
|
||||||
|
data_files = DATA_FILES,
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -632,6 +632,12 @@ if wxPlatform == "__WXGTK__":
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if wxPlatform == "__WXMSW__":
|
||||||
|
import os
|
||||||
|
localedir = os.path.join(os.path.split(__file__)[0], "locale")
|
||||||
|
wxLocale_AddCatalogLookupPathPrefix(localedir)
|
||||||
|
del os
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# wxWindows version numbers. wxPython version is in __version__.
|
# wxWindows version numbers. wxPython version is in __version__.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user