Skip to content

Commit

Permalink
Add Python 3 and PyPy support.
Browse files Browse the repository at this point in the history
Drop deps on zope.app.zcmlfiles/testing/component (which was
circular).

Coverage is not quite 100% but is very close.
  • Loading branch information
jamadden committed Apr 25, 2017
1 parent d60281e commit 0beb65d
Show file tree
Hide file tree
Showing 20 changed files with 520 additions and 167 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
source = src

[report]
exclude_lines =
pragma: no cover
if __name__ == '__main__':
raise NotImplementedError
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ build/
dist/
*.egg-info/
.tox/
.coverage
htmlcov
27 changes: 22 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
language: python
sudo: false
python:
- 2.7
install:
- pip install .
- 2.7
- 3.4
- 3.5
- 3.6
- pypy-5.4.1
script:
- python setup.py test -q
- coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress

after_success:
- coveralls
notifications:
email: false
email: false

install:
- pip install -U pip setuptools
- pip install -U coveralls coverage
- pip install -U -e ".[test]"


cache: pip

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
6 changes: 4 additions & 2 deletions CHANGES.txt → CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
CHANGES
=======

3.5.4 (unreleased)
4.0.0 (unreleased)
------------------

- Nothing changed yet.
- Remove test dependency on ``zope.app.zcmlfiles``,
``zope.app.testing`` and several others.
- Add support for PyPy, Python 3.4, 3.5 and 3.6.


3.5.3 (2012-01-23)
Expand Down
9 changes: 7 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
include *.py
include *.txt
include *.rst
include buildout.cfg
include setup.cfg
include .coveragerc
include tox.ini
recursive-include src *.pt
recursive-include src *.rst
recursive-include src *.zcml
recursive-include src *.css
recursive-include src *.gif
recursive-include src *.js
recursive-include src *.png
recursive-include src *.pt
recursive-include src *.xml
recursive-include src *.zcml
File renamed without changes.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
82 changes: 51 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,44 @@
from setuptools import setup, find_packages

def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()

tests_require = [
'zope.app.appsetup',
'zope.app.basicskin >= 4.0',
'zope.app.container >= 4.0',
'zope.app.pagetemplate >= 4.0',
'zope.app.publication',
'zope.app.wsgi',

'zope.applicationcontrol',
'zope.browser',
'zope.browserresource',
'zope.login',
'zope.password',
'zope.principalannotation',
'zope.principalregistry',
'zope.proxy >= 4.2.1',
'zope.securitypolicy',
'zope.site',
'zope.testbrowser >= 5.2',
'zope.testing',
'zope.testrunner',
]

setup(name='zope.app.rotterdam',
version='3.5.4dev',
version='4.0.0.dev0',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
description='Rotterdam -- A Zope 3 ZMI Skin',
long_description=(
read('README.txt')
read('README.rst')
+ '\n\n' +
read('CHANGES.txt')
read('CHANGES.rst')
),
keywords = "zope3 zmi skin rotterdam",
classifiers = [
keywords="zope3 zmi skin rotterdam",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
Expand All @@ -46,35 +70,31 @@ def read(*rnames):
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3'],
'Framework :: Zope3',
],
url='http://pypi.python.org/pypi/zope.app.rotterdam',
license='ZPL 2.1',
packages=find_packages('src'),
package_dir = {'': 'src'},
namespace_packages=['zope', 'zope.app'],
extras_require = dict(test=[
'zope.app.component',
'zope.app.testing',
'zope.app.zcmlfiles',
'zope.login',
'zope.password',
'zope.securitypolicy',
'zope.site',
]),
install_requires=['setuptools',
'zope.app.basicskin',
'zope.app.form',
'zope.app.pagetemplate',
'zope.component',
'zope.container',
'zope.i18n',
'zope.i18nmessageid',
'zope.interface',
'zope.proxy',
'zope.publisher >= 3.12',
'zope.security',
'zope.traversing',
],
extras_require={
'test': tests_require,
},
install_requires=[
'setuptools',
'zope.app.basicskin >= 4.0',
'zope.app.form',
'zope.app.pagetemplate >= 4.0',
'zope.component',
'zope.container',
'zope.i18n',
'zope.i18nmessageid',
'zope.interface',
'zope.proxy',
'zope.publisher >= 4.3.1',
'zope.security',
'zope.traversing',
],
include_package_data = True,
zip_safe = False,
)
)
8 changes: 1 addition & 7 deletions src/zope/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
8 changes: 1 addition & 7 deletions src/zope/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
2 changes: 1 addition & 1 deletion src/zope/app/rotterdam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class Rotterdam(rotterdam, IDefaultBrowserLayer):
# BBB 2006/02/18, to be removed after 12 months
try:
import zope.app.skins
zope.app.skins.set('Rotterdam', Rotterdam)
zope.app.skins.set('Rotterdam', Rotterdam) # pragma: no cover
except ImportError:
pass
17 changes: 8 additions & 9 deletions src/zope/app/rotterdam/editingwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"""
__docformat__ = 'restructuredtext'

from zope.interface import implements
from zope.interface import implementer

from zope.app.form.interfaces import IInputWidget
from zope.app.form.browser import TextAreaWidget
from zope.app.form.browser.widget import renderElement, escape
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile


@implementer(IInputWidget)
class SimpleEditingWidget(TextAreaWidget):
"""Improved textarea editing, with async saving using JavaScript.
Expand All @@ -43,7 +43,7 @@ class SimpleEditingWidget(TextAreaWidget):
>>> def normalize(s):
... return '\\n '.join(filter(None, s.split(' ')))
>>> print normalize( widget() )
>>> print(normalize( widget() ))
<textarea
cols="60"
id="field.foo"
Expand All @@ -52,7 +52,7 @@ class SimpleEditingWidget(TextAreaWidget):
>Hello\r
world!</textarea>
>>> print normalize( widget.hidden() )
>>> print(normalize( widget.hidden() ))
<input
class="hiddenType"
id="field.foo"
Expand All @@ -64,7 +64,7 @@ class SimpleEditingWidget(TextAreaWidget):
Calling `setRenderedValue` will change what gets output:
>>> widget.setRenderedValue("Hey\\ndude!")
>>> print normalize( widget() )
>>> print(normalize( widget() ))
<textarea
cols="60"
id="field.foo"
Expand All @@ -82,7 +82,7 @@ class SimpleEditingWidget(TextAreaWidget):
>>> widget.getInputValue()
u'<h1>&copy;</h1>'
>>> print normalize( widget() )
>>> print(normalize( widget() ))
<textarea
cols="60"
id="field.foo"
Expand All @@ -91,7 +91,6 @@ class SimpleEditingWidget(TextAreaWidget):
>&lt;h1&gt;&amp;copy;&lt;/h1&gt;</textarea>
"""

implements(IInputWidget)

default = ""
width = 60
Expand All @@ -102,7 +101,7 @@ class SimpleEditingWidget(TextAreaWidget):
rowFragment = ViewPageTemplateFile("simpleeditingrowfragment.pt")

def _toFieldValue(self, value):
if self.context.min_length and not value:
if self.context.min_length and not value: # pragma: no cover
return None
return super(SimpleEditingWidget, self)._toFieldValue(value)

Expand All @@ -117,6 +116,6 @@ def __call__(self):
contents=escape(self._getFormValue()),
extra=self.extra)

def contents(self):
def contents(self): # pragma: no cover
"""Make the contents available to the template"""
return self._getFormData()
Loading

0 comments on commit 0beb65d

Please sign in to comment.