forked from divad12/khan-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 17
/
.profile.khan
executable file
·98 lines (82 loc) · 3.79 KB
/
.profile.khan
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
################################################################################
# Khan Academy specific .profile
#
# The difference between .bash_profile and .profile is that the latter
# is called for all sh-compatible shells. So we put non-bashisms here
# and bashisms in .bash_profile.
# Add homebrew to path on M1 macs
if [ `uname -m` = "arm64" ]; then
export PATH=/opt/homebrew/bin:$PATH
fi
# Add devtools bins to PATH
# TODO(mroth): rewrite these paths at install time based on user preference
KA_DEVROOT="$HOME/khan/devtools"
export PATH="$KA_DEVROOT/git-workflow/bin:$PATH"
export PATH="$KA_DEVROOT/our-lovely-cli/bin:$PATH"
export PATH="$KA_DEVROOT/ka-clone/bin:$PATH"
export PATH="$KA_DEVROOT/khan-linter/bin:$PATH"
export PATH="$KA_DEVROOT/google-cloud-sdk/bin:$PATH"
export PATH="$KA_DEVROOT/khan-dotfiles/bin:$PATH"
export PATH="$HOME/go/bin:$PATH"
export MANPATH="$KA_DEVROOT/our-lovely-cli/man:$MANPATH"
# Add our go-binaries home to PATH.
# TODO(csilvers): move this back above the devtools ones after we get
# rid of khan-linter.
export PATH="$HOME/khan/webapp/genfiles/go/bin:$PATH"
# A lot of tools place binaries into ~/.local/bin, including pip if you use
# --user (or have an unwritable default site-packages)
export PATH="$HOME/.local/bin:$PATH"
# We are caching a few config files so shells start faster
KA_CONFIG_CACHE_DIR="$HOME/.config/khan/cache/dotfiles"
KA_CPATH_HINT_FILE="$KA_CONFIG_CACHE_DIR/ka-cpath-hint"
BREW_PREFIX_HINT_FILE="$KA_CONFIG_CACHE_DIR/brew-prefix-hint"
# Find xcode /usr/include directory
if which xcrun >/dev/null 2>&1; then
if [ -e "$KA_CPATH_HINT_FILE" ]; then
export CPATH=$(cat "$KA_CPATH_HINT_FILE")
else
export CPATH="$(xcrun --show-sdk-path)/usr/include"
mkdir -p "$KA_CONFIG_CACHE_DIR"
echo "$CPATH" > "$KA_CPATH_HINT_FILE"
fi
fi
if which brew >/dev/null 2>&1; then
if [ -e $BREW_PREFIX_HINT_FILE ]; then
BREW_PREFIX=$(cat $BREW_PREFIX_HINT_FILE)
else
BREW_PREFIX="$(brew --prefix khan/repo/python@2)"
mkdir -p "$KA_CONFIG_CACHE_DIR"
echo $BREW_PREFIX > $BREW_PREFIX_HINT_FILE
fi
fi
# Make sure git (and other apps) prefer 'vim' to 'vi'.
: ${EDITOR:=vim}
# Set a high limit for open file descriptors per shell.
# The default on OS X is 256; we increase it to 1024--the default value of
# `sysctl kern.maxfilesperproc`, which `ulimit -n` must not exceed.
ulimit -S -n 1024
# Mac-specific stuff.
if [ `uname -s` = Darwin ]; then
# Numpy/etc use flags clang doesn't know about. This is only
# needed for mavericks and above.
if ! expr "`sw_vers -productVersion`" : '10\.[0-8]$' >/dev/null && \
! expr "`sw_vers -productVersion`" : '10\.[0-8]\.' >/dev/null; then
CPPFLAGS="-Qunused-arguments $CPPFLAGS"
CFLAGS="-Qunused-arguments $CFLAGS"
# This ARCHFLAGS is needed until we have pyobjc 3.0, according to
# https://bitbucket.org/ronaldoussoren/pyobjc/issue/66/cannot-locate-a-working-compiler-error
ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future $ARCHFLAGS"
export CPPFLAGS CFLAGS ARCHFLAGS
fi
# Link openssl into build flags
export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/openssl/include $CPPFLAGS"
export CFLAGS="-I/usr/local/include -L/usr/local/lib $CFLAGS"
# Ingore some warnings that were being escalated as errors when compiling
# golangci-lint plugins. See DEV-821 for more info.
export CGO_CPPFLAGS="-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-builtin-requires-header $CGO_CPPFLAGS"
# We use the timeout command a lot, but os x calls it `gtimeout`.
alias timeout=gtimeout
fi
# Source the generated profile, if it exists.
[ -f $HOME/.profile-generated.khan ] && source $HOME/.profile-generated.khan