1
0

Merge branch 'master' of github.com:kirsle/.dotfiles

This commit is contained in:
Noah 2016-01-12 14:21:16 -08:00
commit 9b7f037b69

9
setup
View File

@ -6,9 +6,10 @@ Usage: setup [--install]
This will create symlinks in $HOME for every file listed in ./home in this This will create symlinks in $HOME for every file listed in ./home in this
repository. It will NOT delete existing files in $HOME; use the --install repository. It will NOT delete existing files in $HOME; use the --install
option to delete existing files.""" option to delete existing files.
This script should work in any version of Python above v2.5"""
from __future__ import print_function
import sys import sys
import os import os
import os.path import os.path
@ -49,7 +50,7 @@ def crawl(folder):
# Remove the source dir prefix from it to get the path relative # Remove the source dir prefix from it to get the path relative
# to the "./home" folder, then use that for $HOME. # to the "./home" folder, then use that for $HOME.
path = re.sub(r'^{}/'.format(source), '', target) path = re.sub(r'^%s/' % source, '', target)
home = os.path.join(homedir, path) home = os.path.join(homedir, path)
# If the target is a directory, make sure it exists relative to $HOME. # If the target is a directory, make sure it exists relative to $HOME.
@ -82,7 +83,7 @@ def crawl(folder):
os.unlink(home) os.unlink(home)
# Link it. # Link it.
print("Link: {} -> {}".format(home, target)) print("Link: %s -> %s" % (home, target))
os.symlink(target, home) os.symlink(target, home)
crawl(source) crawl(source)