forked from hearsaycorp/django-richenum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·121 lines (106 loc) · 3.78 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
tests_require = (
'pytest<5.0',
'pytest-django',
)
install_requires = (
'Django>=1.11,<3.1',
'richenum',
'six',
)
class DjangoTest(TestCommand):
DIRNAME = os.path.dirname(__file__)
APPS = ('tests',)
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
from django.conf import settings
import django
db_host = os.environ.get('DJANGO_DB_HOST')
db_engine = os.environ.get('DJANGO_DB_ENGINE', 'sqlite')
db_user = os.environ.get('DJANGO_DB_USER')
db_pass = os.environ.get('DJANGO_DB_PASSWORD')
if db_engine == 'mysql':
db_settings = {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'testdb',
'USER': db_user or 'root',
'HOST': db_host,
'PASSWORD': db_pass
}
elif db_engine == 'postgres':
db_settings = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'testdb',
'USER': db_user or 'postgres',
'HOST': db_host,
'PASSWORD': db_pass
}
elif db_engine == 'sqlite':
db_settings = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(self.DIRNAME, 'database.db'),
}
else:
raise ValueError("Unknown DB engine: %s" % db_engine)
settings.configure(
DEBUG=True,
DATABASES={'default': db_settings},
CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache'
}
},
MIDDLEWARE_CLASSES=['django.middleware.common.CommonMiddleware'],
INSTALLED_APPS=(
# Default Django apps from settings template
# https://github.com/django/django/blob/2.1/django/conf/project_template/project_name/settings.py-tpl
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles') + self.APPS)
django.setup()
sys.exit(pytest.main(["tests/"]))
setup(
name='django-richenum',
version='3.8.0',
description='Django Enum library for python.',
long_description=(
open('README.rst').read() + '\n\n' +
open('CHANGELOG.rst').read() + '\n\n' +
open('AUTHORS.rst').read()),
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
],
keywords='python django enum richenum',
url='https://github.com/hearsaycorp/django-richenum',
author='Hearsay Social',
author_email='[email protected]',
license='MIT',
package_dir={'': 'src'},
packages=find_packages('src'),
install_requires=install_requires,
tests_require=tests_require,
cmdclass={'test': DjangoTest},
)