# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###

import sys
from setuptools import setup, find_packages

install_requires = (
    'psycopg2>=2.5',
    )

tests_require = [
    ]

if sys.version_info.major < 3:
    tests_require.append('mock')

LONG_DESC = '\n\n~~~~\n\n'.join([open('README.rst').read(),
                                 open('CHANGELOG.rst').read()])

setup(
    name='db-migrator',
    version='1.0.0',
    author='Connexions',
    author_email='info@cnx.org',
    url='https://github.com/karenc/db-migrator',
    license='AGPL, see also LICENSE.txt',
    description='Python package to migrate postgresql database',
    long_description=LONG_DESC,
    packages=find_packages(),
    install_requires=install_requires,
    tests_require=tests_require,
    test_suite='dbmigrator.tests',
    include_package_data=True,
    entry_points={
        'console_scripts': [
            'dbmigrator = dbmigrator.cli:main',
            ],
        },
    )

# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###

import sys
from setuptools import setup, find_packages

install_requires = (
    'psycopg2>=2.7',
    )

tests_require = [
    ]

if sys.version_info.major < 3:
    tests_require.append('mock')

LONG_DESC = '\n\n~~~~\n\n'.join([open('README.rst').read(),
                                 open('CHANGELOG.rst').read()])

setup(
    name='db-migrator',
    version='1.0.0',
    author='Connexions',
    author_email='info@cnx.org',
    url='https://github.com/karenc/db-migrator',
    license='AGPL, see also LICENSE.txt',
    description='Python package to migrate postgresql database',
    long_description=LONG_DESC,
    packages=find_packages(),
    install_requires=install_requires,
    tests_require=tests_require,
    test_suite='dbmigrator.tests',
    include_package_data=True,
    entry_points={
        'console_scripts': [
            'dbmigrator = dbmigrator.cli:main',
            ],
        },
    )

Update minimum version of psycopg2 required
Update minimum version of psycopg2 required

For the `super_user` context manager, we are doing something like:

```
db_conn = psycopg2.connect('user=tester dbname=testing', user='postgres')
```

This was not supported by psycopg2 < 2.7:

```
Traceback (most recent call last):
  File \"/var/cnx/venvs/publishing/bin/dbmigrator\", line 11, in <module>
    sys.exit(main())
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/cli.py\", line 104, in main
    return args['cmmd'](**args)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 145, in wrapper
    return func(cursor, *args, **kwargs)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/commands/migrate.py\", line 32, in cli_command
    run_deferred)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 227, in compare_schema
    callback(*args, **kwargs)
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 257, in run_migration
    migration.up(cursor)
  File \"../../var/cnx/venvs/publishing/src/cnx-db/cnxdb/migrations/20170912134157_shred-colxml-uuids.py\", line 19, in up
    with super_user() as super_cursor:
  File \"/usr/lib/python2.7/contextlib.py\", line 17, in __enter__
    return self.gen.next()
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/dbmigrator/utils.py\", line 57, in super_user
    user=super_user) as db_conn:
  File \"/var/cnx/venvs/publishing/local/lib/python2.7/site-packages/psycopg2/__init__.py\", line 155, in connect
    % items[0][0])
TypeError: 'user' is an invalid keyword argument when the dsn is specified
```
