User Tools

Site Tools


proj:macdevold

Home

Project

Libraries Required

aggelopoulos@gmail.com happy to help test Mac versions of modules e.g. export_output.py

Working:

Installable but not yet working properly:

  • Pdftk http://www.pdflabs.com/docs/install-pdftk/ - Malformed → Standard PDF. Even pdftk –version fails with an error about library not loaded. sid.steward@pdflabs.com has made a new release but still a problem on Leopard.

Not installable:

Preparation

  • libtool libtool wkhtmltopdf -o wkhtmltopdf.dylib
  • Homebrew [Not needed to get wkhtmltopdf if in the fortunate position of being able to use a pre-prepared binary] http://mxcl.github.com/homebrew/ Bet https://github.com/mxcl/homebrew/tarball/master then extract and copy to /usr/local/bin (cp -R src dest). cd into directory with brew then brew install boost
    Used brew to install boost (needed by PythonMagick) and wkhtmltopdf (the dmg at wkhtmltopdf downloads failed with a message about 'You can't open this application “wkhtmltopdf” because it is not supported on this architecture'.

Deb Packaging Notes

Old Approach

  • debug = False etc as usual
  • Run /home/g/projects/SOFA/0 KEEP pre_OSX_packaging
  • Open macpackager in VirtualBox
  • Delete existing macmaker folder on Desktop
  • From ubuntu > grantshare copy fresh macmaker onto Desktop

Platypus

  • Open Platypus with profile of SOFA Statistics.platypus
    • check version number e.g. 1.0.6
    • Save bundle to Profiles folder (/Users/g/Library/Application support/Platypus/Profiles).
    • Click Create to make fresh app bundle (containing freshest start.py). Create to /Applications (mactest/Applications).
    • Extra details
      • Script path should be from macmaker i.e. /Users/g/Desktop/macmaker/sofa.main/start.py
      • Leave “Remains running after initial execution” unticked.
      • Script Type - Other
        • /Library/Frameworks/
        • Parameters - /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 yourScript
    • Close Platypus

Iceberg

  • Open sofa_app project in Iceberg
    • Check version and short version
  • Build to make sure contains latest app bundle and thus latest start.py
  • Open sofa_pkg project in Iceberg
    • NB if new files, add them to this
  • Build to make sure package contains latest SOFA scripts from macmaker
  • Open sofastatistics project in Iceberg
    • Update version and short version
    • Run build and run process
  • Close Iceberg

Quick Local Test

Open SOFA Statistics from Go>Applications>SOFA Statistics

Make DMG

Script

  # http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html
  # http://www.myersdaily.org/joseph/notes/macosx2/man/hdiutil.1.html
  # http://ss64.com/osx/cp.html
  echo "Enter version number e.g. 1.0.7:"
  read version
  dmg2make="/Users/g/Desktop/sofastats-${version}_for_mac.dmg" # (no spaces around =)
  rm -f "$dmg2make"
  rm -rf "/Users/g/Desktop/sofastatistics/sofastatistics.mpkg"
  cp -R "/Users/g/sofa_mpkg/build/sofastatistics.mpkg" "/Users/g/Desktop/sofastatistics/"
  # ov - overwrite if already there
  hdiutil -verbose create "$dmg2make" -srcfolder "/Users/g/Desktop/sofastatistics" -ov -megabytes 85 -volname "SOFA Statistics"
  echo "FINISHED" 

Manual Steps

  • Copy g/sofa_mpkg/build/sofastatistics.mpkg to desktop
  • Empty sofastatistics folder of old sofastatistics.mpkg and put in new one
  • Right click (or CTRL-Click) the folder and select “Get Info” and note the size of its contents.
  • Open Disk Utility (Applications > Utilities > Disk Utility)
  • Click the “New Image” icon to create a new disk image.
    • Name the image sofastats-1.0.1_for_mac.dmg (or whatever version)
    • Set Volume Name to SOFA Statistics
    • Select a size adequate for the size of your folder you created in Step 2. If 71MB may need 85MB. Set the encryption to “none” and Format to “read/write disk image.”.
  • Copy the sofastatistics folder into the newly mounted disk image.
  • Unmount the Disk Image by right clicking and selecting to eject it.
  • On macpackager, overwrite DMG in grantshare
  • Close macpackager

Iceberg Meta Packaging

Iceberg Packager for OS X

Handles pkgs and file transfers.

Use same licence file as for Deb

Transfer main sofa scripts under /Library/sofa

Remember subfolders

  • boomslang
  • dbe_plugins (forget 2 MS ones)
  • images

Also the following subfolders ready for copying for local user:

  • css
  • reports
  • _internal
  • vdts
  • projs

Install following packages:

  • python-2.6.5-macosx10.3-2010-03-24.dmg
  • wxPython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg
  • matplotlib-0.99.1.1-py2.6-macosx10.5.dmg
  • numpy-1.4.1-py2.6-python.org.dmg

Install sofastatistics.app into /Applications (i.e. make an icon)

NB to enable users to opt out of certain parts of the instalation - e.g. skip Python 2.6.5 because they already have 2.6.3 - must have at least one package which is Unselected. If all packages are selected, the user is assumed to want all of them and gets no choice to have a custom install!

Platypus App Bundling

  • Use explicit path to Python 2.6 - /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
  • The starter script (/Library/sofa/start.py) needs to add /Library/sofa to sys.path otherwise it won't find its fellow modules e.g. my_globals.py
  • Select None for Output
  • Untick leaving application running at end (otherwise Python closes but a useless SOFA icon stays running in the Dock).

Making Icon Bundle

  • Make series of TIFFs with no compression and transparency ticked
  • 16x, 32x, 128x, 256x
  • Under macpackager > Developer > … Icon Maker, create icon set, save config, and Export as icns file.
  • The icns file will be used in platypus (right click on image to get menu item for selecting an icns file).

Virtualising Mac OS X

Need VirtualBox 3.2 beta 2

Need iDeneb 1.6 10.5.8 Lite Edition

Do not use efi, or it will not boot into the newly installed virtual HDD

Leave iDeneb connected as the CD so it uses that to boot. Necessary, even though booting onto virtual HDD.

Need at least 15GB space. 30GB seems a safe bet with room for databases etc.

Required packages

Python

python-2.6.5-macosx10.3-2010-03-24.dmg

wxPython

wxPython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg

MatPlotLib

matplotlib-0.99.1.1-py2.6-macosx10.5.dmg

Numpy

numpy-1.4.1-py2.6-python.org.dmg

MySQL

PyMySQL is much easier to install in OS X than MySQLdb.

In my virtualised test installation the user is “mysql” and there is a blank password.

From the terminal it is possible to test if mysql is running:

/usr/local/mysql/bin/mysql

NB may want to install MySQL startup as well as MySQL itself.

PyMySQL

Presumably you have already installed MySQL and, optionally, the MySQL utility which makes MySQL run automatically on startup.

PyMySQL is the simple library you need to install that lets SOFA Statistics connect to MySQL: http://code.google.com/p/pymysql/downloads/detail?name=PyMySQL-0.4.tar.gz&can=2&q=

Open the downloaded file onto your Desktop

Open terminal (under Applications>Utilities)

cd Desktop/PyMySQL-0.4

python2.6 setup.py install

(NB python2.6 so the package is installed to the version of Python that SOFA Statistics us)

Open SOFA and configure your connection to MySQL as per http://www.sofastatistics.com/wiki/doku.php?id=help:projects

Success?

NB to test if MySQL is running you can run the following command in the terminal:

/usr/local/mysql/bin/mysql Home

Project

MySQLdb

NB I have already installed Python 2.6 from the python.org package python-2.6.5-macosx10.3-2010-03-24.dmg. The 10.3 means it will work with everything 10.3 and above. My version of Leopard is 10.5.8.

Download setuptools-0.6c11-py2.6.egg from here: http://pypi.python.org/pypi/setuptools#downloads. Then, in the terminal:

  • cd Desktop
  • sh setuptools-0.6c9-py2.4.egg

If you don't have gcc and you are running Leopard, install xcode313_2736_developerdvd.dmg. If you are running Snow Leopard, there is a newer version of Xcode to use, but that is easy to find. This step may require registration with Apple. See http://adcdownload.apple.com/Developer_Tools/xcode_3.1.3_developer_tools/xcode313_2736_developerdvd.dmg.

Must have a version of MySQL installed. I used mysql-5.1.47-osx10.5-x86.dmg. If not installed, then setup.py step for MySQLdb will not succeed.

Download MySQL-python-1.2.3c1.tar.gz from here: https://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download

Extract on desktop. Do this by opening with … Archive utility.

Then open the folder it created on your desktop - MySQL-python-1.2.3c1. Edit setup_posix.py using IDLE (1) so mysql_config.path = “/usr/local/mysql/bin/mysql_config” not just “mysql_config”. There is another way to do this involving PATH and env etc but this is pretty simple. 1) Set preferences of IDLE to 14px otherwise it is unbearably ugly and spoils the OS X experience ;-)

In the terminal:

  • cd Desktop/MySQL-python-1.2.3c1
  • python setup.py clean (not much point - if first time, nothing to clean; if have to redo, need to completely remove the build folder anyway e.g. from the extracted MySQL folder: rm -rf build)
  • ARCHFLAGS='-arch i386' python setup.py build

(see http://trentmick.blogspot.com/2009/05/how-to-install-mysql-python-123c1-on_3622.html)

NB if you mess it up, use rm -rf build to get a proper clean start. The setup.py clean approach is not enough.

sudo python setup.py install

Test by opening IDLE, and typing in import MySQLdb. NB case matters - import mysqldb won't work, nor should it.

PostgreSQL

postgresql-8.4.4-1-osx.dmg

If not installed, then setup.py step for postgreSQL will not succeed.

Pre-installation Memory Config

  • sudo pico /etc/sysctl.conf

add/edit 5 lines to set memory correctly e.g.

kern.sysv.shmmax=16777216
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=8
kern.sysv.shmall=32768

See http://www.postgresql.org/docs/8.2/static/kernel-resources.html

shmall is measured in pages. Multiply by 4096 and check that is no less than what is allocated to max.

Actual installation

NB may take several minutes before installer will properly display dialog. Wait at least 10 mins.

Install latest tar.gz from http://initd.org/psycopg/ e.g. http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.2.tar.gz

May have to hardwire location of pg_config in broadly similar fashion to old instructions below. See if any errors which give a clue.

Old instructions (which should work given pgdb is supported as a fallback if psycopg can't import):

In PyGreSQL-4.0.tgz (you can get a copy from ftp://ftp.pygresql.org/pub/distrib/PyGreSQL.tgz - see http://www.pygresql.org/readme.html#where-to-get)

f = os.popen(“pg_config –%s” % s) should be … “/Library/PostgreSQL/8.4/bin/pg_config …”

Eclipse and PyDev

eclipse-SDK-3.5.2-macosx-carbon.tar.gz

extract and then copy under /Library folder

pydev - http://pydev.org/updates (need to add in Help>Install New Software)

project interpreter - /Library/Frameworks/Python.framework/Versions/2.6/bin/Python

SOFA Scripts etc

When transferring sofa, and sofa.main, set permissions by cd into folder containing both and

  • sudo chmod -R 777 sofa
  • sudo chmod -R 777 sofa.main

Put sofa.main on Desktop.

Put sofa in home folder (not on desktop).

Delete proj_file_customised.txt

Storage

Packages Backup

Ensure mime.conf for dokuwiki has the following line:

packproj text/xml

Find the following package files in /Users/g/ under sofa_app, sofa_mpkg, and sofa_pkg. Add proj extension.

sofa_app.packproj

sofa_mpkg.packproj

sofa_pkg.packproj

sofastatistics.packproj

proj/macdevold.txt · Last modified: 2014/12/28 13:44 by admin