Commit 98b36526 authored by Jamie Hall's avatar Jamie Hall
Browse files

Added new resources files for MacOS build server

parent 9f877e9b
# coding=utf-8
import sys
import os
if sys.platform.startswith('darwin'):
from setuptools import setup
build_name = os.environ['BUILD_NAME']
rev_number = os.environ['REV_NUMBER']
version = build_name + " v" + rev_number
APP = ['Scripts/mdanse_gui']
PLIST = {
u'CFBundleName': u'MDANSE',
u'CFBundleShortVersionString': build_name,
u'CFBundleVersion': version,
u'CFBundleIdentifier': u'eu.ill.MDANSE-'+build_name,
u'LSMinimumSystemVersion': u'10.6',
u'LSApplicationCategoryType': u'public.app-category.science',
u'CFBundleDocumentTypes': [
{
u'CFBundleTypeRole': u'Viewer',
u'LSItemContentTypes': [u'eu.ill.MDANSE'],
u'LSHandlerRank': u'Owner',
}
]
}
OPTIONS = {
'argv_emulation': True,
'iconfile': u'MDANSE/GUI/Icons/mdanse.icns',
'includes': [],
'excludes': 'PyQt4',
'matplotlib_backends': '-',
'optimize': '1',
'plist': PLIST,
'bdist_base': 'scripts/darwin/build',
'dist_dir': 'scripts/darwin/dist',
'graph': False,
'xref': False
}
setup(
name="MDANSE",
app=APP,
options={'py2app': OPTIONS},
setup_requires=['py2app']
)
else:
print 'No build_app implementation for your system.'
#!/bin/bash
# This script is to package the nMolDyn package for Mac OS X
#############################
# CONFIGURATION
#############################
## Add some colors
VERT="\\033[1;32m"
NORMAL="\\033[0;39m"
ROUGE="\\033[1;31m"
ROSE="\\033[1;35m"
BLEU="\\033[1;34m"
BLANC="\\033[0;02m"
BLANCLAIR="\\033[1;08m"
JAUNE="\\033[1;33m"
CYAN="\\033[1;36m"
##Select the build target
BUILD_TARGET=darwin
##Do we need to create the final archive
ARCHIVE_FOR_DISTRIBUTION=1
##Which version name are we appending to the final archive
export BUILD_NAME=1.0
TARGET_DIR=MDANSE-${BUILD_NAME}-${BUILD_TARGET}
#############################
# Darwin
#############################
if [ "$BUILD_TARGET" = "darwin" ]; then
cd ../..
# take the latest version of nmoldyn available on the forge
echo -e "$BLEU""Getting last MDANSE revision" "$NORMAL"
# Get revision number from git (without trailing newline)
REV_NUMBER=$(git rev-list --count HEAD)
echo "$BLEU""Revision number is -->${REV_NUMBER}<--" "$NORMAL"
# Add current revision number to python source code (will appear in "About..." dialog)
# see http://stackoverflow.com/questions/7648328/getting-sed-error
sed -i "" "s/__revision__ = \"undefined\"/__revision__ = \"${REV_NUMBER}\"/" MDANSE/__pkginfo__.py
# Now build last version and install it in our homebrewed python
echo -e "$BLEU""Building MDANSE" "$NORMAL"
/usr/local/bin/python setup.py build
/usr/local/bin/python setup.py install
TARGET_DIR=MDANSE-${BUILD_NAME}-b${REV_NUMBER}-MacOS
echo -e "$BLEU""Packaging MDANSE" "$NORMAL"
rm -rf scripts/darwin/build
rm -rf scripts/darwin/dist
# debug option for py2app, if needed
export DISTUTILS_DEBUG=0
/usr/local/bin/python build_mdanse.py py2app
rc=$?
if [[ $rc != 0 ]]; then
echo -e "$ROUGE""Cannot build app." "$NORMAL"
exit 1
fi
# Do some manual cleanup, e.g.
# matplotlib/tests ==> 45.2 Mb
rm -rf scripts/darwin/dist/MDANSE.app/Contents/Resources/lib/python2.7/matplotlib/tests
rm -rf scripts/darwin/dist/MDANSE.app/Contents/Resources/mpl-data/sample_data
#Add MDANSE version file (should read the version from the bundle with pyobjc, but will figure that out later)
echo "$BUILD_NAME b$REV_NUMBER"> scripts/darwin/dist/MDANSE.app/Contents/Resources/version
cd scripts/darwin
# Archive app
echo -e "$BLEU" "Archiving ${TARGET_DIR}.tar.gz ..." "$NORMAL"
cd dist
gnutar cfp - MDANSE.app | gzip --best -c > ../../../${TARGET_DIR}.tar.gz
cd ..
# Reminder on pre-configured DmgTemplate
#>hdiutil convert DmgTemplateCompressed.dmg -format UDRW -o DmgTemplateCompressedRW.dmg
#>hdiutil convert DmgTemplateCompressedRW.dmg -format UDZO -o DmgTemplateCompressed.dmg
TODAY=$(date +"%m-%d-%y-%Hh%Mm%S")
# Create sparse image for distribution
echo -e "$BLEU" "Creating new MDANSE.dmg.sparseimage ..." "$NORMAL"
hdiutil detach /Volumes/MDANSE/ -quiet
# Keep previous build, in case of
mv -f MDANSE.dmg.sparseimage MDANSE.dmg.sparseimage.${TODAY}.old
hdiutil convert DmgTemplateCompressed.dmg -format UDSP -o MDANSE.dmg.sparseimage
hdiutil resize -size 1024m MDANSE.dmg.sparseimage
hdiutil attach nMolDyn.dmg.sparseimage
echo -e "$BLEU" "Copying MDANSE.app on dmg ..." "$NORMAL"
cp -a dist/MDANSE.app /Volumes/MDANSE/MDANSE/
echo -e "$BLEU" "Copying UserData/ on dmg ..." "$NORMAL"
cp -R ../../MDANSE/UserData/ /Volumes/MDANSE/MDANSE/
# Reset Custom icon on MDANSE folder
SetFile -a C /Volumes/MDANSE/MDANSE/
hdiutil detach /Volumes/MDANSE
hdiutil convert MDANSE.dmg.sparseimage -format UDZO -imagekey zlib-level=9 -ov -o ../../${TARGET_DIR}.dmg
echo -e "$VERT" "Done." "$NORMAL"
exit
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment