Repository navigation
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·74 lines (60 loc) · 1.97 KB
/
Copy pathinstall.py
File metadata and controls
executable file
·74 lines (60 loc) · 1.97 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
"""
Install script for dotfiles:
* symlinks a bunch of files to ~
* installs homebrew and pip dependencies
"""
import os
import subprocess
# Assume this script is located the root of the dotfiles repo:
DOTFILES_ROOT = os.path.dirname(os.path.abspath(__file__))
SYMLINK_MAP = {
"~/.claude/skills": ".agents/skills",
"~/.claude/CLAUDE.md": ".agents/AGENTS.md",
"~/.gitconfig": "gitconfig",
"~/.gitignore_global": "gitignore_global",
"~/.hammerspoon": "hammerspoon",
"~/.psqlrc": "psqlrc",
"~/.config/nvim": "vim",
"~/.pg_format": "pg_format.conf",
"~/.ripgreprc": "ripgreprc",
"~/.af-scripts": "af-scripts",
"~/.vim": "vim",
"~/.vimrc": "vim/init.vim",
"~/.tmux.conf": "tmux.conf",
"~/.tigrc": "tigrc",
"~/.weechat": "weechat",
"~/.config/alacritty/alacritty.toml": "alacritty.toml",
"~/.zshrc": "zshrc",
}
# Output a generic header for a section of the install script:
def section(name):
print("\n" + name)
print("=" * 40)
def shell_out(cmd):
print(subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read())
# TODO: skip this section if not running macOS
section("Installing homebrew dependencies")
shell_out("./brew_installs.sh")
section("Updating submodules")
shell_out("git submodule update --init && echo Submodules updated!")
section("Installing pip dependencies")
shell_out("pip3 install --user pynvim")
section("Symlinking config files to ~")
linked = []
skipped = []
for dest, source in SYMLINK_MAP.items():
source = os.path.join(DOTFILES_ROOT, source)
dest = os.path.abspath(os.path.expanduser(dest))
if os.path.exists(dest):
skipped.append([source, dest])
else:
linked.append([source, dest])
os.symlink(source, dest)
skipped.sort()
linked.sort()
for source, dest in skipped:
print("! skipped %-30s (file already exists)" % dest)
for source, dest in linked:
print("symlinked %-25s ---> %s" % (dest, source))
print("Done!")