From bc089d523eb72d259146e90fbe480719c55a4c41 Mon Sep 17 00:00:00 2001 From: Jack Foltz Date: Sun, 9 Dec 2018 11:27:18 -0500 Subject: [PATCH] Move fish exec to its own lib file --- lib/deploy.py | 11 +++++------ lib/fish.py | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 lib/fish.py diff --git a/lib/deploy.py b/lib/deploy.py index bf2c6b4..45c0eef 100644 --- a/lib/deploy.py +++ b/lib/deploy.py @@ -1,15 +1,13 @@ -import os import distutils.dir_util import distutils.file_util -import subprocess -from pathlib import Path -from lib.diff import diff from lib.package import Package from lib.path import local_path, deploy_path import lib.proc as proc import lib.pacman as pacman import lib.yay as yay import lib.git as git +from lib.diff import diff +from lib.fish import fish installed_packages = pacman.get_installed() @@ -63,14 +61,15 @@ def diff_config(package): for config in package.config: print(diff(config, deploy_path(config))) + def run_script(package): if not package.run_script or not package.script: return for script in package.script: print('fish', script) - proc.exec(['fish', package.script]) - + print(fish(script)) + def export_units(package): if not package.export_units or not package.userunit: return diff --git a/lib/fish.py b/lib/fish.py new file mode 100644 index 0000000..5140b78 --- /dev/null +++ b/lib/fish.py @@ -0,0 +1,6 @@ +import lib.proc as proc + +def fish(path): + cmd = ['fish', str(path.expanduser())] + subproc = proc.exec(cmd) + return proc.communicate(subproc, cmd)