gitcmds: Fix merge_message() when FETCH_HEAD doesn't exist
[git-cola.git] / darwin / py2app-setup.py
blobb848b4de979d0d3972a89aae37206e8ce545b8c6
1 #!/usr/bin/env python
2 import os
3 import sys
4 import glob
5 import shutil
6 import platform
8 # Find the root of the source tree
9 sourcedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10 sys.path.insert(0, sourcedir)
12 from setup import cola_data_files
13 import setuptools
15 # Copy bin/git-cola to darwin/git-cola
16 src = os.path.join(sourcedir, 'bin', 'git-cola')
17 dst = os.path.join(sourcedir, 'darwin', 'git-cola.py')
18 shutil.copy(src, dst)
20 # About argv_inject:
21 # When someone drags a folder onto git-cola.app we need
22 # to add '--repo' before the path. Unfortunately, py2app
23 # does this unconditionally, even when there are no
24 # arguments to process.
25 try:
26 prefer_ppc = platform.processor() == 'powerpc'
27 setuptools.setup(app=['darwin/git-cola.py'],
28 data_files=cola_data_files(),
29 options={'py2app': {'argv_emulation': True,
30 'argv_inject': '--repo',
31 'prefer_ppc': prefer_ppc,
32 'iconfile': 'darwin/git-cola.icns',
33 'includes': ['sip', 'PyQt4._qt']}},
34 setup_requires=['py2app'])
35 finally:
36 # Remove the temporary file
37 os.remove(dst)
39 # Copy our custom __boot__.py for handling --repo
40 bootsrc = os.path.join(sourcedir, 'darwin', '__boot__.py')
41 bootdst = os.path.join(sourcedir, 'dist', 'git-cola.app',
42 'Contents', 'Resources', '__boot__.py')
43 shutil.copy(bootsrc, bootdst)