Skip to content

Commit

Permalink
Add support for Python 3.8. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed May 1, 2020
1 parent 7a96c82 commit 43a6233
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,6 +7,7 @@
.installed.cfg
.mr.developer.cfg
.pytest_cache
.tox/
bin/
develop-eggs/
htmlcov/
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -2,3 +2,7 @@ version: ~> 1.0
language: python
import:
- source: icemac/icemac.addressbook:.travis-blueprint.yml
mode: merge
python:
- 2.7
- 3.8
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -5,6 +5,8 @@
2.6 (unreleased)
================

- Add support for Python 3.8.

- Move code repository to https://github.com/icemac/icemac.ab.importxls.


Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -26,9 +26,9 @@ or fork me at https://github.com/icemac/icemac.ab.importxls.
Running Tests
-------------

To run the tests yourself call::
To run the tests yourself call inside the checkout directory::

$ virtualenv-2.7 .
$ python3 -m venv .
$ bin/pip install zc.buildout
$ bin/buildout
$ bin/py.test
3 changes: 3 additions & 0 deletions buildout.cfg
Expand Up @@ -7,6 +7,9 @@ sources = sources
sources-dir = ..
allow-picked-versions = true
show-picked-versions = true
auto-checkout =
icemac.addressbook
icemac.ab.importer

[versions]
icemac.ab.importxls =
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Expand Up @@ -31,17 +31,20 @@ def read(*path_elements):
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
],
packages=setuptools.find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['icemac', 'icemac.ab'],
include_package_data=True,
zip_safe=False,
install_requires=[
'icemac.ab.importer >= 1.0',
'icemac.ab.importer >= 2.13.dev0',
'setuptools',
'six',
'xlrd',
],
extras_require=dict(
Expand Down
2 changes: 1 addition & 1 deletion src/icemac/__init__.py
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
2 changes: 1 addition & 1 deletion src/icemac/ab/__init__.py
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
8 changes: 5 additions & 3 deletions src/icemac/ab/importxls/xls.py
Expand Up @@ -3,6 +3,8 @@
import icemac.ab.importer.reader.base
import mmap
import xlrd
import six
from six.moves import range


class XLSReader(icemac.ab.importer.reader.base.BaseReader):
Expand Down Expand Up @@ -35,7 +37,7 @@ def _convert_value(self, value):
elif res == '':
res = None
elif isinstance(res, float):
res = unicode(res)
res = six.text_type(res)
return res

def getFieldNames(self):
Expand All @@ -50,10 +52,10 @@ def getFieldSamples(self, field_name):
if val is None:
val = u''
elif isinstance(val, datetime.date):
val = unicode(val.strftime('%Y-%m-%d'))
val = six.text_type(val.strftime('%Y-%m-%d'))
yield val

def __iter__(self):
"""Iterate over the file."""
for index in xrange(1, self.sheet.nrows):
for index in range(1, self.sheet.nrows):
yield [self._convert_value(val) for val in self.sheet.row(index)]
32 changes: 32 additions & 0 deletions tox.ini
@@ -0,0 +1,32 @@
[tox]
envlist =
py27
py38

# Caution: This is no replacement for running the tests using bin/py.test
# as it does _not_ run the jshint tests!
[testenv]
usedevelop = true
install_command = pip install --pre --upgrade {opts} {packages}
# extras = test # ignores -cconstraints.txt :´(
deps =
-chttps://raw.githubusercontent.com/icemac/icemac.addressbook/master/constraints.txt
.[test]
git+https://github.com/icemac/icemac.addressbook.git#egg=icemac.addressbook[test]
git+https://github.com/icemac/icemac.ab.importer.git#egg=icemac.ab.importer[test]
pudb
pytest
pytest-cov
pytest-flake8
pytest-instafail
pytest-pudb
pytest-remove-stale-bytecode
setenv =
zope_i18n_compile_mo_files = True
zope_i18n_allowed_languages = de,en
CHAMELEON_CACHE = {envtmpdir}
passenv =
HOME
PYTHONBREAKPOINT
commands =
pytest []

0 comments on commit 43a6233

Please sign in to comment.