from __future__ import print_function

# import ez_setup
# ez_setup.use_setuptools()
import sys
from typtop.config import (
    VERSION, set_distro, first_msg, GITHUB_URL
)

if sys.argv[-1] == 'tag':
    import subprocess
    subprocess.Popen("git tag -f -a {0} -m 'Release: {0}'"\
                     .format(VERSION), shell=True)
    exit(0)

if sys.argv[-1] == 'upload':
    import subprocess
    subprocess.Popen(
        "git push origin --tags && git push origin master", shell=True
    )
    subprocess.Popen(
        "python setup.py bdist_wheel bdist_egg sdist upload -r pypitest", shell=True
    )
    exit(0)

if sys.argv[-1] == 'publish':
    import subprocess
    subprocess.Popen(
        "git push origin --tags && git push origin master", shell=True
    )
    subprocess.Popen(
        "python setup.py bdist_wheel bdist_egg sdist upload -r pypi", shell=True
    )
    exit(0)

from setuptools import setup


SCRIPTS = [
    # 'typtop/send_typo_log.py',    # all in typtop
    'typtop/typtops.py'
]

DISTRO = set_distro()

# OLD, not used now
LIB_DEPENDENCIES = {
    'debian': [
        'libffi-dev', 'python-pkg-resources', 'libssl-dev',
        'python-setuptools', 'python-dev',
    ],
    # Fedora does not have python-pam!! So, we cannot write the fedora
    # version.
    'fedora': [
        'libffi-devel', 'openssl-devel',
        'python-devel', 'python-pip', 'python-setuptools',
    ],
    'darwin': [],
    'arch'  : [],
}[DISTRO]

PACMAN = {
    'debian': 'apt-get install -y'.split(),
    'fedora': 'yum install -y'.split(),
    'darwin': [],
    'arch': [],
}[DISTRO]

PYTHON_DEPS = [
    'cryptography==1.8.1',
    # 'pycryptodome',
    'word2keypress>=1.0.10',
    # 'dataset',
    'zxcvbn-python==4.4.14',
    'requests==2.13', # 2.12 has issue with x509 cetificate
    'pyyaml==3.12',
    'distro==1.0.2',
]

OPTIONS = {
    'argv_emulation': True,
    # 'packages': ['requests', 'requests', 'selenium']
}


TEST_REQUIRES = ['python-pam', 'pytest']

setup(
    name='typtop',   # 'loginwitherror',
    # app=['typtop/dbaccess.py'],
    packages=['typtop'], # this must be the same as the name above
    version=VERSION,
    description='Adaptive typo-tolerant password checking for Debian logins',
    long_description=first_msg,
    author='<NAME>, <NAME>',
    author_email='<EMAIL>',
    url=GITHUB_URL,
    download_url='{}/tarball/{}'.format(GITHUB_URL, VERSION),
    keywords=[
        'Password', 'typo-tolerance',
        'login-with-errors', 'Login'
    ],
    # scripts=SCRIPTS,
    entry_points={
        'console_scripts': [
            'typtops.py = typtop.typtops:main',
            'send_typo_log.py = typtop.send_typo_log:main']
    },
    license='MIT',
    # package_dir={'typtop': 'typtop/'},
    # package_data={
    #     'typtop': ['../LICENSE', '../README.md', 'typtopserver.crt'],
    # },
    data_files=[],  # DATA_FILES,
    include_package_data=True,
    options={'py2app': OPTIONS},
    classifiers=['Development Status :: 4 - Beta'],
    install_requires=PYTHON_DEPS,
    # cmdclass={'install': CustomInstaller},
    zip_safe=True,
)

from __future__ import print_function

# import ez_setup
# ez_setup.use_setuptools()
import sys
from typtop.config import (
    VERSION, set_distro, first_msg, GITHUB_URL
)

if sys.argv[-1] == 'tag':
    import subprocess
    subprocess.Popen("git tag -f -a {0} -m 'Release: {0}'"\
                     .format(VERSION), shell=True)
    exit(0)

