Multi-line metadata should be' + ' supported\nas well as inline' + ' markup and stuff to "typogrify' + '"...
\n', + 'date': SafeDatetime(2010, 12, 2, 10, 14), + 'modified': SafeDatetime(2010, 12, 2, 10, 20), + 'tags': ['foo', 'bar', 'foobar'], + 'custom_field': 'http://notmyidea.org', + } + + self.assertDictHasSubset(page.metadata, expected) + def test_article_with_filename_metadata(self): page = self.read_file( path='2012-11-29_rst_w_filename_meta#foo-bar.rst', diff --git a/pelican/tests/test_settings.py b/pelican/tests/test_settings.py index 708c0981..83203ae5 100644 --- a/pelican/tests/test_settings.py +++ b/pelican/tests/test_settings.py @@ -7,8 +7,8 @@ from sys import platform from pelican.settings import (DEFAULT_CONFIG, DEFAULT_THEME, _printf_s_to_format_field, - configure_settings, handle_deprecated_settings, - read_settings) + coerce_overrides, configure_settings, + handle_deprecated_settings, read_settings) from pelican.tests.support import unittest @@ -304,3 +304,18 @@ class TestSettingsConfiguration(unittest.TestCase): [(r'C\+\+', 'cpp')] + self.settings['SLUG_REGEX_SUBSTITUTIONS']) self.assertNotIn('SLUG_SUBSTITUTIONS', settings) + + def test_coerce_overrides(self): + overrides = coerce_overrides({ + 'ARTICLE_EXCLUDES': '["testexcl"]', + 'READERS': '{"foo": "bar"}', + 'STATIC_EXCLUDE_SOURCES': 'true', + 'THEME_STATIC_DIR': 'theme', + }) + expected = { + 'ARTICLE_EXCLUDES': ["testexcl"], + 'READERS': {"foo": "bar"}, + 'STATIC_EXCLUDE_SOURCES': True, + 'THEME_STATIC_DIR': 'theme', + } + self.assertDictEqual(overrides, expected) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 1a98ab14..41ddea3c 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -41,7 +41,7 @@ _jinja_env = Environment( _GITHUB_PAGES_BRANCHES = { - 'personal': 'master', + 'personal': 'main', 'project': 'gh-pages' } diff --git a/pelican/tools/templates/Makefile.jinja2 b/pelican/tools/templates/Makefile.jinja2 index 0184cc88..a60f1e16 100644 --- a/pelican/tools/templates/Makefile.jinja2 +++ b/pelican/tools/templates/Makefile.jinja2 @@ -101,32 +101,16 @@ regenerate: "$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) serve: -ifdef PORT - "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -p $(PORT) -else "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -endif serve-global: -ifdef PORT - "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -p $(PORT) -b $(SERVER) -else "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER) -endif devserver: -ifdef PORT - "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -p $(PORT) -else "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -endif devserver-global: -ifdef PORT - $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0 -else $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0 -endif publish: "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS) @@ -139,7 +123,7 @@ ssh_upload: publish {% set upload = upload + ["rsync_upload"] %} rsync_upload: publish - rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --cvs-exclude --delete "$(OUTPUTDIR)"/ "$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)" + rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --include tags --cvs-exclude --delete "$(OUTPUTDIR)"/ "$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)" {% endif %} {% if dropbox %} diff --git a/pyproject.toml b/pyproject.toml index 20196d15..6aafee89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,45 +18,48 @@ classifiers = [ "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", ] +[tool.poetry.urls] +"Funding" = "https://donate.getpelican.com/" +"Tracker" = "https://github.com/getpelican/pelican/issues" + [tool.poetry.dependencies] python = "^3.6" +blinker = "^1.4" +docutils = "^0.16" feedgenerator = "^1.9" jinja2 = "~2.11" pygments = "~2.6.1" -pytz = "^2019.1" -blinker = "^1.4" -unidecode = "^1.1" python-dateutil = "^2.8" -docutils = "^0.15" -markdown = {version = "~3.1.1", optional = true} +pytz = "^2020.1" +unidecode = "^1.1" +markdown = {version = "~3.2.2", optional = true} [tool.poetry.dev-dependencies] -BeautifulSoup4 = "^4.7" +BeautifulSoup4 = "^4.9" lxml = "^4.3" -markdown = "~3.1.1" +markdown = "~3.2.2" typogrify = "^2.0" -sphinx = "=1.4.9" -sphinx_rtd_theme = "^0.4.3" +sphinx = "^3.0" +sphinx_rtd_theme = "^0.5" livereload = "^2.6" -mock = "^3.0" -pytest = "~5.3.5" +pytest = "^6.0" pytest-cov = "^2.8" pytest-pythonpath = "^0.7.3" -pytest-sugar = "^0.9.2" -pytest-xdist = "^1.31" +pytest-sugar = "^0.9.4" +pytest-xdist = "^2.0" tox = "^3.13" -flake8 = "^3.7" +flake8 = "^3.8" flake8-import-order = "^0.18.1" invoke = "^1.3" -isort = "^4.3.21" +isort = "^5.2" black = {version = "^19.10b0", allow-prereleases = true} [tool.poetry.extras] @@ -64,6 +67,10 @@ markdown = ["markdown"] [tool.poetry.scripts] pelican = "pelican.__main__:main" +pelican-import = "pelican.tools.pelican_import:main" +pelican-plugins = "pelican.plugins._utils:list_plugins" +pelican-quickstart = "pelican.tools.pelican_quickstart:main" +pelican-themes = "pelican.tools.pelican_themes:main" [tool.autopub] project-name = "Pelican" @@ -76,4 +83,5 @@ version-strings = ["setup.py"] build-system = "setuptools" [build-system] -requires = ["setuptools >= 40.6.0", "wheel"] +requires = ["poetry>=1.0"] +build-backend = "poetry.masonry.api" diff --git a/requirements/test.pip b/requirements/test.pip index 973b27ca..647a8694 100644 --- a/requirements/test.pip +++ b/requirements/test.pip @@ -1,6 +1,6 @@ # Tests Pygments==2.6.1 -pytest==5.3.5 +pytest pytest-cov pytest-xdist diff --git a/setup.py b/setup.py index 2d831aa4..af96c726 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from os import walk from os.path import join, relpath -from setuptools import setup +from setuptools import setup, find_packages version = "4.2.0" @@ -44,19 +44,14 @@ setup( keywords='static web site generator SSG reStructuredText Markdown', license='AGPLv3', long_description=description, - packages=['pelican', 'pelican.tools', 'pelican.plugins'], - package_data={ - # we manually collect the package data, as opposed to using, - # include_package_data=True because we don't want the tests to be - # included automatically as package data (MANIFEST.in is too greedy) + packages=find_packages(), + include_package_data=True, # includes all in MANIFEST.in if in package + # NOTE : This will collect any files that happen to be in the themes + # directory, even though they may not be checked into version control. + package_data={ # pelican/themes is not a package, so include manually 'pelican': [relpath(join(root, name), 'pelican') for root, _, names in walk(join('pelican', 'themes')) for name in names], - 'pelican.tools': [relpath(join(root, name), join('pelican', 'tools')) - for root, _, names in walk(join('pelican', - 'tools', - 'templates')) - for name in names], }, install_requires=requires, extras_require={ diff --git a/tasks.py b/tasks.py index 52bfe6a3..76c48834 100644 --- a/tasks.py +++ b/tasks.py @@ -64,7 +64,7 @@ def isort(c, check=False, diff=False): if diff: diff_flag = "--diff" c.run( - f"{VENV_BIN}/isort {check_flag} {diff_flag} --recursive {PKG_PATH}/* tasks.py" + f"{VENV_BIN}/isort {check_flag} {diff_flag} ." ) diff --git a/tox.ini b/tox.ini index 18b0e7a4..69281e30 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ commands = filterwarnings = default::DeprecationWarning error:.*:Warning:pelican -addopts = -n 2 -r a +addopts = -n auto -r a [flake8] application-import-names = pelican