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/util.py | |
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/util.py')
-rw-r--r-- | base/util.py | 15 |
1 files changed, 14 insertions, 1 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 |