mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-25 00:53:59 +00:00
Add build scripts fro win and osx, add patch_version command to setup.py
This commit is contained in:
22
scripts/package-osx.sh
Normal file
22
scripts/package-osx.sh
Normal file
@@ -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
|
||||
24
scripts/package-win.bat
Normal file
24
scripts/package-win.bat
Normal file
@@ -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
|
||||
28
setup.py
28
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 @@ class picard_update_constants(Command):
|
||||
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 @@ args2 = {
|
||||
'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'],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user