From 72c6abb1b6a12d7c8defcd24a0d9d652a9f3d52a Mon Sep 17 00:00:00 2001 From: Jack Foltz Date: Sat, 8 Dec 2018 23:46:13 -0500 Subject: [PATCH] Fix package deploy --- lib/deploy.py | 29 +++++++++++++++-------------- lib/package.py | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/deploy.py b/lib/deploy.py index 579426a..7fd3b96 100644 --- a/lib/deploy.py +++ b/lib/deploy.py @@ -17,17 +17,17 @@ def copy(source, dest): else: pass#distutils.file_util.copy_file(source.absolute(), dest.absolute()) -def import_path(paths): +def import_paths(paths, base): if not isinstance(paths, list): paths = [paths] for path in paths: - copy(Path('~') / path, Path('./lain') / path) + copy(Path('~') / Path(base) / path, Path('lain') / Path(base) / path) -def export_path(paths): +def export_paths(paths, base): if not isinstance(paths, list): paths = [paths] for path in paths: - copy(Path('./lain') / path, Path('~') / path) + copy(Path('lain') / Path(base) / path, Path('~') / Path(base) / path) def install(package): if not package.install or not package.source: @@ -46,33 +46,34 @@ def install(package): def export_config(package): if not package.export_config or not package.config: return - export_path(package.config) + export_paths(package.config, '.config') def import_config(package): if not package.config: return - import_path(package.config) + import_paths(package.config, '.config') def run_script(package): if not package.run_script or not package.script: return - print('fish', package.script) - #proc.exec(['fish', package.script.absolute()]) + for script in package.script: + print('fish', script) + #proc.exec(['fish', package.script.absolute()]) def export_units(package): - if not package.export_units or not package.userunits: + if not package.export_units or not package.userunit: return - export_path(package.userunits) + export_paths(package.userunit, '.config/systemd/user') def import_units(package): - if not package.userunits: + if not package.userunit: return - import_path(package.userunits) + import_paths(package.userunit, 'lain/.config/systemd/user') def enable_units(package): - if not package.enable_units or not package.userunits: + if not package.enable_units or not package.userunit: return - for unit in package.userunits: + for unit in package.userunit: print('systemctl --user enable', unit.name) #proc.exec(['systemctl', '--user', 'enable', unit.name]) diff --git a/lib/package.py b/lib/package.py index 4d64b2a..f83ce4c 100644 --- a/lib/package.py +++ b/lib/package.py @@ -57,7 +57,7 @@ class Package: elif self[prop] == 'none': self[prop] = None elif self[prop] != None: - self[prop] = Path(self[prop]) + self[prop] = [Path(self[prop])] elif (Path(basepath) / default_path).is_dir() or (Path(basepath) / default_path).is_file(): self[prop] = [default_path] else: