-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-6.0.0' into master
- Loading branch information
Showing
19 changed files
with
232 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ fpdocs/ | |
venv/ | ||
build/ | ||
*.egg-info/ | ||
.doit.* | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
os: linux | ||
dist: focal | ||
language: python | ||
|
||
sudo: false | ||
|
||
matrix: | ||
jobs: | ||
fast_finish: true | ||
include: | ||
- python: "3.5" | ||
env: TOXENV=py35 | ||
- python: "3.6" | ||
env: TOXENV=py36 | ||
- python: "3.7" | ||
env: TOXENV=py37 | ||
dist: xenial | ||
sudo: true | ||
- python: "3.8" | ||
env: TOXENV=py38 | ||
dist: xenial | ||
sudo: true | ||
|
||
|
||
- python: "3.9-dev" | ||
env: TOXENV=py39 | ||
install: pip install -U tox coveralls | ||
script: travis_wait 30 tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Makes Sphinx create a <link> to feedparser.css in the HTML output | ||
def setup(app): | ||
app.add_stylesheet('feedparser.css') | ||
app.add_css_file('feedparser.css') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# This file is part of feedparser. | ||
# Copyright 2020 Kurt McKee <contactme@kurtmckee.org> | ||
# Released under the BSD 2-clause license. | ||
|
||
# The tasks defined in this file automates the entire | ||
# development-to-release process. | ||
|
||
import os | ||
import pathlib | ||
import random | ||
import subprocess | ||
import platform | ||
|
||
import colorama | ||
import docutils.core | ||
import doit.action | ||
|
||
|
||
# Initialize colorama so that tox can output ANSI escape codes. | ||
colorama.init() | ||
|
||
DOIT_CONFIG = {'default_tasks': ['build', 'test']} | ||
PROJECT = 'feedparser' | ||
|
||
root = pathlib.Path(__file__).parent | ||
|
||
|
||
def task_build(): | ||
"""Build the documentation. | ||
The documentation will be converted to HTML files to help double-check | ||
syntax and formatting on PyPI and on GitHub. Note that the HTML files | ||
will not be included in the distribution files. | ||
""" | ||
|
||
def build_single_files(): | ||
docutils.core.publish_cmdline(writer_name='html', argv=['README.rst', 'README.html']) | ||
|
||
return { | ||
'actions': [ | ||
build_single_files, | ||
'sphinx-build -b html docs/ fpdocs', | ||
], | ||
'verbosity': 2, | ||
'file_dep': [root / 'README.rst'] + list((root / 'docs').rglob('*.rst')), | ||
'targets': [root / 'README.html'], | ||
} | ||
|
||
|
||
def task_test(): | ||
"""Run the unit tests.""" | ||
|
||
env = {k: v for k, v in os.environ.items()} | ||
env.update({ | ||
'PY_COLORS': '1', | ||
}) | ||
|
||
return { | ||
'actions': [ | ||
doit.action.CmdAction('tox', env=env), | ||
], | ||
'verbosity': 2, | ||
} | ||
|
||
|
||
def remove_dist_files(): | ||
"""Erase existing files in the ``dist`` directory.""" | ||
|
||
for file in (root / 'dist/').glob('*'): | ||
file.unlink() | ||
|
||
|
||
def open_browser(url): | ||
"""Open *url* in the default browser on Windows or Linux.""" | ||
|
||
if platform.system() == 'Windows': | ||
subprocess.check_output(['start', url], shell=True) | ||
elif platform.system() == 'Linux': | ||
subprocess.check_output(['xdg-open', url], shell=True) | ||
|
||
|
||
def task_test_release(): | ||
"""Upload to test.pypi.org.""" | ||
|
||
# Generate random suffixes to help prevent name and version conflicts | ||
# on PyPI. These environment variables are used in `setup.py`. | ||
env = {k: v for k, v in os.environ.items()} | ||
env.update({ | ||
'NAME_SUFFIX': ''.join(chr(i) for i in random.sample(range(0x61, 0x61+26), 10)), | ||
'VERSION_SUFFIX': str(random.choice(range(1, 1000))), | ||
}) | ||
|
||
return { | ||
'actions': [ | ||
remove_dist_files, | ||
doit.action.CmdAction('python setup.py sdist bdist_wheel', env=env), | ||
f'twine upload --repository testpypi dist/*{env["NAME_SUFFIX"]}*', | ||
(open_browser, [f'https://test.pypi.org/project/{PROJECT}_{env["NAME_SUFFIX"]}']), | ||
], | ||
'verbosity': 2, | ||
} | ||
|
||
|
||
def validate_in_git_master_branch(): | ||
"""Validate that the repository is in the git master branch.""" | ||
|
||
branch = subprocess.check_output('git rev-parse --abbrev-ref HEAD', shell=True) | ||
return branch.decode('utf8', errors='ignore').strip() == 'master' | ||
|
||
|
||
def task_release(): | ||
"""Upload to pypi.org. | ||
This step must *always* be taken while in the git master branch. | ||
This is an enforced requirement. | ||
""" | ||
|
||
return { | ||
'actions': [ | ||
validate_in_git_master_branch, | ||
remove_dist_files, | ||
'python setup.py sdist bdist_wheel', | ||
'twine upload dist/*', | ||
(open_browser, [f'https://pypi.org/project/{PROJECT}']), | ||
], | ||
'verbosity': 2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.