Skip to content

Commit

Permalink
- add support for Python 3.9 and Zope 5
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Mar 29, 2021
1 parent 58f177b commit a4dce6f
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 31 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ matrix:
env: TOXENV=py37
- python: "3.8"
env: TOXENV=py38
- python: "3.9"
env: TOXENV=py39

before_install:
- mysql -e "CREATE DATABASE IF NOT EXISTS zmysqldatest;"
- mysql -e "CREATE USER 'zmysqldatest'@'localhost' IDENTIFIED BY 'zmysqldatest';"
- mysql -e "GRANT ALL PRIVILEGES ON zmysqldatest.* TO 'zmysqldatest'@'localhost';"

install:
- travis_retry pip install -U pip setuptools tox
- pip install -U pip tox

script:
- travis_retry tox
- tox

notifications:
email: false
Expand Down
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Products.ZMySQLDA change log

4.9 (unreleased)
----------------
- add support for Python 3.9 and Zope 5


4.8 (2020-07-13)
Expand Down
13 changes: 9 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
include *.txt
include *.rst
include tox.ini
include buildout*.cfg

recursive-include Products *
recursive-include docs *
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.txt
recursive-include docs Makefile

global-exclude *.pyc
global-exclude *.pyo
recursive-include Products *.dtml
recursive-include Products *.gif
recursive-include Products *.py
recursive-include Products *.svg
8 changes: 3 additions & 5 deletions Products/ZMySQLDA/DA.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ class Connection(ConnectionBase):
manage_properties._setName('manage_main')
manage_main = manage_properties

manage_options = (
ConnectionBase.manage_options[1:] +
({'label': 'Browse', 'action': 'manage_browse'},)
)
manage_options = (ConnectionBase.manage_options[1:] +
({'label': 'Browse', 'action': 'manage_browse'},))

def __init__(self, id, title, connection_string, check, use_unicode=None,
charset=None, auto_create_db=None, timeout=None):
Expand Down Expand Up @@ -147,7 +145,7 @@ def _getConnection(self):
self.connect(self.connection_string)
return self._v_database_connection

security.declareProtected(use_database_methods, 'connect') # NOQA: D001
security.declareProtected(use_database_methods, 'connect') # NOQA: D001

def connect(self, conn_string):
""" Base API. Opens connection to mysql. Raises if problems.
Expand Down
4 changes: 2 additions & 2 deletions Products/ZMySQLDA/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __call__(self, connection):
create_query = 'create database %s' % db
if self.use_unicode and not self.charset:
create_query += ' default character set %s' % (
self._db_cls.unicode_charset)
self._db_cls.unicode_charset)
elif self.charset:
create_query += ' default character set %s' % self.charset
connection.query(create_query)
Expand Down Expand Up @@ -476,7 +476,7 @@ def columns(self, table_name):
if short_type not in ('set', 'enum'):
if ',' in size:
info['scale'], info['precision'] = map(
int, size.split(',', 1))
int, size.split(',', 1))
else:
info['scale'] = int(size)
else:
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ Compatibility

* ``Zope`` 4 after 4.0beta5 under Python 2.7 and Python 3.5 and higher.

* ``Zope`` 5 under Python 3.6 and higher.

* MySQL versions 3.22 and later including MariaDB. You need version 4.1
or higher for unicode support.
4 changes: 1 addition & 3 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[buildout]
extends =
https://zopefoundation.github.io/Zope/releases/4.x/versions-prod.cfg
https://zopefoundation.github.io/Zope/releases/4.x/versions.cfg
https://zopefoundation.github.io/Zope/releases/master/versions.cfg
develop = .
parts =
test
Expand All @@ -10,7 +9,6 @@ parts =

[test]
recipe = zc.recipe.testrunner
defaults = ['-cv']
eggs =
Products.ZMySQLDA

Expand Down
4 changes: 0 additions & 4 deletions zope2.cfg → buildout2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
extends =
buildout.cfg
https://raw.githubusercontent.com/zopefoundation/Zope/2.13/version_ranges.cfg
develop = .
versions = versions
parts =
test

[versions]
zc.buildout =
Expand Down
4 changes: 4 additions & 0 deletions buildout4.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[buildout]
extends =
buildout.cfg
https://zopefoundation.github.io/Zope/releases/4.x/versions.cfg
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ no-accept-encodings = True
doctests = True
exclude =
bootstrap.py
ignore =
W504 # Line break after binary operator
htmldir = parts/flake8

[coverage:run]
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def read(*rnames):
'Framework :: Zope2',
'Framework :: Zope :: 2',
'Framework :: Zope :: 4',
'Framework :: Zope :: 5',
'License :: OSI Approved :: Zope Public License',
'Operating System :: OS Independent',
'Programming Language :: Python',
Expand All @@ -54,6 +55,7 @@ def read(*rnames):
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Database',
'Topic :: Database :: Front-Ends',
Expand All @@ -71,6 +73,6 @@ def read(*rnames):
'mysqlclient;python_version >= "3"',
],
extras_require={
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
},
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
},
)
22 changes: 13 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ envlist =
py36,
py37,
py38,
py39,
lint,
coverage

[testenv]
# We need to pin setuptools until we have zc.buildout 3.0.
commands_pre =
py27,py35: {envbindir}/buildout -nc {toxinidir}/buildout4.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
!py27-!py35: {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
commands =
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
coverage run {envbindir}/test
coverage run {envbindir}/test {posargs:-cv}
deps =
setuptools
setuptools < 52
zc.buildout
coverage
skip_install = true
Expand All @@ -24,15 +27,16 @@ setenv =

[testenv:py27_zope213]
basepython = python2.7
commands_pre =
{envbindir}/buildout -nc {toxinidir}/buildout2.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
commands =
{envbindir}/buildout -c {toxinidir}/zope2.cfg buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
{envbindir}/buildout -c {toxinidir}/zope2.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
{envbindir}/test
{envbindir}/test {posargs:-cv}

[testenv:coverage]
basepython = python3.6
commands =
commands_pre =
coverage erase
commands =
coverage combine
coverage html -i
coverage report
Expand All @@ -45,6 +49,7 @@ depends =
py36,
py37,
py38,
py39,
setenv =
COVERAGE_FILE={toxinidir}/.coverage

Expand All @@ -67,7 +72,6 @@ deps =
flake8-deprecated
flake8-todo
mccabe
flake8-blind-except
flake8-commas
flake8-string-format
flake8-quotes
Expand Down

0 comments on commit a4dce6f

Please sign in to comment.