template: Don't make dir a constant.

This commit is contained in:
Dylan Araps 2017-06-29 19:56:09 +10:00
parent 5e5908a013
commit d9a22726cb
2 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@ Export colors in various formats.
import os import os
import pathlib import pathlib
from pywal.settings import CACHE_DIR, TEMPLATE_DIR from pywal.settings import CACHE_DIR
from pywal import util from pywal import util
@ -30,6 +30,9 @@ def template(colors, input_file, output_dir):
def export_all_templates(colors): def export_all_templates(colors):
"""Export all template files.""" """Export all template files."""
# Add the template dir to module path.
template_dir = os.path.join(os.path.dirname(__file__), "templates")
# Exclude these templates from the loop. # Exclude these templates from the loop.
# The excluded templates need color # The excluded templates need color
# conversion or other intervention. # conversion or other intervention.
@ -44,10 +47,10 @@ def export_all_templates(colors):
# pylint: disable=W0106 # pylint: disable=W0106
[template(colors["colors"], file.path, CACHE_DIR) [template(colors["colors"], file.path, CACHE_DIR)
for file in os.scandir(TEMPLATE_DIR) for file in os.scandir(template_dir)
if file.name not in exclude] if file.name not in exclude]
# Call 'putty' manually since it needs RGB # Call 'putty' manually since it needs RGB
# colors. # colors.
putty_file = TEMPLATE_DIR / pathlib.Path("colors-putty.reg") putty_file = template_dir / pathlib.Path("colors-putty.reg")
template(colors_rgb, putty_file, CACHE_DIR) template(colors_rgb, putty_file, CACHE_DIR)

View File

@ -1,7 +1,6 @@
""" """
Global Constants. Global Constants.
""" """
import os
import pathlib import pathlib
@ -11,4 +10,3 @@ __version__ = "0.2.6"
# Internal variables. # Internal variables.
COLOR_COUNT = 16 COLOR_COUNT = 16
CACHE_DIR = pathlib.Path.home() / ".cache/wal/" CACHE_DIR = pathlib.Path.home() / ".cache/wal/"
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates")