From d98be353ecd5deff97804312ec798fb227adfbc1 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 9 Aug 2017 11:22:51 +1000 Subject: general: Make pywal compatible with python 3.5 --- pywal/export.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pywal/export.py') diff --git a/pywal/export.py b/pywal/export.py index 748e3a9..d621672 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -45,7 +45,7 @@ def every(colors, output_dir=CACHE_DIR): all_colors = flatten_colors(colors) output_dir = pathlib.Path(output_dir) - for file in os.scandir(MODULE_DIR / "templates"): + for file in os.scandir(str(MODULE_DIR / "templates")): template(all_colors, file.path, output_dir / file.name) print("export: Exported all files.") @@ -61,6 +61,6 @@ def color(colors, export_type, output_file=None): if template_file.is_file(): template(all_colors, template_file, output_file) - print(f"export: Exported {export_type}.") + print("export: Exported %s." % export_type) else: - print(f"[!] warning: template '{export_type}' doesn't exist.") + print("warning: template '%s' doesn't exist." % export_type) -- cgit v1.2.3 From 05c271c3a7faf0e31c28df4a7743c8ce4369c670 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 10 Aug 2017 09:17:11 +1000 Subject: general: Remove all pathlib usage --- pywal/export.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'pywal/export.py') diff --git a/pywal/export.py b/pywal/export.py index d621672..d2db143 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -2,7 +2,6 @@ Export colors in various formats. """ import os -import pathlib from .settings import CACHE_DIR, MODULE_DIR from . import util @@ -43,10 +42,10 @@ def get_export_type(export_type): def every(colors, output_dir=CACHE_DIR): """Export all template files.""" all_colors = flatten_colors(colors) - output_dir = pathlib.Path(output_dir) + template_dir = os.path.join(MODULE_DIR, "templates") - for file in os.scandir(str(MODULE_DIR / "templates")): - template(all_colors, file.path, output_dir / file.name) + for file in os.scandir(template_dir): + template(all_colors, file.path, os.path.join(output_dir, file.name)) print("export: Exported all files.") @@ -56,10 +55,10 @@ def color(colors, export_type, output_file=None): all_colors = flatten_colors(colors) template_name = get_export_type(export_type) - template_file = MODULE_DIR / "templates" / template_name - output_file = output_file or CACHE_DIR / template_name + template_file = os.path.join(MODULE_DIR, "templates", template_name) + output_file = output_file or os.path.join(CACHE_DIR, template_name) - if template_file.is_file(): + if os.path.isfile(template_file): template(all_colors, template_file, output_file) print("export: Exported %s." % export_type) else: -- cgit v1.2.3