summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2018-05-02 13:47:27 -0700
committerDavid Lord <davidism@gmail.com>2018-05-02 14:07:33 -0700
commitfe626819d10e063270bf0ed3b183249482b1a0e7 (patch)
tree4f9f934aa7c0c8261c8d187c4a399d00f83598aa
parentb9c6ef1ec4ad8c58ca75c2919c3073063aa5b9b9 (diff)
downloadmarkupsafe-fe626819d10e063270bf0ed3b183249482b1a0e7.tar.gz
update project files
-rw-r--r--.appveyor.yml25
-rw-r--r--.gitignore17
-rw-r--r--.travis.yml45
-rw-r--r--AUTHORS13
-rw-r--r--AUTHORS.rst13
-rw-r--r--CHANGES58
-rw-r--r--CHANGES.rst69
-rw-r--r--LICENSE33
-rw-r--r--LICENSE.rst31
-rw-r--r--MANIFEST.in2
-rw-r--r--Makefile7
-rw-r--r--markupsafe/__init__.py2
-rw-r--r--setup.cfg22
-rw-r--r--[-rwxr-xr-x]setup.py129
-rw-r--r--[-rwxr-xr-x]tests.py0
-rw-r--r--tox.ini28
16 files changed, 279 insertions, 215 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 1b6c838..253126a 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,16 +1,16 @@
environment:
global:
- TOXENV: "py"
+ TOXENV: py
matrix:
- - PYTHON: C:\Python27
- - PYTHON: C:\Python27-x64
- - PYTHON: C:\Python34
- - PYTHON: C:\Python34-x64
- - PYTHON: C:\Python35
- - PYTHON: C:\Python35-x64
- - PYTHON: C:\Python36
- PYTHON: C:\Python36-x64
+ - PYTHON: C:\Python36
+ - PYTHON: C:\Python35-x64
+ - PYTHON: C:\Python35
+ - PYTHON: C:\Python34-x64
+ - PYTHON: C:\Python34
+ - PYTHON: C:\Python27-x64
+ - PYTHON: C:\Python27
init:
- SET PATH=%PYTHON%;%PATH%
@@ -18,14 +18,19 @@ init:
install:
- python -m pip install -U pip setuptools wheel tox
-build: off # Not a C# project, build stuff at the test step instead.
+build: false
test_script:
- python -m tox
after_test:
- - python setup.py bdist_wheel
+ - python setup.py release bdist_wheel
artifacts:
- path: dist\*.whl
type: whl
+
+branches:
+ only:
+ - master
+ - /^.*-maintenance$/
diff --git a/.gitignore b/.gitignore
index cf69d35..ba7609d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,9 +3,16 @@
*.pyo
*.o
*.so
-env
-dist
-build
-.tox
-*.egg-info
+env/
+venv/
+dist/
+build/
+*.egg-info/
+.tox/
+.cache/
+.pytest_cache/
+.coverage
+.coverage.*
+htmlcov/
+docs/_build/
.idea/
diff --git a/.travis.yml b/.travis.yml
index c975035..23cd92b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,21 +1,38 @@
+os: linux
sudo: false
language: python
-python:
- - "2.7"
- - "3.4"
- - "3.5"
- - "3.6"
- - pypy
+
+matrix:
+ include:
+ - python: 3.6
+ env: TOXENV=py,codecov
+ - python: 3.5
+ env: TOXENV=py,codecov
+ - python: 3.4
+ env: TOXENV=py,codecov
+ - python: 2.7
+ env: TOXENV=py,codecov
+ - python: pypy
+ env: TOXENV=py,codecov
+ - python: nigthly
+ env: TOXENV=py
+ allow_failures:
+ - python: nigthly
+ env: TOXENV=py
+
install:
- pip install tox
+
script:
- - tox -e py
+ - tox
+
+cache:
+ - pip
+
+branches:
+ only:
+ - master
+ - /^.*-maintenance$/
+
notifications:
email: false
- irc:
- channels:
- - chat.freenode.net#pocoo
- on_success: change
- on_failure: always
- use_notice: true
- skip_join: true
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index f7e2942..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,13 +0,0 @@
-MarkupSafe is written and maintained by Armin Ronacher and
-various contributors:
-
-Development Lead
-````````````````
-
-- Armin Ronacher <armin.ronacher@active-4.com>
-
-Patches and Suggestions
-```````````````````````
-
-- Georg Brandl
-- Mickaël Guérin
diff --git a/AUTHORS.rst b/AUTHORS.rst
new file mode 100644
index 0000000..b513b20
--- /dev/null
+++ b/AUTHORS.rst
@@ -0,0 +1,13 @@
+MarkupSafe is developed and maintained by the Pallets team and
+community contributors. It was created by Armin Ronacher. The core
+maintainers are:
+
+* David Lord (davidism)
+* Adrian Mönnich (ThiefMaster)
+* Armin Ronacher (mitsuhiko)
+
+A full list of contributors is available from git with:
+
+.. code-block:: none
+
+ git shortlog -sne
diff --git a/CHANGES b/CHANGES
deleted file mode 100644
index ef0d801..0000000
--- a/CHANGES
+++ /dev/null
@@ -1,58 +0,0 @@
-MarkupSafe Changelog
-====================
-
-Version 1.1
------------
-
-unreleased
-
-- ``escape`` wraps ``__html__`` result in ``Markup``, consistent with
- documented behavior. (`#69`_)
-
-.. _#69: https://github.com/pallets/markupsafe/pull/69
-
-Version 1.0
------------
-
-- Fixed custom types not invoking `__unicode__` when used
- with `format()`.
-- Added `__version__` module attribute
-- Improve unescape code to leave lone ampersands alone.
-
-Version 0.18
-------------
-
-- Fixed `__mul__` and string splitting on Python 3.
-
-Version 0.17
-------------
-
-- Fixed a bug with broken interpolation on tuples.
-
-Version 0.16
-------------
-
-- Improved Python 3 Support and removed 2to3
-- Removed support for Python 3.2 and 2.5
-
-Version 0.15
-------------
-
-- Fixed a typo that caused the library to fail to install
- on pypy and jython -.-
-
-Version 0.14
-------------
-
-- Release fix for 0.13.
-
-Version 0.13
-------------
-
-- Do not attempt to compile extension for PyPy or Jython.
-- Work around some 64bit Windows issues.
-
-Version 0.12
-------------
-
-- improved PyPy compatibility
diff --git a/CHANGES.rst b/CHANGES.rst
new file mode 100644
index 0000000..463ed38
--- /dev/null
+++ b/CHANGES.rst
@@ -0,0 +1,69 @@
+.. currentmodule:: markupsafe
+
+MarkupSafe Changelog
+====================
+
+
+Version 1.1
+-----------
+
+Unreleased
+
+- ``escape`` wraps ``__html__`` result in ``Markup``, consistent with
+ documented behavior. (`#69`_)
+
+.. _#69: https://github.com/pallets/markupsafe/pull/69
+
+
+Version 1.0
+-----------
+
+- Fixed custom types not invoking ``__unicode__`` when used with
+ ``format()``.
+- Added ``__version__`` module attribute.
+- Improve unescape code to leave lone ampersands alone.
+
+
+Version 0.18
+------------
+
+- Fixed ``__mul__`` and string splitting on Python 3.
+
+
+Version 0.17
+------------
+
+- Fixed a bug with broken interpolation on tuples.
+
+
+Version 0.16
+------------
+
+- Improved Python 3 Support and removed 2to3.
+- Removed support for Python 3.2 and 2.5.
+
+
+Version 0.15
+------------
+
+- Fixed a typo that caused the library to fail to install on pypy and
+ jython.
+
+
+Version 0.14
+------------
+
+- Release fix for 0.13.
+
+
+Version 0.13
+------------
+
+- Do not attempt to compile extension for PyPy or Jython.
+- Work around some 64bit Windows issues.
+
+
+Version 0.12
+------------
+
+- Improved PyPy compatibility.
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 5d26938..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,33 +0,0 @@
-Copyright (c) 2010 by Armin Ronacher and contributors. See AUTHORS
-for more details.
-
-Some rights reserved.
-
-Redistribution and use in source and binary forms of the software as well
-as documentation, with or without modification, are permitted provided
-that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
-* The names of the contributors may not be used to endorse or
- promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
-NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
diff --git a/LICENSE.rst b/LICENSE.rst
new file mode 100644
index 0000000..a62ef20
--- /dev/null
+++ b/LICENSE.rst
@@ -0,0 +1,31 @@
+Copyright © 2010 by the Pallets team.
+
+Some rights reserved.
+
+Redistribution and use in source and binary forms of the software as
+well as documentation, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/MANIFEST.in b/MANIFEST.in
index c9a1952..52fdb6f 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,2 @@
-include AUTHORS CHANGES LICENSE tests.py
+include AUTHORS CHANGES.rst LICENSE tests.py
recursive-include markupsafe *.c
diff --git a/Makefile b/Makefile
deleted file mode 100644
index fd263b1..0000000
--- a/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-test:
- python setup.py test
-
-tox-test:
- tox
-
-.PYONY: test tox-test
diff --git a/markupsafe/__init__.py b/markupsafe/__init__.py
index d9c9bc9..b932225 100644
--- a/markupsafe/__init__.py
+++ b/markupsafe/__init__.py
@@ -14,7 +14,7 @@ from collections import Mapping
from markupsafe._compat import text_type, string_types, int_types, \
unichr, iteritems, PY2
-__version__ = "1.0"
+__version__ = '1.1'
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
diff --git a/setup.cfg b/setup.cfg
index 0c9e0fc..6ae8437 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,22 @@
[metadata]
-license_file = LICENSE
+license_file = LICENSE.rst
+
+[egg_info]
+tag_build = dev
+
+[aliases]
+release = egg_info -Db ''
+
+[tool:pytest]
+testpaths = tests.py
+
+[coverage:run]
+branch = True
+source =
+ markupsafe
+
+[coverage:paths]
+source =
+ markupsafe
+ .tox/*/lib/python*/site-packages/markupsafe
+ .tox/pypy/site-packages/markupsafe
diff --git a/setup.py b/setup.py
index 12d3fb0..3b6f4d3 100755..100644
--- a/setup.py
+++ b/setup.py
@@ -1,43 +1,31 @@
#!/usr/bin/env python
-import os
+# -*- coding: utf-8 -*-
+from __future__ import print_function
+
+import io
import re
-import ast
import sys
-from setuptools import setup, Extension, Feature
-from distutils.command.build_ext import build_ext
-from distutils.errors import CCompilerError, DistutilsExecError, \
- DistutilsPlatformError
+from collections import OrderedDict
+from distutils.errors import (
+ CCompilerError, DistutilsExecError,
+ DistutilsPlatformError
+)
+
+from setuptools import Extension, setup
+from setuptools.command.build_ext import build_ext
+with io.open('README.rst', 'rt', encoding='utf8') as f:
+ readme = f.read()
-# fail safe compilation shamelessly stolen from the simplejson
-# setup.py file. Original author: Bob Ippolito
+with io.open('markupsafe/__init__.py', 'rt', encoding='utf8') as f:
+ version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
is_jython = 'java' in sys.platform
is_pypy = hasattr(sys, 'pypy_version_info')
-with open('markupsafe/__init__.py') as f:
- version = ast.literal_eval(re.search(
- '^__version__\s+=\s+(.*?)$(?sm)', f.read()).group(1))
-
-
-speedups = Feature(
- 'optional C speed-enhancement module',
- standard=True,
- ext_modules=[
- Extension('markupsafe._speedups', ['markupsafe/_speedups.c']),
- ],
-)
-
-# Known errors when running build_ext.build_extension method
-ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
-if sys.platform == 'win32' and sys.version_info > (2, 6):
- # 2.6's distutils.msvc9compiler can raise an IOError when failing to
- # find the compiler
- ext_errors += (IOError,)
-# Known errors when running build_ext.run method
-run_errors = (DistutilsPlatformError,)
-if sys.platform == 'darwin':
- run_errors += (SystemError,)
+ext_modules = [
+ Extension('markupsafe._speedups', ['markupsafe/_speedups.c']),
+]
class BuildFailed(Exception):
@@ -50,13 +38,13 @@ class ve_build_ext(build_ext):
def run(self):
try:
build_ext.run(self)
- except run_errors:
+ except DistutilsPlatformError:
raise BuildFailed()
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
- except ext_errors:
+ except (CCompilerError, DistutilsExecError, DistutilsPlatformError):
raise BuildFailed()
except ValueError:
# this can happen on Windows 64 bit, see Python issue 7511
@@ -65,29 +53,22 @@ class ve_build_ext(build_ext):
raise
-def echo(msg=''):
- sys.stdout.write(msg + '\n')
-
-
-readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
-
-
def run_setup(with_binary):
- features = {}
- if with_binary:
- features['speedups'] = speedups
setup(
name='MarkupSafe',
version=version,
url='https://www.palletsprojects.com/p/markupsafe/',
+ project_urls=OrderedDict((
+ ('Code', 'https://github.com/pallets/markupsafe'),
+ ('Issue tracker', 'https://github.com/pallets/markupsafe/issues'),
+ )),
license='BSD',
author='Armin Ronacher',
author_email='armin.ronacher@active-4.com',
maintainer='Pallets team',
maintainer_email='contact@palletsprojects.com',
- description='Implements a XML/HTML/XHTML Markup safe string for Python',
+ description='Safely add untrusted strings to XML/HTML markup.',
long_description=readme,
- zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
@@ -103,39 +84,51 @@ def run_setup(with_binary):
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
- 'Topic :: Text Processing :: Markup :: HTML'
+ 'Topic :: Text Processing :: Markup :: HTML',
],
+ python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
+ extras_require={
+ 'dev': [
+ 'pytest',
+ 'coverage',
+ 'tox',
+ ],
+ },
packages=['markupsafe'],
- test_suite='tests.suite',
include_package_data=True,
+ zip_safe=False,
cmdclass={'build_ext': ve_build_ext},
- features=features,
+ ext_modules=ext_modules if with_binary else [],
)
-def try_building_extension():
+def show_message(*lines):
+ print('=' * 74)
+ for line in lines:
+ print(line)
+ print('=' * 74)
+
+
+if not (is_pypy or is_jython):
try:
run_setup(True)
except BuildFailed:
- LINE = '=' * 74
- BUILD_EXT_WARNING = 'WARNING: The C extension could not be ' \
- 'compiled, speedups are not enabled.'
-
- echo(LINE)
- echo(BUILD_EXT_WARNING)
- echo('Failure information, if any, is above.')
- echo('Retrying the build without the C extension now.')
- echo()
-
+ show_message(
+ 'WARNING: The C extension could not be compiled, speedups'
+ ' are not enabled.',
+ 'Failure information, if any, is above.',
+ 'Retrying the build without the C extension now.'
+ )
run_setup(False)
-
- echo(LINE)
- echo(BUILD_EXT_WARNING)
- echo('Plain-Python installation succeeded.')
- echo(LINE)
-
-
-if not (is_pypy or is_jython):
- try_building_extension()
+ show_message(
+ 'WARNING: The C extension could not be compiled, speedups'
+ ' are not enabled.',
+ 'Plain-Python build succeeded.'
+ )
else:
run_setup(False)
+ show_message(
+ 'WARNING: C extensions are not supported on this Python'
+ ' platform, speedups are not enabled.',
+ 'Plain-Python build succeeded.'
+ )
diff --git a/tests.py b/tests.py
index ba5d30c..ba5d30c 100755..100644
--- a/tests.py
+++ b/tests.py
diff --git a/tox.ini b/tox.ini
index d1e1b68..8f372c5 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,8 +1,28 @@
[tox]
-envlist = py27,pypy,py34,py35,py36
+envlist =
+ py{36,35,34,27,py}
+ coverage_report
[testenv]
-commands = py.test tests.py {posargs}
-
+passenv = LANG
deps =
- pytest
+ pytest>=3
+ coverage
+commands = coverage run -p -m pytest {posargs}
+
+[testenv:coverage_report]
+deps = coverage
+skip_install = true
+commands =
+ coverage combine
+ coverage report
+ coverage html
+
+[testenv:codecov]
+passenv = CI TRAVIS TRAVIS_*
+deps = codecov
+skip_install = true
+commands =
+ coverage combine
+ coverage report
+ codecov