This repository has been archived by the owner on Mar 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
74 lines (58 loc) · 1.83 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
#!/usr/bin/env python2
from distutils.core import setup, Command
import unittest
import sys
class test_cmd(Command):
description = "run automated tests"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import tests
unittest.main(tests, argv=sys.argv[:-1])
class bootstrap(Command):
description = "initialize database and fixed data"
user_options = [
('notables', 'n', "don't create tables"),
('blank', 'b', "don't add test data")
]
def initialize_options(self):
self.blank = False
self.notables = False
def finalize_options(self):
pass
def run(self):
import utils.create
import utils.data
from bbschema import config
if not self.notables:
utils.create.create_all(
config.HOSTNAME, config.PORT, config.USERNAME, config.PASSWORD,
config.DATABASE
)
utils.data.create_fixed(config.HOSTNAME, config.PORT, config.USERNAME,
config.PASSWORD, config.DATABASE)
if not self.blank:
utils.data.create_test(
config.HOSTNAME, config.PORT, config.USERNAME, config.PASSWORD,
config.DATABASE
)
if __name__ == '__main__':
cmd_classes = {
'test': test_cmd,
'bootstrap': bootstrap,
}
setup(
cmdclass=cmd_classes,
name='bbschema',
version='1.0',
description='Schema for the BookBrainz database',
author='Ben Ockmore',
author_email='[email protected]',
url='https://bitbucket.org/bookbrainz/schema',
packages=['bbschema'],
requires=['sqlalchemy (>=0.9.7)', 'psycopg2 (>=2.5.4)'],
provides=['bbschema'],
)