mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Initial pass of removing Python 2 support
This commit removes Six as a dependency for Pelican, replacing the relevant aliases with the proper Python 3 imports. It also removes references to Python 2 logic that did not require Six.
This commit is contained in:
parent
ae73d06301
commit
1e0e541b57
43 changed files with 126 additions and 459 deletions
|
|
@ -1,24 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function, unicode_literals, with_statement
|
||||
|
||||
import logging
|
||||
import os
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from feedgenerator import Atom1Feed, Rss201rev2Feed, get_tag_uri
|
||||
|
||||
from jinja2 import Markup
|
||||
|
||||
import six
|
||||
from six.moves.urllib.parse import urljoin
|
||||
|
||||
from pelican import signals
|
||||
from pelican.paginator import Paginator
|
||||
from pelican.utils import (get_relative_path, is_selected_for_writing,
|
||||
path_to_url, sanitised_join, set_date_tzinfo)
|
||||
|
||||
if not six.PY3:
|
||||
from codecs import open
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
@ -165,8 +159,7 @@ class Writer(object):
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
encoding = 'utf-8' if six.PY3 else None
|
||||
with self._open_w(complete_path, encoding, override_output) as fp:
|
||||
with self._open_w(complete_path, 'utf-8', override_output) as fp:
|
||||
feed.write(fp, 'utf-8')
|
||||
logger.info('Writing %s', complete_path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue