1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-24 04:22:50 -05:00

Move user expansion to path lib

This commit is contained in:
Jack Foltz 2018-12-09 01:06:47 -05:00
parent ff0c49bc95
commit bebaa3ca63
Signed by: foltik
GPG Key ID: D1F0331758D1F29A
3 changed files with 6 additions and 5 deletions

View File

@ -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):

View File

@ -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])

View File

@ -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()