Skip to content

Commit

Permalink
Remove Python2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
zqqf16 committed Apr 7, 2022
1 parent faa0a60 commit 56c3059
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 50 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 zqqf16
Copyright (c) 2015 - 2022 zqqf16

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
一个静态博客生成工具,由[zqqf16.github.com](https://github.com/zqqf16/zqqf16.github.com)演变而来,目前正在开发中~
一个静态博客生成工具,由[zqqf16.github.com](https://github.com/zqqf16/zqqf16.github.com)演变而来

![CI Status](https://github.com/zqqf16/Peanut/actions/workflows/main.yml/badge.svg)

Expand All @@ -10,7 +10,7 @@
``` bash
git clone https://github.com/zqqf16/Peanut.git
cd peanut
sudo python setup.py install
sudo python setup.py install #python version >= 3.x
```

### 使用
Expand Down Expand Up @@ -72,14 +72,13 @@ peanut ghost http://your_ghost.domain username password
- Markdown
- Pygments
- PyYAML
- six
- docopt

### License

The MIT License (MIT)

Copyright (c) 2015-2021 zqqf16
Copyright (c) 2015-2022 zqqf16

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion peanut/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

version = '1.3b1'
version = '1.4.1'
5 changes: 1 addition & 4 deletions peanut/logger.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import six
import logging

from functools import partial

from peanut.utils import to_s, to_u
from peanut.utils import to_s


def init_logger(level):
Expand Down
2 changes: 1 addition & 1 deletion peanut/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from datetime import datetime

from peanut.utils import path_to_url, url_safe, real_url
from peanut.options import configs, env
from peanut.options import configs


class BaseModel(object):
Expand Down
6 changes: 1 addition & 5 deletions peanut/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
from __future__ import unicode_literals

import os
import six
import re
import markdown
import datetime
import logging

from six import with_metaclass
from peanut.meta_yaml import MetaYamlExtension


Expand Down Expand Up @@ -73,7 +71,7 @@ def read(self, path):
return NotImplemented


class MarkdownReader(with_metaclass(Singleton, Reader)):
class MarkdownReader(Reader, metaclass=Singleton):
"""Markdown reader
"""

Expand Down Expand Up @@ -133,8 +131,6 @@ def read(self, path):

with open(path, 'r') as f:
draft = f.read()
if six.PY2:
draft = draft.decode('utf-8')
content = self.parser.convert(draft.strip(' \n'))

res.update({'content': content, 'raw': self.md_parser.Raw})
Expand Down
1 change: 0 additions & 1 deletion peanut/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import unicode_literals

import os
import six
import shutil
import logging

Expand Down
5 changes: 0 additions & 5 deletions peanut/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import os
import re
import six
import builtins

try:
Expand All @@ -20,13 +19,9 @@ def to_u(value):
return str(value)

def path_to_url(path):
if six.PY2:
path = path.encode('utf-8')
return pathname2url(path)

def url_to_path(url):
if six.PY2:
url = url.encode('utf-8')
return url2pathname(url)

def url_safe(string):
Expand Down
8 changes: 1 addition & 7 deletions peanut/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

from __future__ import unicode_literals


import os
import six
import logging

from peanut.options import configs, env
Expand Down Expand Up @@ -37,11 +35,7 @@ def write_to_file(self, file_path, content):
pass

with open(file_path, 'w') as f:
if six.PY2:
f.write(content.encode('utf-8'))
else:
f.write(content)
f.close()
f.write(content)

def run(self):
return NotImplemented
Expand Down
13 changes: 6 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Jinja2
Markdown
Pygments
PyYAML
docopt
six
requests
Jinja2>=3.1.1
Markdown>=3.3.6
Pygments>=2.11.2
PyYAML>=6.0
docopt>=0.6.2
requests>=2.27.1
18 changes: 4 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,23 @@ def read(fname):
],
},

python_requires='>=3',

classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
'Development Status :: 5 - Stable',

# Indicate who your project is intended for
'Topic :: Utilities',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],

install_requires=['Jinja2', 'Markdown', 'Pygments', 'PyYAML', 'six', 'docopt', 'requests'],
install_requires=['Jinja2', 'Markdown', 'Pygments', 'PyYAML', 'docopt', 'requests'],

py_modules=['peanut'],

Expand Down

0 comments on commit 56c3059

Please sign in to comment.