CampGenOnMacOSX
From Wesnoth
Contents |
CampGen on Mac OS X
This page describes how I got CampGen to work. It was satisfying. Since I helped prototype it, I actually wanted to be able to run it. The instructions describe how I did things, which means if your system is like mine they should work. I haven't made any weird modifications to OS X, so I assume they'll work for you, but you never know. You will need the admin password to your computer to make the changes in these instructions.
What to download
Download the package by Iwa and the wxpython 2.6 installer
http://download.gna.org/campgen/campgen-0.25-OSX.zip
http://prdownloads.sourceforge.net/wxpython/wxPython2.6-osx-unicode-2.6.2.1-macosx10.3-py2.3.dmg
(note: likely, you need a different version than the above, see here: http://sourceforge.net/project/showfiles.php?group_id=10718&package_id=10559)
wxpython
The main problem is getting wxpython to work. OS 10.4 comes with wxpython 2.5.3 and you need 2.6.1 or later. On Mac os x 4.6 and wxpython 2.6.3, the following instructions do not work. If you are 10.4.6, go to next section
- Download the files above
- Install wxpython 2.6.x with the installer you just downloaded
- Try running campgen. If it works, stop. Otherwise, continue
- Figure out where wxpython 2.5.3 and 2.6.2 are installed
- This is the tricky part. The problem is the installer doesn't put wxpython 2.6 in the same place Mac OS X is configured to look for wxpython.
- Wxpython 2.5.3 comes installed in /System/Library/Frameworks/Python.framework/Versions/2.3/Extras/lib/python
- That is where the system looks when you start CampGen
- The wxpython 2.6.2 installer puts it in /Library/Python/2.3
- In that folder you should see a folder called wx-2.6-mac-unicode
- Copy the wxpython-2.6 folder to the correct location
- Copy (not move) the entire wx folder located in /Library/Python/2.3 to /System/Library/Frameworks/Python.framework/Versions/2.3/Extras/lib/python/
- You might need the admin password to make the change
- Feel guilty
- This is the super-hacky way to do it.
- I think the best way would be to get the wxpython installer to put 2.6 in the correct place.
- The next best way would be to tell python to look for wxpython wherever the installer put it
- What you just did (copy the folder over), might be the worst way to do it. However, IT WORKS, and I don't know how else to get it to work.
- If you know a better way, just change these instructions
- If you have problems with the installation of wxpython 2.6
- The wxpython 2.6 folder is temporarily located at [1] until fall of 2006.
- Download this file (11.5 MB) and unzip it
- Drag the entire folder to /System/Library/Frameworks/Python.framework/Versions/2.3/Extras/lib/python/
wxpython 2.6.3 for X.4.6 [Tested on mactel]
- Download the files above
- Install wxpython 2.6.3 from wxpython website
- Try running campgen. If it works, stop. Otherwise, continue
- OSX does not look for wxpython in the 2.5.3 folder anymore, but in library/python, while wxpython 2.6.3+ is not installed in library/python any more, but in the old 2.5.3 folder. This is the problem.
- Copy (not move) the entire site-packages folder located in [if its not there, go in each of the folders to find it, its called site-packages] /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python/2.5
to /library/python/2.3
- You might need the admin password to make the change
The "More" Correct Way to Fix Getting CampGen on OS X.
I looked at what exactly is happening with the wxPython. The issue is the default distribution for python is to be placed in the /System/Library/Frameworks/... directory and /usr/bin. However, Apple really doesn't want people changing stuff in the /System or /usr/bin directories. Thus, there is a /Library/Frameworks/... and /usr/local/bin/ directories where non-Apple things are supposed to be added.
After you install Python 2.4 or 2.5, you will see them in the /Library/Frameworks/Python.frameworks/.... directory. Additionally, that is where wxPython 2.8 is happy to be installed (I assume 2.6 and 2.7 also, but I don't know for sure). It also installs the pythonw executable in /usr/local/bin/
The problem comes in when you run python. The normal way to run python is from the command prompt. Done that way, it will use your default path (which was set correctly when you installed python). Thus, it will run the version which was installed with python 2.5 in /usr/local/bin/pythonw.
However, the CampGen script uses the #!/bin/sh - for a shell script. This by-passes the path variable set by the python installation. It forces the system to use the standard borne shell path which doesn't normally include the /usr/local/bin. As a result, it will run it from /usr/bin/pythonw, which is the old version of python (as well as the old version of wxPython.)
The easist fix it to change a single line in the CampGen.app/Contents/MacOS/CampGen
from
- exec pythonw ./campgen.pyw
to
- exec /usr/local/bin/pythonw ./campgen.pyw
This will force the "correct" version of python to run. This is much better than mucking with the /System directory and hacking stuff into non-standard locations (shudder...)
I hope this helps. Let me know if you have any additional questions. I don't know who is the current keeper of CampGen who could make this change.
Eric (ad.niska@gmail.com)
