wxPython Merge #2 of 2.4 branch --> HEAD (branch tag: wxPy_2_4_merge_2)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -36,7 +36,7 @@ Clear as mud? Good. Let's get started.
|
||||
|
||||
2. Make a build directory and configure wxGTK.
|
||||
|
||||
cd wxPythonGTK-2.3.3 # or whatever the top-level dir is
|
||||
cd wxPythonSrc-2.4.0 # or whatever the top-level dir is
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --with-gtk \
|
||||
@@ -72,7 +72,6 @@ Clear as mud? Good. Let's get started.
|
||||
step, depending on where your WXPREF is.)
|
||||
|
||||
make
|
||||
cd ../build
|
||||
make install
|
||||
|
||||
|
||||
@@ -104,11 +103,23 @@ Clear as mud? Good. Let's get started.
|
||||
site-packages directory (such as to your home directory) then you
|
||||
can add "--root=<path>" after the "install" command. To use
|
||||
wxPython like this you'll need to ensure that the directory
|
||||
containing wxPyrthon is contained in in the PYTHONPATH environment
|
||||
containing wxPython is contained in the PYTHONPATH environment
|
||||
variable.
|
||||
|
||||
|
||||
5. That's all, except for the having fun part!
|
||||
5. If you havn't already, get a new copy of the demo and documentation
|
||||
to go with the wxPython you just built and installed. See
|
||||
http://wxpython.org/download.php#documentation
|
||||
|
||||
|
||||
6. Change to the demo directory and run it like this:
|
||||
|
||||
python demo.py
|
||||
|
||||
|
||||
7. That's all, except for the having fun part!
|
||||
|
||||
|
||||
|
||||
--
|
||||
Robin Dunn
|
||||
|
@@ -13,5 +13,5 @@ automatically and add them to the list. The zip file just needs to
|
||||
contain a .hhp file that defines the contents of the book. See the
|
||||
docs on wxHtmlHelpController for details.
|
||||
|
||||
If you'd still ike to view these docs in your regular browser you can
|
||||
If you'd still like to view these docs in your regular browser you can
|
||||
simply unzip each of the books into their own directory.
|
@@ -214,6 +214,9 @@ if [ -z "$skipinstall" ]; then
|
||||
mv -f $INSTALLROOT$PREFIX/lib/wx $INSTALLDEVEL$PREFIX/lib
|
||||
mv -f $INSTALLROOT$PREFIX/bin/wx* $INSTALLDEVEL$PREFIX/bin
|
||||
|
||||
# TODO for $INSTALLROOT and $INSTALLDEVEL ?
|
||||
# chown -R root:admin
|
||||
# chmod -R g+w
|
||||
fi
|
||||
|
||||
popd
|
||||
|
@@ -1,5 +1,5 @@
|
||||
Welcome!
|
||||
|
||||
This program will install wxPython 2.4.0.7 for MacPython-OSX 2.3.
|
||||
This program will install wxPython 2.4.1.1 for MacPython-OSX 2.3.
|
||||
|
||||
Build date: Fri Mar 21 14:00:06 PST 2003
|
||||
Build date: Fri Jun 13 10:07:30 PDT 2003
|
||||
|
@@ -4,15 +4,15 @@
|
||||
/usr/local/bin/python -O $2/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/../compileall.py $2/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wxPython
|
||||
|
||||
# and in the demo
|
||||
/usr/local/bin/python $2/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/../compileall.py /Applications/wxPythonOSX-2.4.0.7/demo
|
||||
/usr/local/bin/python $2/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/../compileall.py /Applications/wxPythonOSX-2.4.1.1/demo
|
||||
|
||||
# Make the demo/data dir writable
|
||||
chmod a+w /Applications/wxPythonOSX-2.4.0.7/demo/data
|
||||
chmod a+w /Applications/wxPythonOSX-2.4.1.1/demo/data
|
||||
|
||||
# and the wxPython pacakge should be group writable
|
||||
chgrp -R admin $2/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wxPython
|
||||
chgrp -R admin /Applications/wxPythonOSX-2.4.0.7
|
||||
chgrp -R admin /Applications/wxPythonOSX-2.4.1.1
|
||||
chmod -R g+w $2/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/wxPython
|
||||
chmod -R g+w /Applications/wxPythonOSX-2.4.0.7
|
||||
chmod -R g+w /Applications/wxPythonOSX-2.4.1.1
|
||||
|
||||
exit 0
|
||||
|
@@ -25,9 +25,7 @@ AppCopyright = Copyright
|
||||
DefaultDirName = {code:GetInstallDir|c:\DoNotInstallHere}
|
||||
DefaultGroupName = wxPython %(SHORTVER)s for Python %(PYTHONVER)s
|
||||
AlwaysCreateUninstallIcon = yes
|
||||
|
||||
;; SourceDir = .
|
||||
;; OutputDir is relative to SourceDir
|
||||
AdminPrivilegesRequired = yes
|
||||
OutputDir = dist
|
||||
WizardStyle = modern
|
||||
UninstallStyle = modern
|
||||
@@ -61,7 +59,6 @@ Name: core; Description: "wxPython modules and library"; Types: full compact
|
||||
Name: docs; Description: "Documentation"; Types: full
|
||||
Name: demo; Description: "Demo application"; Types: full
|
||||
Name: samples; Description: "Sample applications"; Types: full
|
||||
Name: tools; Description: "Tools"; Types: full
|
||||
|
||||
|
||||
;;------------------------------------------------------------
|
||||
@@ -94,10 +91,24 @@ Source: "wxPython\lib\editor\*.py"; DestDir: "{app}\wxPython\lib\editor"
|
||||
Source: "wxPython\lib\editor\*.txt"; DestDir: "{app}\wxPython\lib\editor"; Components: core
|
||||
Source: "wxPython\lib\mixins\*.py"; DestDir: "{app}\wxPython\lib\mixins"; Components: core
|
||||
Source: "wxPython\lib\PyCrust\*.py"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
|
||||
Source: "wxPython\lib\PyCrust\*.txt"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
|
||||
Source: "wxPython\lib\PyCrust\*.ico"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
|
||||
Source: "wxPython\lib\PyCrust\wxd\*.py"; DestDir: "{app}\wxPython\lib\PyCrust\wxd"; 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
|
||||
Source: "wxPython\py\*.py"; DestDir: "{app}\wxPython\py"; Components: core
|
||||
Source: "wxPython\py\*.txt"; DestDir: "{app}\wxPython\py"; Components: core
|
||||
Source: "wxPython\py\*.ico"; DestDir: "{app}\wxPython\py"; Components: core
|
||||
Source: "wxPython\py\*.png"; DestDir: "{app}\wxPython\py"; Components: core
|
||||
Source: "wxPython\py\tests\*.py"; DestDir: "{app}\wxPython\py\tests"; Components: core
|
||||
Source: "wxPython\py\wxd\*.py"; DestDir: "{app}\wxPython\py\wxd"; Components: core
|
||||
|
||||
Source: "wx\*.py"; DestDir: "{app}\wx"; Components: core
|
||||
Source: "wx\lib\*.py"; DestDir: "{app}\wx\lib"; Components: core
|
||||
Source: "wx\lib\colourchooser\*.py"; DestDir: "{app}\wx\lib\colourchooser"; Components: core
|
||||
Source: "wx\lib\editor\*.py"; DestDir: "{app}\wx\lib\editor"; Components: core
|
||||
Source: "wx\lib\mixins\*.py"; DestDir: "{app}\wx\lib\mixins"; Components: core
|
||||
Source: "wx\py\*.py"; DestDir: "{app}\wx\py"; Components: core
|
||||
Source: "wx\tools\*.py"; DestDir: "{app}\wx\tools"; Components: core
|
||||
Source: "wx\tools\XRCed\*.py"; DestDir: "{app}\wx\tools\XRCed"; Components: core
|
||||
|
||||
|
||||
%(LOCALE)s
|
||||
|
||||
@@ -142,25 +153,34 @@ Source: "CHANGES.txt"; DestDir: "{app}\wxPython\docs"; Comp
|
||||
Source: "licence\*.txt"; DestDir: "{app}\wxPython\docs\licence"; Components: core
|
||||
Source: "%(WXDIR)s\docs\htmlhelp\wx.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
|
||||
Source: "%(WXDIR)s\docs\htmlhelp\ogl.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
|
||||
Source: "docs\*.txt"; DestDir: "{app}\wxPython\docs"; Components: docs
|
||||
Source: "docs\*.css"; DestDir: "{app}\wxPython\docs"; Components: docs
|
||||
Source: "docs\*.html"; DestDir: "{app}\wxPython\docs"; Components: docs
|
||||
Source: "docs\*.conf"; DestDir: "{app}\wxPython\docs"; Components: docs
|
||||
Source: "docs\screenshots\*.png"; DestDir: "{app}\wxPython\docs\screenshots"; Components: docs
|
||||
|
||||
Source: "wxPython\tools\*.py"; DestDir: "{app}\wxPython\tools"; Components: tools
|
||||
Source: "wxPython\tools\XRCed\*.txt"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
|
||||
Source: "wxPython\tools\XRCed\sawfishrc"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
|
||||
Source: "wxPython\tools\XRCed\*.py"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
|
||||
Source: "wxPython\tools\XRCed\*.xrc"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
|
||||
Source: "wxPython\tools\XRCed\*.ico"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
|
||||
Source: "wxPython\tools\XRCed\*.sh"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
|
||||
Source: "wxPython\tools\*.py"; DestDir: "{app}\wxPython\tools"; Components: core
|
||||
Source: "wxPython\tools\XRCed\*.txt"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\sawfishrc"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\*.py"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\*.xrc"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\*.ico"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\*.png"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\*.sh"; DestDir: "{app}\wxPython\tools\XRCed"; Components: core
|
||||
Source: "wxPython\tools\XRCed\src-images\*.png"; DestDir: "{app}\wxPython\tools\XRCed\src-images"; Components: core
|
||||
|
||||
Source: "scripts\*.bat"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\*.py"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\helpviewer"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\img2png"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\img2py"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\img2xpm"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\xrced"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\pyshell"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\pycrust"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\pycwrap"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
|
||||
Source: "scripts\*.bat"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\*.py"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\helpviewer"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\img2png"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\img2py"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\img2xpm"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\pyalacarte"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\pyalamode"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\pyshell"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\pycrust"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\pywrap"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
Source: "scripts\xrced"; DestDir: "{code:GetPythonDir}\Scripts"; Components: core
|
||||
|
||||
Source: "samples\doodle\*.py"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
|
||||
Source: "samples\doodle\*.txt"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
|
||||
@@ -170,15 +190,17 @@ Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\wxPython\samples\doo
|
||||
Source: "samples\wxProject\*.txt"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
|
||||
Source: "samples\wxProject\*.py"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
|
||||
|
||||
Source: "samples\StyleEditor\*.txt"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
|
||||
Source: "samples\StyleEditor\*.py"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
|
||||
Source: "samples\StyleEditor\*.cfg"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
|
||||
Source: "samples\StyleEditor\*.txt"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
|
||||
Source: "samples\StyleEditor\*.py"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
|
||||
Source: "samples\StyleEditor\*.cfg"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
|
||||
|
||||
Source: "samples\pySketch\*.py"; DestDir: "{app}\wxPython\samples\pySketch"; Components: samples
|
||||
Source: "samples\pySketch\images\*.bmp"; DestDir: "{app}\wxPython\samples\pySketch\images"; Components: samples
|
||||
|
||||
Source: "samples\frogedit\*.py"; DestDir: "{app}\wxPython\samples\frogedit"; Components: samples
|
||||
|
||||
Source: "samples\hangman\*.py"; DestDir: "{app}\wxPython\samples\hangman"; Components: samples
|
||||
|
||||
Source: "samples\embedded\*.py"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
|
||||
Source: "samples\embedded\*.cpp"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
|
||||
Source: "samples\embedded\*.txt"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
|
||||
@@ -187,6 +209,10 @@ Source: "samples\embedded\*.unx"; DestDir: "{app}\wxPython\samples\embe
|
||||
Source: "samples\embedded\*.ico"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
|
||||
Source: "samples\embedded\*.xpm"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
|
||||
|
||||
Source: "samples\wx_examples\basic\*.py"; DestDir: "{app}\wxPython\samples\wx_examples\basic"; Components: samples
|
||||
Source: "samples\wx_examples\hello\*.py"; DestDir: "{app}\wxPython\samples\wx_examples\hello"; Components: samples
|
||||
Source: "samples\wx_examples\hello\*.jpg"; DestDir: "{app}\wxPython\samples\wx_examples\hello"; Components: samples
|
||||
|
||||
Source: "src\winxp.manifest"; DestDir: "{code:GetPythonDir}"; DestName: "python.exe.manifest"; Components: core
|
||||
Source: "src\winxp.manifest"; DestDir: "{code:GetPythonDir}"; DestName: "pythonw.exe.manifest"; Components: core
|
||||
|
||||
@@ -194,24 +220,29 @@ Source: "src\winxp.manifest"; DestDir: "{code:GetPythonDir}"; DestN
|
||||
;;------------------------------------------------------------
|
||||
|
||||
[Run]
|
||||
;; Compile the .py files
|
||||
Filename: "{code:GetPythonDir}\python.exe"; Parameters: "{code:GetPythonDir}\Lib\compileall.py {app}\wxPython {app}\wx"; Description: "Compile Python .py files to .pyc"; Flags: postinstall; Components: core
|
||||
|
||||
;; Recreate the tool scripts to use the paths on the users machine
|
||||
Filename: "{code:GetPythonDir}\python.exe"; Parameters: "{code:GetPythonDir}\Lib\compileall.py {app}\wxPython"; Description: "Compile Python .py files to .pyc"; Flags: postinstall; Components: core
|
||||
Filename: "{code:GetPythonDir}\python.exe"; Parameters: "CreateBatchFiles.py"; WorkingDir: "{code:GetPythonDir}\Scripts"; Description: "Create batch files for tool scripts"; Flags: postinstall; Components: tools
|
||||
Filename: "{code:GetPythonDir}\python.exe"; Parameters: "CreateBatchFiles.py"; WorkingDir: "{code:GetPythonDir}\Scripts"; Description: "Create batch files for tool scripts"; Flags: postinstall; Components: core
|
||||
|
||||
|
||||
;;------------------------------------------------------------
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\Run the DEMO"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "{app}\wxPython\demo"; Parameters: "demo.py"; IconFilename: "{app}\wxPython\demo\wxpdemo.ico"; Components: core
|
||||
Name: "{group}\PyCrust"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pycrust"; IconFilename: "{app}\wxPython\lib\PyCrust\PyCrust.ico"; Components: core
|
||||
Name: "{group}\PyShell"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pyshell"; IconFilename: "{app}\wxPython\lib\PyCrust\PyCrust.ico"; Components: core
|
||||
Name: "{group}\Run the wxPython DEMO"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "{app}\wxPython\demo"; Parameters: "demo.py"; IconFilename: "{app}\wxPython\demo\wxpdemo.ico"; Components: core
|
||||
Name: "{group}\PyCrust"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pycrust"; IconFilename: "{app}\wxPython\py\PyCrust.ico"; Components: core
|
||||
Name: "{group}\PyShell"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pyshell"; IconFilename: "{app}\wxPython\py\PyCrust.ico"; Components: core
|
||||
Name: "{group}\PyAlaMode"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pyalamode"; IconFilename: "{app}\wxPython\py\PyCrust.ico"; Components: core
|
||||
Name: "{group}\PyAlaCarte"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pyalacarte"; IconFilename: "{app}\wxPython\py\PyCrust.ico"; Components: core
|
||||
Name: "{group}\wxWindows Reference"; Filename: "{app}\wxPython\docs\wx.chm"; Components: docs
|
||||
Name: "{group}\wxOGL Reference"; Filename: "{app}\wxPython\docs\ogl.chm"; Components: docs
|
||||
Name: "{group}\licence.txt"; Filename: "{app}\wxPython\docs\licence\licence.txt"; Components: core
|
||||
Name: "{group}\README.txt"; Filename: "{app}\wxPython\docs\README.txt"; Components: core
|
||||
Name: "{group}\CHANGES.txt"; Filename: "{app}\wxPython\docs\CHANGES.txt"; Components: core
|
||||
Name: "{group}\Sample Apps"; Filename: "{app}\wxPython\samples"; Components: samples
|
||||
Name: "{group}\Resource Editor"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\xrced"; IconFilename: "{app}\wxPython\Tools\XRCed\xrced.ico"; Components: tools
|
||||
Name: "{group}\Resource Editor"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\xrced"; IconFilename: "{app}\wxPython\Tools\XRCed\xrced.ico"; Components: core
|
||||
Name: "{group}\wxPython Docs"; Filename: "{app}\wxPython\docs\wxPythonDocs.html"; Components: docs
|
||||
|
||||
|
||||
;;------------------------------------------------------------
|
||||
@@ -228,12 +259,14 @@ Type: files; Name: "{app}\wxPython\lib\mixins\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\lib\mixins\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\lib\PyCrust\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\lib\PyCrust\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\lib\PyCrust\decor\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\lib\PyCrust\decor\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\lib\PyCrust\wxd\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\lib\PyCrust\wxd\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\lib\colourchooser\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\lib\colourchooser\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\py\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\py\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\py\tests\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\py\tests\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\py\wxd\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\py\wxd\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\tools\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\tools\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyc";
|
||||
@@ -253,6 +286,13 @@ Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\samples\frogedit\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\frogedit\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\samples\hangman\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\hangman\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\samples\hangman\*.txt";
|
||||
Type: files; Name: "{app}\wxPython\samples\wx_examples\basic\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\wx_examples\basic\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\samples\wx_examples\hello\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\wx_examples\hello\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\demo\data\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\demo\data\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\demo\dllwidget\*.pyc";
|
||||
@@ -261,6 +301,24 @@ Type: files; Name: "{app}\wxPython\samples\embedded\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\embedded\*.pyo";
|
||||
Type: files; Name: "{app}\wxPython\samples\pySketch\*.pyc";
|
||||
Type: files; Name: "{app}\wxPython\samples\pySketch\*.pyo";
|
||||
Type: files; Name: "{app}\wx\*.pyc";
|
||||
Type: files; Name: "{app}\wx\*.pyo";
|
||||
Type: files; Name: "{app}\wx\lib\*.pyc";
|
||||
Type: files; Name: "{app}\wx\lib\*.pyo";
|
||||
Type: files; Name: "{app}\wx\lib\colourchooser\*.pyc";
|
||||
Type: files; Name: "{app}\wx\lib\colourchooser\*.pyo";
|
||||
Type: files; Name: "{app}\wx\lib\editor\*.pyc";
|
||||
Type: files; Name: "{app}\wx\lib\editor\*.pyo";
|
||||
Type: files; Name: "{app}\wx\lib\mixins\*.pyc";
|
||||
Type: files; Name: "{app}\wx\lib\mixins\*.pyo";
|
||||
Type: files; Name: "{app}\wx\py\*.pyc";
|
||||
Type: files; Name: "{app}\wx\py\*.pyo";
|
||||
Type: files; Name: "{app}\wx\tools\*.pyc";
|
||||
Type: files; Name: "{app}\wx\tools\*.pyo";
|
||||
Type: files; Name: "{app}\wx\tools\XRCed\*.pyc";
|
||||
Type: files; Name: "{app}\wx\tools\XRCed\*.pyo";
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
@@ -380,7 +438,7 @@ def main():
|
||||
verglob = {}
|
||||
execfile("wxPython/__version__.py", verglob)
|
||||
|
||||
VERSION = verglob["ver"]
|
||||
VERSION = verglob["wxVERSION_STRING"]
|
||||
SHORTVER = VERSION[:3]
|
||||
|
||||
WXDLL, PYTHONVER = find_DLLs()
|
||||
|
111
wxPython/distrib/make_static_setup.py
Normal file
111
wxPython/distrib/make_static_setup.py
Normal file
@@ -0,0 +1,111 @@
|
||||
#!/bin/env python
|
||||
#---------------------------------------------------------------------------
|
||||
# This script generates a template that can be used in the Python
|
||||
# build process (on posix systems) in order to staticly link the
|
||||
# wxPython modules into the Python executable. The output of this
|
||||
# script should be put into a file named Setup.local (or perhaps just
|
||||
# concatenated to Setup) in the Modules dir of the Python source
|
||||
# distribution, then just build Python like normal.
|
||||
#
|
||||
# You can use any of the command-line args that setup.py understands
|
||||
# with this script too in order to control what modules are built and
|
||||
# which compile options and such are used.
|
||||
#
|
||||
# This script must be run from the wxPython directory.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
import sys, os, re
|
||||
|
||||
# if you need to change some setup.py flags do it here before it is
|
||||
# imported. Just append to sys.argv.
|
||||
sys.argv.append("BUILD_GLCANVAS=0")
|
||||
sys.argv.append("BUILD_OGL=0")
|
||||
sys.argv.append("BUILD_DLLWIDGET=0")
|
||||
#sys.argv.append("CORE_ONLY=1")
|
||||
|
||||
import setup
|
||||
|
||||
|
||||
def printitem(st):
|
||||
if st:
|
||||
print '\\\n\t', st,
|
||||
|
||||
|
||||
def buildflags(items, flag, path=None):
|
||||
st = ''
|
||||
for item in items:
|
||||
if path is not None and item[0] != '/':
|
||||
item = os.path.join(path, item)
|
||||
st += "%s%s " % (flag, item)
|
||||
return st
|
||||
|
||||
|
||||
def buildmacros(items):
|
||||
st = ''
|
||||
for item in items:
|
||||
if len(item) == 1:
|
||||
st += "-U%s " % item[0]
|
||||
elif item[1] is None:
|
||||
st += "-D%s " % item[0]
|
||||
else:
|
||||
st += "-D%s=%s " % item
|
||||
return st
|
||||
|
||||
|
||||
# Python's makesetup can't handle -D flags with = in them, so we need to workaround
|
||||
def fixmacros(st):
|
||||
defs = []
|
||||
pat = re.compile(r'-D([A-Za-z0-9_]*)=([A-Za-z0-9_]*)')
|
||||
match = pat.search(st)
|
||||
while match is not None:
|
||||
name = match.group(1)
|
||||
value = match.group(2)
|
||||
defs.append("m_%s = -D%s=%s" % (name, name, value))
|
||||
st = st[:match.start()] + ("$(m_%s)" % name) + st[match.end():]
|
||||
match = pat.search(st)
|
||||
|
||||
return st, defs
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
cwd = os.getcwd()
|
||||
|
||||
print """\
|
||||
# This file is autogenerated by %s and should be
|
||||
# placed in the <PythonDist>/Modules/Setup.local file before
|
||||
# Python is built.
|
||||
|
||||
*static*
|
||||
|
||||
""" % sys.argv[0]
|
||||
|
||||
for ext in setup.wxpExtensions:
|
||||
eca = " ".join(ext.extra_compile_args)
|
||||
macros = buildmacros(ext.define_macros)
|
||||
|
||||
eca, defs = fixmacros(eca)
|
||||
print "\n".join(defs)
|
||||
macros, defs = fixmacros(macros)
|
||||
print "\n".join(defs)
|
||||
|
||||
print ext.name,
|
||||
for s in ext.sources:
|
||||
printitem(os.path.join(cwd, s))
|
||||
printitem(buildflags(ext.include_dirs, '-I', cwd))
|
||||
printitem(buildflags(ext.library_dirs, '-L'))
|
||||
printitem(buildflags(ext.libraries, '-l'))
|
||||
printitem(macros)
|
||||
printitem(eca)
|
||||
# filter out some options that makesetup can't handle, but it shouldn't hurt to remove these...
|
||||
ela = filter(lambda x: x not in ['-pthread', '-rdynamic'], ext.extra_link_args)
|
||||
printitem(" ".join(ela))
|
||||
|
||||
print; print; print
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@@ -136,14 +136,16 @@ if [ -z "${skipcopy}" ]; then
|
||||
cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
|
||||
|
||||
# copy all top dirs except CVS, build, demos, utils, samples, and wxPython
|
||||
for d in art contrib debian distrib docs include lib locale misc src; do
|
||||
cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
|
||||
for d in art contrib debian distrib docs include lib locale misc patches src; do
|
||||
if [ -e ${wxdir}/$d ]; then
|
||||
cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
|
||||
# now do the same thing for wxPython, skipping it's build dirs and such
|
||||
mkdir ${tarver}/wxPython
|
||||
cp -pf --link ${wxdir}/wxPython/* ${tarver}/wxPython > /dev/null 2>&1
|
||||
for d in contrib demo distrib distutils samples scripts src wxPython; do
|
||||
for d in contrib demo distrib distutils docs licence samples scripts src wx wxPython; do
|
||||
cp -Rpf --link ${wxdir}/wxPython/$d ${tarver}/wxPython #> /dev/null 2>&1
|
||||
done
|
||||
|
||||
|
@@ -28,8 +28,12 @@
|
||||
# build the name of the real wx-config from the port, flags, etc.
|
||||
%define dbgflg %(if [ "%{debug_flag}" = "1" ]; then echo d; fi)
|
||||
%define uniflg %(if [ "%{unicode}" = "1" ]; then echo u; fi)
|
||||
%define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi)
|
||||
%define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi)
|
||||
%define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config
|
||||
|
||||
# turn off the generation of debuginfo rpm (RH9)
|
||||
%define debug_package %{nil}
|
||||
|
||||
#----------------------------------------------------------------
|
||||
Summary: Cross platform GUI toolkit for Python using wx%{port}
|
||||
@@ -43,13 +47,18 @@ Packager: Robin Dunn <robin@alldunn.com>
|
||||
Group: Development/Python
|
||||
BuildRoot: %{_tmppath}/%{name}-buildroot
|
||||
Prefix: %{pref}
|
||||
#BuildRequires: %{python}
|
||||
|
||||
Provides: wxPython = %{version}
|
||||
Provides: wxPython%{port} = %{version}
|
||||
|
||||
Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so
|
||||
Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2})
|
||||
Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so
|
||||
Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2})
|
||||
|
||||
|
||||
# old wxPython packages
|
||||
Obsoletes: wxPython
|
||||
Obsoletes: wxPython wxPython%{port}
|
||||
|
||||
|
||||
%description
|
||||
@@ -127,8 +136,6 @@ cd $WXDIR/wxPython
|
||||
WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \
|
||||
build
|
||||
|
||||
## WX_CONFIG="$WXDIR/build/wx-config --inplace --prefix=$RPM_BUILD_ROOT%{wxpref}" \
|
||||
|
||||
|
||||
|
||||
# Build wxrc (XRC resource tool) but don't use the makefiles since they expect
|
||||
@@ -138,7 +145,7 @@ WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build"
|
||||
wCC=`$WX_CONFIG --cc`
|
||||
wCXX=`$WX_CONFIG --cxx`
|
||||
|
||||
for f in wxrc.cpp ../../src/xrc/*.cpp; do
|
||||
for f in wxrc.cpp ../../src/xrc/xml.cpp ../../src/xrc/xmlres.cpp; do
|
||||
echo $f
|
||||
$wCXX `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f
|
||||
done
|
||||
@@ -147,9 +154,6 @@ for f in ../../src/xrc/expat/xmlparse/xmlparse.c ../../src/xrc/expat/xmltok/xmlr
|
||||
$wCC `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f
|
||||
done
|
||||
|
||||
# the handlers are not needed
|
||||
rm xh_*.o xmlrsall.o
|
||||
|
||||
$wCXX `$WX_CONFIG --libs` *.o -o wxrc
|
||||
strip wxrc
|
||||
|
||||
@@ -189,8 +193,10 @@ for s in \
|
||||
img2png \
|
||||
img2py \
|
||||
img2xpm \
|
||||
pyalacarte \
|
||||
pyalamode \
|
||||
pycrust \
|
||||
pycwrap \
|
||||
pywrap \
|
||||
pyshell \
|
||||
xrced; do
|
||||
cp scripts/$s $RPM_BUILD_ROOT/%{pref}/bin
|
||||
@@ -201,6 +207,37 @@ done
|
||||
cp $WXDIR/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT/%{pref}/bin
|
||||
|
||||
|
||||
# Copy icons and make menu entries
|
||||
#-- This only works for Mandrake. Is there a cross-distro way to do it?
|
||||
##mkdir -p $RPM_BUILD_ROOT/%{_iconsdir}
|
||||
##mkdir -p $RPM_BUILD_ROOT/%{_miconsdir}
|
||||
##mkdir -p $RPM_BUILD_ROOT/%{_menudir}
|
||||
##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_32.png $RPM_BUILD_ROOT/%{_iconsdir}/PyCrust.png
|
||||
##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_16.png $RPM_BUILD_ROOT/%{_miconsdir}/PyCrust.png
|
||||
##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT/%{_iconsdir}/XRCed.png
|
||||
##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT/%{_miconsdir}/XRCed.png
|
||||
##
|
||||
##cat > $RPM_BUILD_ROOT/%{_menudir}/%{name} <<EOF
|
||||
##?package(%{name}): command="%_bindir/pyshell" needs="X11" \
|
||||
##icon="PyCrust.png" section="Applications/Development" \
|
||||
##title="PyShell" longtitle="Python Shell"
|
||||
##
|
||||
##?package(%{name}): command="%_bindir/pycrust" needs="X11" \
|
||||
##icon="PyCrust.png" section="Applications/Development" \
|
||||
##title="PyCrust" longtitle="Python Shell with Filling"
|
||||
##
|
||||
##?package(%{name}): command="%_bindir/pyalamode" needs="X11" \
|
||||
##icon="PyCrust.png" section="Applications/Development" \
|
||||
##title="PyAlaMode" longtitle="Python Shell with Filling and editor windows"
|
||||
##
|
||||
##?package(%{name}): command="%_bindir/xrced" needs="X11" \
|
||||
##icon="XRCed.png" section="Applications/Development" \
|
||||
##title="XRCed" longtitle="wxPython XRC resource editor"
|
||||
##
|
||||
##EOF
|
||||
|
||||
|
||||
|
||||
# Generate the filelists. For some reason the %defattr below is still
|
||||
# resulting in many (but not all) files not owned by root when just
|
||||
# specifying directories and wildcards to be included in each package.
|
||||
@@ -218,6 +255,8 @@ $GFL $RPM_BUILD_ROOT %{wxpref} >> FILELIST
|
||||
$GFL $RPM_BUILD_ROOT %{wxpref}/lib >> FILELIST
|
||||
$GFL $RPM_BUILD_ROOT "%{wxpref}/lib/libwx*" >> FILELIST
|
||||
$GFL -r $RPM_BUILD_ROOT %{wxpref}/share >> FILELIST
|
||||
###GFL -r $RPM_BUILD_ROOT %{_iconsdir} >> FILELIST
|
||||
##$GFL -r $RPM_BUILD_ROOT %{_menudir} >> FILELIST
|
||||
|
||||
$GFL $RPM_BUILD_ROOT %{wxpref}/include > DEVELLIST
|
||||
$GFL -r $RPM_BUILD_ROOT %{wxpref}/include/wx >> DEVELLIST
|
||||
@@ -226,6 +265,13 @@ $GFL $RPM_BUILD_ROOT %{wxconfigname} >> DEVELLIST
|
||||
$GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
##%post
|
||||
##%{update_menus}
|
||||
##
|
||||
##%postun
|
||||
##%{clean_menus}
|
||||
|
||||
#----------------------------------------------------------------
|
||||
%clean
|
||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
@@ -237,7 +283,7 @@ $GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST
|
||||
%defattr(-,root,root)
|
||||
%doc docs/preamble.txt docs/licence.txt docs/readme.txt docs/changes.txt
|
||||
%doc wxPython/README.txt wxPython/CHANGES.txt
|
||||
|
||||
%doc wxPython/docs/*
|
||||
|
||||
%files -n wxPython%{port}-devel -f DEVELLIST
|
||||
%defattr(-,root,root)
|
||||
|
220
wxPython/distrib/wx_conv.py
Normal file
220
wxPython/distrib/wx_conv.py
Normal file
@@ -0,0 +1,220 @@
|
||||
"""
|
||||
Convert modules from the old 'from wxPython.wx import *' style to
|
||||
the new 'import wx' style.
|
||||
|
||||
Author: dfh@forestfield.co.uk (David Hughes)
|
||||
|
||||
|
||||
This should probably go in the tools package and have a startup script
|
||||
like the others, but I don't think it's ready for prime-time yet. So
|
||||
just put it in distrib for now so it doesn't get lost...
|
||||
|
||||
--Robin
|
||||
"""
|
||||
|
||||
|
||||
import os, sys, time
|
||||
import string
|
||||
t0 = time.time()
|
||||
|
||||
|
||||
import wx
|
||||
print 'length = ', len(wx._newnames)
|
||||
|
||||
for key in ['true', 'True', 'false', 'False']: # use native Python not wx.<bool>
|
||||
if key in wx._newnames:
|
||||
del wx._newnames[key]
|
||||
|
||||
import wx.calendar, wx.gizmos, wx.glcanvas, wx.grid, wx.help, wx.html, \
|
||||
wx.htmlhelp, wx.iewin, wx.ogl, wx.stc, wx.wizard, wx.xrc
|
||||
import wx.lib
|
||||
##import wx.lib.activexwrapper, wx.lib.analogclock, wx.lib.anchors, \
|
||||
import wx.lib.activexwrapper, wx.lib.anchors, \
|
||||
wx.lib.buttons, wx.lib.calendar, wx.lib.ClickableHtmlWindow, \
|
||||
wx.lib.colourdb, wx.lib.colourselect, wx.lib.dialogs, \
|
||||
wx.lib.ErrorDialogs, wx.lib.evtmgr, wx.lib.fancytext, \
|
||||
wx.lib.filebrowsebutton, wx.lib.gridmovers, wx.lib.grids, \
|
||||
wx.lib.imagebrowser, wx.lib.imageutils, wx.lib.infoframe, \
|
||||
wx.lib.intctrl, wx.lib.layoutf, wx.lib.multisash, \
|
||||
wx.lib.popupctl, wx.lib.printout, wx.lib.rcsizer, \
|
||||
wx.lib.rightalign, wx.lib.sheet, wx.lib.stattext, \
|
||||
wx.lib.throbber, wx.lib.timectrl, wx.lib.wxPlotCanvas, \
|
||||
wx.lib.wxpTag
|
||||
import wx.lib.mixins, wx.lib.editor, wx.lib.colourchooser
|
||||
import wx.lib.mixins.grid, wx.lib.mixins.imagelist, \
|
||||
wx.lib.mixins.listctrl
|
||||
## wx.lib.mixins.listctrl, wx.lib.mixins.rubberband
|
||||
import wx.lib.editor.editor, wx.lib.editor.images, wx.lib.editor.selection
|
||||
import wx.lib.colourchooser.canvas, wx.lib.colourchooser.intl, wx.lib.colourchooser.pycolourbox, \
|
||||
wx.lib.colourchooser.pycolourchooser, wx.lib.colourchooser.pycolourslider, wx.lib.colourchooser.pypalette
|
||||
|
||||
wxlist = []
|
||||
for kd in wx._newnames.items():
|
||||
wxlist.append(kd)
|
||||
wxlist.sort()
|
||||
|
||||
n = 0
|
||||
for item in wxlist:
|
||||
n += 1
|
||||
## print n, item
|
||||
print 'length = ', len(wx._newnames)
|
||||
print 'imports completed in ', time.time()-t0, 'secs'
|
||||
|
||||
base_path = 'G:/wxConvert/Test1'
|
||||
exclude_dir = ( 'wx', 'wx_cc', 'reportlab', 'sqlite') # MUST exclude wx if it is below base_dir, others optional
|
||||
|
||||
other_subs = { 'true': 'True',
|
||||
'false': 'False'
|
||||
}
|
||||
|
||||
punct = string.punctuation.replace('_','') # exclude single underscore
|
||||
punct = punct.replace('.','') # and period
|
||||
punct = punct.replace('*','') # and asterisk, all allowed in names
|
||||
punctable = string.maketrans(punct, ' '*len(punct)) # map punctuation characters to spaces
|
||||
numfiles = 0
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
class AFile:
|
||||
" file object - collection of properties relating to current instance"
|
||||
def __init__(self, subsdict):
|
||||
self.subsdict = subsdict.copy() # dictionary of universal and local substitutions to make
|
||||
self.importing = [] # list of wx modules being imported
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def visit(noargs, thispath, contentlist):
|
||||
""" Function is called by os walk for every directory in base_path,
|
||||
including base_path itself. Contentlist is a list of files/dirs in thispath.
|
||||
Wx conversion function is called for every qualifying file in list
|
||||
"""
|
||||
path = thispath
|
||||
base = 'something'
|
||||
while base: # check if thispath or a parent is excluded
|
||||
path, base = os.path.split(path)
|
||||
if base in exclude_dir:
|
||||
print 'Excluded:', thispath
|
||||
return
|
||||
|
||||
for item in contentlist:
|
||||
pathname = os.path.join(thispath, item)
|
||||
if os.path.isfile(pathname) and pathname[-3:].lower() == '.py':
|
||||
wxconvert(pathname)
|
||||
|
||||
def wxconvert(pathname):
|
||||
""" Scan each line of text in pathname. Replace each occurrence of any key in wx._newnames
|
||||
dictionary with the content stored under that key
|
||||
"""
|
||||
global numfiles
|
||||
afile = AFile(other_subs)
|
||||
infile = open(pathname, 'r')
|
||||
linelist = infile.readlines()
|
||||
infile.close()
|
||||
|
||||
lnum = 0
|
||||
outlist = []
|
||||
for line in linelist:
|
||||
lnum += 1
|
||||
tokenlist = line.replace('.__', ' ').translate(punctable).split() # split on white space and punctuation
|
||||
line, status = checkimports(afile, line, tokenlist) # return line with 'import' modifications
|
||||
if not status:
|
||||
print 'Unable to convert line %d in %s' % (lnum, pathname)
|
||||
break
|
||||
else:
|
||||
for key in afile.subsdict: # do other changes first
|
||||
if line.find(key) >= 0:
|
||||
line = line.replace(key, afile.subsdict[key])
|
||||
for token in tokenlist: # change wx names
|
||||
if token in wx._newnames:
|
||||
candidate = wx._newnames[token]
|
||||
module = candidate[:candidate.rfind('.')]
|
||||
if module in afile.importing:
|
||||
line = line.replace(token, candidate)
|
||||
outlist.append(line)
|
||||
else:
|
||||
outfile = open(pathname, 'w')
|
||||
outfile.writelines(outlist)
|
||||
numfiles += 1
|
||||
print 'Converted:', pathname
|
||||
outfile.close()
|
||||
|
||||
def checkimports(afile, line, tlist):
|
||||
""" Scan tokenlist for wxPython import statement. Add to afile.subsdict any
|
||||
name changes that are necessary for the rest of the current source file.
|
||||
Add to afile.importing any new import modules
|
||||
Return a tuple (status, newstring) -
|
||||
line, possibly modified if an import statmeny
|
||||
status: 0: unable to handle complexity, 1: OK
|
||||
"""
|
||||
aline = line
|
||||
if len(tlist) == 0: return (aline, 1)
|
||||
indent = ''
|
||||
for ch in line:
|
||||
if ch in string.whitespace:
|
||||
indent += ' '
|
||||
else:
|
||||
break
|
||||
|
||||
if tlist[0] == 'import': # import module [as name] [module [as name]...]
|
||||
skip = False
|
||||
for t in tlist[1:]:
|
||||
if skip:
|
||||
skip = False
|
||||
elif t == 'as':
|
||||
skip = True
|
||||
elif t.startswith('wx'):
|
||||
aline = aline.replace(t, rename_module(afile, t))
|
||||
elif (tlist[0] == 'from' and
|
||||
tlist[1] == 'wxPython' and
|
||||
tlist[2] == 'import'): # from wxPython import module
|
||||
if len(tlist) > 4: # ...[as name] [module [as name]...]
|
||||
return ('', 0) # too complicated
|
||||
module = rename_module(afile,tlist[-1])
|
||||
aline = indent = 'import ' + module + '\n'
|
||||
elif (tlist[0] == 'from' and
|
||||
tlist[1].startswith('wxPython') and
|
||||
tlist[2] == 'import'): # from module import ....
|
||||
if tlist[-1] <> '*': # ...name [as name] [name [as name]...]
|
||||
aline = aline.replace(tlist[1], rename_module(afile, tlist[1]))
|
||||
skip = False
|
||||
for t in tlist[3:]:
|
||||
if skip:
|
||||
skip = False
|
||||
elif t == 'as':
|
||||
skip = True
|
||||
else:
|
||||
elem = t.split('.')
|
||||
if elem[-1].startswith('wx'): # remove wx prefix from last element of name
|
||||
elem[-1] = elem[-1][2:]
|
||||
afile.subsdict[t] = '.'.join(elem) # and apply to each occurrence in source
|
||||
else: # from module import *
|
||||
module = rename_module(afile,tlist[1])
|
||||
aline = indent = 'import ' + module + '\n'
|
||||
return (aline, 1)
|
||||
|
||||
def rename_module(afile, t, type='A'):
|
||||
""" Substitute wx for wxPython.wx or wx, and wx.foo.bar for wxPython.foo.bar in token
|
||||
foo.bar => wx.foo.bar is also permitted (from wxPython import foo.bar)
|
||||
"""
|
||||
if t in ['wx', 'wxPython.wx']:
|
||||
module = 'wx'
|
||||
elif t.startswith('wxPython'):
|
||||
module = t.replace('wxPython', 'wx')
|
||||
elif t.startswith('wx'):
|
||||
module = t
|
||||
else:
|
||||
module = 'wx.' + t
|
||||
if module not in afile.importing:
|
||||
afile.importing.append(module)
|
||||
return module
|
||||
|
||||
def main():
|
||||
" Convert every file in base_dir and all subdirectories except in exclude_dir list"
|
||||
|
||||
os.path.walk(base_path, visit, None)
|
||||
print '%d files converted in %.2f seconds' % (numfiles, time.time() - t0)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
116
wxPython/distrib/wx_create.py
Normal file
116
wxPython/distrib/wx_create.py
Normal file
@@ -0,0 +1,116 @@
|
||||
"""
|
||||
wx_create.py
|
||||
|
||||
Originally written by David Hughes <dfh@forestfield.co.uk>
|
||||
Massivly hacked by Robin Dunn
|
||||
|
||||
This automatically creates all the stub modules that are required in
|
||||
the wx package in addition to __init__.py
|
||||
|
||||
The module names to make stubs for are found by scanning the wxPython
|
||||
package directory. The default directory searched is ../wxPython, but
|
||||
you can specify a different one on the command-line if needed.
|
||||
|
||||
The content of each module (.py file) is taken from wxmodule_template
|
||||
with appropriate substitution of the %name% tokens
|
||||
|
||||
"""
|
||||
|
||||
import os, sys, glob
|
||||
|
||||
wxmodule_template = """
|
||||
\"\"\"Renamer stub: provides a way to drop the wx prefix from wxPython objects.\"\"\"
|
||||
|
||||
__cvsid__ = \"\x24Id: \x24\"
|
||||
__revision__ = \"\x24Revision: \x24\"[11:-2]
|
||||
|
||||
from wx import _rename
|
||||
from wxPython%(prefix)s import %(suffix)s
|
||||
_rename(globals(), %(suffix)s.__dict__, modulename='%(name)s')
|
||||
del %(suffix)s
|
||||
del _rename
|
||||
"""
|
||||
|
||||
wxPython_dir = "../wxPython"
|
||||
|
||||
subpackage_list = ['.',
|
||||
'lib', 'lib/mixins', 'lib/editor', 'lib/colourchooser',
|
||||
'py',
|
||||
'tools', 'tools/XRCed',
|
||||
]
|
||||
|
||||
skip_modules = [ '__init__', '__version__',
|
||||
'wx', 'windows', 'windows2', 'windows3', 'events', 'fonts', 'misc',
|
||||
'misc2', 'gdi', 'mdi', 'controls', 'controls2', 'cmndlgs',
|
||||
'stattool', 'frames', 'image', 'printfw', 'sizers', 'clip_dnd',
|
||||
'filesys', 'streams', 'htmlhelp', 'oglbasic', 'oglshapes',
|
||||
'oglshapes2', 'oglcanvas', 'stc_', 'utils', 'dllwidget_',
|
||||
|
||||
'PyAlaModeTest',
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Check for command-line arg
|
||||
if len(sys.argv) > 1:
|
||||
wxPython_dir = sys.argv[1]
|
||||
|
||||
# check wxPython_dir
|
||||
if not os.path.exists(wxPython_dir) or not os.path.isdir(wxPython_dir):
|
||||
print wxPython_dir, "does not exist or is not a directory!"
|
||||
sys.exit()
|
||||
|
||||
# check current location
|
||||
if os.path.basename(os.getcwd()) <> 'wx':
|
||||
print 'This must be run from inside the target "wx" directory'
|
||||
sys.exit()
|
||||
|
||||
|
||||
# build the modules and subpackages as needed
|
||||
for subdir in subpackage_list:
|
||||
# create subdir if needed
|
||||
if not os.path.exists(subdir):
|
||||
os.mkdir(subdir)
|
||||
|
||||
# create __init__.py if needed
|
||||
if os.path.isdir(subdir):
|
||||
fname = os.path.join(subdir, '__init__.py')
|
||||
if not os.path.exists(fname):
|
||||
f = open(fname, 'w')
|
||||
f.write("# Python package\n")
|
||||
f.close()
|
||||
else:
|
||||
print subdir + 'exists but is not a directory'
|
||||
sys.exit()
|
||||
|
||||
# find the .py files there and make renamer stubs for them here
|
||||
src = os.path.join(wxPython_dir, subdir, "*.py")
|
||||
for srcname in glob.glob(src):
|
||||
suffix = os.path.splitext(os.path.basename(srcname))[0]
|
||||
if suffix in skip_modules:
|
||||
continue
|
||||
prefix = subdir.replace('/', '.')
|
||||
if prefix == '.':
|
||||
prefix = ''
|
||||
name = suffix
|
||||
else:
|
||||
name = prefix + '.' + suffix
|
||||
prefix = '.' + prefix
|
||||
|
||||
fname = os.path.join(subdir, suffix+".py")
|
||||
|
||||
content = wxmodule_template % globals()
|
||||
f = open(fname, 'w')
|
||||
f.write(content)
|
||||
f.close()
|
||||
print fname + ' created'
|
||||
|
||||
|
||||
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user