Commit 0727de5e authored by Yuanle Song's avatar Yuanle Song
Browse files

v3.0.1 remove a warning on pkg_resources usage

use importlib.resources instead. requires py37+
parent 9df88f22
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,6 +43,6 @@ Dependencies for the generated python project:

## License

Copyright © 2014-2019 Yuanle Song <sylecn@gmail.com>
Copyright © 2014-2019,2024 Yuanle Song <sylecn@gmail.com>

This project is licensed under the Apache License 2.0.
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "3.0.0"
(defproject python/lein-template "3.0.1"
  :description "lein template for a python project"
  :url "https://gitlab.emacsos.com/sylecn/python-project-template"
  :license {:name "Apache License 2.0"
+3 −6
Original line number Diff line number Diff line
#!/usr/bin/env python2
#!/usr/bin/env python3
# coding=utf-8

"""
config logger
"""

from __future__ import (absolute_import, division, print_function,
                        unicode_literals, with_statement)

import os.path
import logging

from logging.config import fileConfig
from pkg_resources import resource_filename
from importlib.resources import files


def load_logger_config():
@@ -25,7 +22,7 @@ def load_logger_config():
    """
    logdir = "/var/log/{{name}}/"
    if os.path.exists(logdir):
        fileConfig(resource_filename("{{python-pkg-name}}", "logger.conf"))
        fileConfig(files("{{python-pkg-name}}").joinpath("logger.conf"))
        return

    ENV = os.getenv("ENV", "test")