diff --git a/.travis.yml b/.travis.yml index 7bb5a89f..a7a8732d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,12 @@ env: - TOX_ENV=py27 - TOX_ENV=py33 - TOX_ENV=py34 + - TOX_ENV=py35 matrix: include: - - python: 3.5 + - python: 3.6 env: - - TOX_ENV=py35 + - TOX_ENV=py36 addons: apt_packages: - pandoc @@ -19,7 +20,7 @@ before_install: - sudo apt-get update -qq - sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8 install: - - pip install tox==2.0.1 + - pip install tox==2.5.0 script: tox -e $TOX_ENV notifications: irc: diff --git a/docs/contribute.rst b/docs/contribute.rst index 0ed82dfd..187c3007 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -47,13 +47,16 @@ Or using ``pip``:: $ pip install -e . +To conveniently test on multiple Python versions, we also provide a .tox file. + + Building the docs ================= If you make changes to the documentation, you should preview your changes before committing them:: - $ pip install sphinx + $ pip install -r requirements/docs.pip $ cd src/pelican/docs $ make html diff --git a/pelican/contents.py b/pelican/contents.py index 1ded6cdb..0e842b39 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -246,7 +246,7 @@ class Content(object): origin = origin.replace('\\', '/') # for Windows paths. else: logger.warning( - "Unable to find `%s`, skipping url replacement.", + "Unable to find '%s', skipping url replacement.", value.geturl(), extra={ 'limit_msg': ("Other resources were not found " "and their urls not replaced")}) diff --git a/pelican/log.py b/pelican/log.py index cec07bf0..70e069d3 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -197,6 +197,7 @@ class FatalLogger(LimitLogger): if FatalLogger.errors_fatal: raise RuntimeError('Error encountered') + logging.setLoggerClass(FatalLogger) diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py index b52785dd..def67cc7 100644 --- a/pelican/rstdirectives.py +++ b/pelican/rstdirectives.py @@ -70,6 +70,7 @@ class Pygments(Directive): parsed = highlight('\n'.join(self.content), lexer, formatter) return [nodes.raw('', parsed, format='html')] + directives.register_directive('code-block', Pygments) directives.register_directive('sourcecode', Pygments) @@ -90,4 +91,5 @@ def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): expl = m.group(1) return [abbreviation(abbr, abbr, explanation=expl)], [] + roles.register_local_role('abbr', abbr_role) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 2f774a6e..29a219f5 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -731,3 +731,19 @@ class TestStatic(LoggedTestCase): msg="Replacement Indicator 'unknown' not recognized, " "skipping replacement", level=logging.WARNING) + + def test_link_to_unknown_file(self): + "{filename} link to unknown file should trigger warning." + + html = 'link' + page = Page(content=html, + metadata={'title': 'fakepage'}, settings=self.settings, + source_path=os.path.join('dir', 'otherdir', 'fakepage.md'), + context=self.context) + content = page.get_content('') + + self.assertEqual(content, html) + self.assertLogCountEqual( + count=1, + msg="Unable to find 'foo', skipping url replacement.", + level=logging.WARNING) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 39e58f6f..ae0e8c9d 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -70,6 +70,7 @@ def _input_compat(prompt): r = raw_input(prompt) return r + if six.PY3: str_compat = str else: @@ -81,6 +82,7 @@ else: class _DEFAULT_PATH_TYPE(str_compat): is_default_path = True + _DEFAULT_PATH = _DEFAULT_PATH_TYPE(os.curdir) @@ -412,5 +414,6 @@ needed by Pelican. print('Done. Your new project is available at %s' % CONF['basedir']) + if __name__ == "__main__": main() diff --git a/pelican/tools/pelican_themes.py b/pelican/tools/pelican_themes.py index e4bcb7c9..fd60c424 100755 --- a/pelican/tools/pelican_themes.py +++ b/pelican/tools/pelican_themes.py @@ -14,6 +14,7 @@ def err(msg, die=None): if die: sys.exit((die if type(die) is int else 1)) + try: import pelican except: diff --git a/requirements/developer.pip b/requirements/developer.pip index e5507151..5c2f5a69 100644 --- a/requirements/developer.pip +++ b/requirements/developer.pip @@ -1,6 +1,3 @@ -r test.pip - -# Development -flake8 -flake8-import-order -sphinx==1.4.9 +-r docs.pip +-r style.pip diff --git a/requirements/docs.pip b/requirements/docs.pip new file mode 100644 index 00000000..525bdc40 --- /dev/null +++ b/requirements/docs.pip @@ -0,0 +1,2 @@ +sphinx==1.4.9 +sphinx_rtd_theme diff --git a/requirements/style.pip b/requirements/style.pip new file mode 100644 index 00000000..90225d01 --- /dev/null +++ b/requirements/style.pip @@ -0,0 +1,2 @@ +flake8 +flake8-import-order diff --git a/tox.ini b/tox.ini index cb400ea7..95cd5273 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,33,34,35},docs,flake8 +envlist = py{27,33,34,35,36},docs,flake8 [testenv] basepython = @@ -7,10 +7,11 @@ basepython = py33: python3.3 py34: python3.4 py35: python3.5 + py36: python3.6 passenv = * usedevelop=True deps = - -rrequirements/developer.pip + -rrequirements/test.pip nose nose-cov coveralls @@ -24,8 +25,7 @@ commands = [testenv:docs] basepython = python2.7 deps = - sphinx==1.4.9 - sphinx_rtd_theme + -rrequirements/docs.pip changedir = docs commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html @@ -37,8 +37,7 @@ import-order-style = cryptography [testenv:flake8] basepython = python2.7 deps = - flake8 <= 2.4.1 - git+https://github.com/public/flake8-import-order@2ac7052a4e02b4a8a0125a106d87465a3b9fd688 + -rrequirements/style.pip commands = flake8 --version flake8 pelican