From bebaa3ca632f1928e453e314303ada36086c2efd Mon Sep 17 00:00:00 2001 From: Jack Foltz Date: Sun, 9 Dec 2018 01:06:47 -0500 Subject: [PATCH] Move user expansion to path lib --- lib/deploy.py | 7 ++++--- lib/diff.py | 2 +- lib/path.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/deploy.py b/lib/deploy.py index 52dbdee..bf2c6b4 100644 --- a/lib/deploy.py +++ b/lib/deploy.py @@ -1,5 +1,6 @@ import os -import distutils +import distutils.dir_util +import distutils.file_util import subprocess from pathlib import Path from lib.diff import diff @@ -15,9 +16,9 @@ installed_packages = pacman.get_installed() def copy(source, dest): print(source, '->', dest) if source.is_dir(): - distutils.dir_util.copy_tree(source.absolute(), dest.absolute()) + distutils.dir_util.copy_tree(str(source), str(dest)) else: - distutils.file_util.copy_file(source.absolute(), dest.absolute()) + distutils.file_util.copy_file(str(source), str(dest)) def import_paths(paths, base): if not isinstance(paths, list): diff --git a/lib/diff.py b/lib/diff.py index f44b6fd..7e4d9d4 100644 --- a/lib/diff.py +++ b/lib/diff.py @@ -1,7 +1,7 @@ import lib.proc as proc def diff(file1, file2): - cmd = ['diff', '-r', str(file1.resolve()), str(file2.expanduser())] + cmd = ['diff', '-r', str(file1), str(file2)] subproc = proc.exec(cmd) delta = proc.communicate(subproc, cmd, [0, 1]) diff --git a/lib/path.py b/lib/path.py index 23213ee..891c15e 100644 --- a/lib/path.py +++ b/lib/path.py @@ -10,4 +10,4 @@ def deploy_path(path): start = path.parts[0] target = path.parts[1:] if start == 'lain': - return Path('~') / Path(*target) + return (Path('~') / Path(*target)).expanduser()