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:
parent
ff0c49bc95
commit
bebaa3ca63
@ -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):
|
||||
|
@ -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])
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user