if sys.argv[-1] == 'upload':
    import subprocess
    subprocess.Popen(
        "git push origin --tags && git push origin master", shell=True
    )
    subprocess.Popen(
        "python setup.py bdist_wheel bdist_egg sdist upload -r pypitest", shell=True
    )
    exit(0)

if sys.argv[-1] == 'publish':
    import subprocess
    subprocess.Popen(
        "git push origin --tags && git push origin master", shell=True
    )
    subprocess.Popen(
        "python setup.py bdist_wheel bdist_egg sdist upload -r pypi", shell=True
    )
    exit(0)

from setuptools import setup


SCRIPTS = [
    # 'typtop/send_typo_log.py',    # all in typtop
    'typtop/typtops.py'
]

DISTRO = set_distro()

# OLD, not used now
LIB_DEPENDENCIES = {
    'debian': [
        'libffi-dev', 'python-pkg-resources', 'libssl-dev',
        'python-setuptools', 'python-dev',
    ],
    # Fedora does not have python-pam!! So, we cannot write the fedora
    # version.
    'fedora': [
        'libffi-devel', 'openssl-devel',
        'python-devel', 'python-pip', 'python-setuptools',
    ],
    'darwin': [],
    'arch'  : [],
}[DISTRO]

PACMAN = {
    'debian': 'apt-get install -y'.split(),
    'fedora': 'yum install -y'.split(),
    'darwin': [],
    'arch': [],
}[DISTRO]

PYTHON_DEPS = [
    'cryptography==1.8.1',
    # 'pycryptodome',
    'word2keypress>=1.0.10',
    # 'dataset',
    'zxcvbn-python==4.4.14',
    'requests==2.13', # 2.12 has issue with x509 cetificate
    'pyyaml==3.12',
    'distro==1.0.2',
]

OPTIONS = {
    'argv_emulation': True,
    # 'packages': ['requests', 'requests', 'selenium']
}


TEST_REQUIRES = ['python-pam', 'pytest']

setup(
    name='typtop',   # 'loginwitherror',
    # app=['typtop/dbaccess.py'],
    packages=['typtop'], # this must be the same as the name above
    version=VERSION,
    description='Adaptive typo-tolerant password checking for Debian logins',
    long_description=first_msg,
    author='<NAME>, <NAME>',
    author_email='<EMAIL>',
    url=GITHUB_URL,
    download_url='{}/tarball/{}'.format(GITHUB_URL, VERSION),
    keywords=[
        'Password', 'typo-tolerance',
        'login-with-errors', 'Login'
    ],
    # scripts=SCRIPTS,
    entry_points={
        'console_scripts': [
            'typtops.py = typtop.typtops:main',
            'send_typo_log.py = typtop.send_typo_log:main']
    },
    license='MIT',
    # package_dir={'typtop': 'typtop/'},
    # package_data={
    #     'typtop': ['../LICENSE', '../README.md', 'typtopserver.crt'],
    # },
    data_files=[],  # DATA_FILES,
    include_package_data=True,
    options={'py2app': OPTIONS},
    classifiers=['Development Status :: 4 - Beta'],
    install_requires=PYTHON_DEPS,
    # cmdclass={'install': CustomInstaller},
    zip_safe=True,
)

# import ez_setup # ez_setup.use_setuptools() # 'typtop/send_typo_log.py',    # all in typtop # OLD, not used now # Fedora does not have python-pam!! So, we cannot write the fedora # version. # 'pycryptodome', # 'dataset', # 2.12 has issue with x509 cetificate # 'packages': ['requests', 'requests', 'selenium'] # 'loginwitherror', # app=['typtop/dbaccess.py'], # this must be the same as the name above # scripts=SCRIPTS, # package_dir={'typtop': 'typtop/'}, # package_data={ #     'typtop': ['../LICENSE', '../README.md', 'typtopserver.crt'], # }, # DATA_FILES, # cmdclass={'install': CustomInstaller},