-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
57 lines (44 loc) · 1.56 KB
/
wscript
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
#!/usr/bin/env python
# theoretically allow it to work on multiple operating systems
import os
UNAME = os.uname()[0]
# theoretically allow the user to choose different images at compile time
IMAGE = "disapproval.png"
# blah blah blah
APPNAME = 'disapprove'
VERSION = '1.0'
def options(opt):
opt.tool_options('compiler_c c')
def configure(conf):
conf.check_tool('compiler_c c')
files = {
"Darwin": ["MacOSX/shell-of-disapproval.m"]
}[UNAME]
def build(bld):
# compile obj-c
from waflib import TaskGen
TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.c']
# this is a program i suppose
disapprove = bld.program(source = " ".join(files),
features = "c cprogram",
name = "disapprove",
target = "disapprove")
if UNAME == "Darwin":
path = os.path.join(bld.env["PREFIX"], "share",
"shell-of-disappoval", IMAGE)
disapprove.cflags = ['-DIMAGE_FILE=@"{0}"'.format(path)]
disapprove.framework = 'Cocoa'
# install the LOD image
bld.install_files("${PREFIX}/share/shell-of-disappoval",
"Images/disapproval.png")
# write to ~/.zshrc
func = """
# shell of disapproval goodness
[[ -f {0} ]] && function command_not_found_handler() {{
echo "$1? ಠ_ಠ" &
{0} &
}}""".format(os.path.join(bld.env["PREFIX"], "bin", "disapprove"))
with open(os.path.expanduser("~/.zshrc"), "r") as zshrc:
if func not in zshrc.read():
with open(os.path.expanduser("~/.zshrc"), "a") as zshrc:
zshrc.write(func)