diff options
author | Yaakov M. Nemoy <loupgaroublond@gmail.com> | 2008-10-05 03:36:59 -0400 |
---|---|---|
committer | Yaakov M. Nemoy <loupgaroublond@gmail.com> | 2008-10-05 03:36:59 -0400 |
commit | c304da3ab83ece610fb75cd9b9bedca8f30eaa47 (patch) | |
tree | ade3fb147170f900a88395efae22b4643d57d15e /base | |
parent | 9b80ff4d4def847d9aaeaf3bf88bddcb35ef8ea2 (diff) | |
download | fedora-devshell-c304da3ab83ece610fb75cd9b9bedca8f30eaa47.tar.gz fedora-devshell-c304da3ab83ece610fb75cd9b9bedca8f30eaa47.tar.xz fedora-devshell-c304da3ab83ece610fb75cd9b9bedca8f30eaa47.zip |
Adds some more builder functions
Diffstat (limited to 'base')
-rw-r--r-- | base/util.py | 15 | ||||
-rw-r--r-- | base/vars.py | 2 |
2 files changed, 15 insertions, 2 deletions
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))) |