From c304da3ab83ece610fb75cd9b9bedca8f30eaa47 Mon Sep 17 00:00:00 2001 From: "Yaakov M. Nemoy" Date: Sun, 5 Oct 2008 03:36:59 -0400 Subject: Adds some more builder functions --- base/util.py | 15 ++++++++++++++- base/vars.py | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'base') diff --git a/base/util.py b/base/util.py index ec0a47b..87da8af 100644 --- a/base/util.py +++ b/base/util.py @@ -2,7 +2,10 @@ from __future__ import with_statement from contextlib import contextmanager from os import chdir, getcwd -from shutil import copyfileobj +from os import symlink as sym +from os.path import abspath, lexists +from shutil import copyfileobj, rmtree +from shutil import move as mv from base import log @@ -22,5 +25,15 @@ def copy(src, dst): copyfileobj(src, dst) src.close() dst.close() + +def symlink(src, dst): + if lexists(dst): + remove(dst) + sym(abspath(src), abspath(dst)) + +def move(src, dst): + if lexists(dst): + rmtree(dst) + mv(src, dst) __all__ = ['pwd', 'copy'] \ No newline at end of file diff --git a/base/vars.py b/base/vars.py index 232432b..1e8ec20 100644 --- a/base/vars.py +++ b/base/vars.py @@ -3,7 +3,7 @@ from os.path import join, expanduser __version__ = '0.0.1' __description__ = 'A shell for hacking on the Fedora project' -FEDORA_DIR = join(expanduser('~'), 'code', 'fedora') +FEDORA_DIR = join(expanduser('~'), 'code') DEVSHELL_DIR = join(expanduser('~'), '.devshell') header = lambda x: "%s %s %s" % ('=' * 2, x, '=' * (76 - len(x))) -- cgit