subtleGradient / tea-for-espresso forked from onecrayon/tea-for-espresso

An Espresso Sugar containing Textmate-style Text Editor Actions, written in Python

This URL has Read+Write access

tea-for-espresso / setup.py
100644 57 lines (46 sloc) 1.565 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Usage: python setup.py py2app
# Dev: python setup.py py2app -A
# Built plugin will show up in ./dist directory
# Install in the standard Sugars directory and relaunch Espresso to run
 
from distutils.core import setup
import py2app
import os
 
# === CONFIG ===
 
# Update this info by hand; defines the required Info.plist elements
info = dict(
    CFBundleVersion = '1.0b16',
    CFBundleIdentifier = 'com.onecrayon.tea.espresso',
    NSHumanReadableCopyright = '(c) 2009 Ian Beck under the MIT license',
)
 
# Sets what directory to crawl for files to include
# Relative to location of setup.py; leave off trailing slash
includes_dir = 'src'
 
# Set the root directory for included files
# Relative to the bundle's Resources folder, so '../../' targets bundle root
includes_target = '../../'
 
# === END CONFIG ===
 
 
# Initialize an empty list so we can use list.append()
includes = []
 
# Walk the includes directory and include all the files
for root, dirs, filenames in os.walk(includes_dir):
    if root is includes_dir:
        final = includes_target
    else:
        final = includes_target + root[len(includes_dir)+1:] + '/'
    files = []
    for file in filenames:
        if (file[0] != '.'):
            files.append(os.path.join(root, file))
    includes.append((final, files))
 
# Here's where the magic happens
setup(
    name='TEA for Espresso',
    plugin = ['main.py'],
    data_files = includes,
    options=dict(py2app=dict(
        extension='.sugar',
        semi_standalone = True,
        site_packages = True,
        plist = info
    )),
)