diff --git a/scripts/package-osx.sh b/scripts/package-osx.sh new file mode 100644 index 0000000000..35f5557a3e --- /dev/null +++ b/scripts/package-osx.sh @@ -0,0 +1,22 @@ +cd deps +tar xf chromaprint-fpcalc-*.tar.gz +rm chromaprint-fpcalc-*.tar.gz +export PATH=`pwd`/`ls | grep chromaprint-fpcalc`:$PATH +cd .. + +python2.7 setup.py patch_version --platform=osx +version=`python -c 'import picard; print picard.__version__'` + +. e/bin/activate + +rm -rf dist build locale +python2.7 setup.py clean +python2.7 setup.py build_ext -i +python2.7 setup.py build_locales -i +python2.7 setup.py py2app + +cd dist +ditto -rsrc --arch x86_64 'MusicBrainz Picard.app' 'MusicBrainz Picard.tmp' +rm -r 'MusicBrainz Picard.app' +mv 'MusicBrainz Picard.tmp' 'MusicBrainz Picard.app' +hdiutil create -volname "MusicBrainz Picard $version" -srcfolder 'MusicBrainz Picard.app' -ov -format UDBZ MusicBrainz-Picard-$version.dmg diff --git a/scripts/package-win.bat b/scripts/package-win.bat new file mode 100644 index 0000000000..7f63e69fa4 --- /dev/null +++ b/scripts/package-win.bat @@ -0,0 +1,24 @@ +set PATH=%PATH%;%WORKSPACE%;C:\MinGW\bin;C:\Python27;C:\Python27\Scripts;"C:\Program Files\7-Zip" +call "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat" + +del installer\*.exe + +copy /Y "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcr90.dll" . +copy /Y "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcp90.dll" . + +7z e -odeps deps\chromaprint-fpcalc-*.zip +copy /Y deps\fpcalc.exe . + +REM virtualenv --system-site-packages e +set PATH=%WORKSPACE%\e\scripts;%PATH% + +pip install -U discid +pip install -U mutagen + +python setup.py patch_version --platform=win + +rmdir /S /Q dist +python setup.py clean +python setup.py build_ext -i +python setup.py build_locales -i +python setup.py bdist_nsis diff --git a/setup.py b/setup.py index f6751f3890..89ba8f2f80 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import datetime import glob import os import re @@ -535,6 +536,32 @@ def write_utf8(s, **kwargs): len(attributes))) +class picard_patch_version(Command): + description = "Update PICARD_BUILD_VERSION_STR for daily builds" + user_options = [ + ('platform=', 'p', "platform for the build version, ie. osx or win"), + ] + + def initialize_options(self): + self.platform = 'unknown' + + def finalize_options(self): + pass + + def run(self): + self.patch_version('picard/__init__.py') + + def patch_version(self, filename): + regex = re.compile(r'^PICARD_BUILD_VERSION_STR\s*=.*$', re.MULTILINE) + with open(filename, 'r+b') as f: + source = f.read() + build = self.platform + '_' + datetime.datetime.utcnow().strftime('%Y%m%d%H%M%S') + patched_source = regex.sub('PICARD_BUILD_VERSION_STR = "%s"' % build, source) + f.seek(0) + f.write(patched_source) + f.truncate() + + def cflags_to_include_dirs(cflags): cflags = cflags.split() include_dirs = [] @@ -583,6 +610,7 @@ def _picard_get_locale_files(): 'update_constants': picard_update_constants, 'get_po_files': picard_get_po_files, 'regen_pot_file': picard_regen_pot_file, + 'patch_version': picard_patch_version, }, 'scripts': ['scripts/picard'], }