-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetup.py
More file actions
142 lines (125 loc) · 5.25 KB
/
setup.py
File metadata and controls
142 lines (125 loc) · 5.25 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
"""
The test and clean code is shamelessly stolen from
http://da44en.wordpress.com/2002/11/22/using-distutils/
"""
from distutils.core import Command, setup
from distutils import log
from distutils.fancy_getopt import fancy_getopt
from unittest import TextTestRunner, TestLoader
from glob import glob
from os.path import splitext, basename, join as pjoin, walk
from warnings import warn
import os
import time
class TestCommand(Command):
user_options = [('verbose', 'v', "produce verbose output", 1)]
def initialize_options(self):
self._dir = os.getcwd()
def finalize_options(self):
args, obj = fancy_getopt(self.user_options, {}, None, None)
# Ugly as sin, but distutils forced me to do it :(
# All I wanted was this command to default to quiet...
if "--verbose" not in args and "-v" not in args:
self.verbose = 0
def run(self):
'''
Finds all the tests modules in tests/, and runs them, exiting after they are all done
'''
log.set_verbosity(self.verbose)
testfiles = [ ]
for t in glob(pjoin(self._dir, 'tests', 'test*.py')):
if not t.endswith('__init__.py'):
testfiles.append('.'.join(
['tests', splitext(basename(t))[0]])
)
self.announce("Test files:" + str(testfiles), level=2)
tests = TestLoader().loadTestsFromNames(testfiles)
t = TextTestRunner(verbosity = self.verbose)
t.run(tests)
exit()
class CleanCommand(Command):
"""
Remove all build files and all compiled files
=============================================
Remove everything from build, including that
directory, and all .pyc files
"""
user_options = [('verbose', 'v', "produce verbose output", 1)]
def initialize_options(self):
self._files_to_delete = [ ]
self._dirs_to_delete = [ ]
for root, dirs, files in os.walk('.'):
for f in files:
if f.endswith('.pyc') or f.endswith('.class'):
self._files_to_delete.append(pjoin(root, f))
for root, dirs, files in os.walk(pjoin('build')):
for f in files:
self._files_to_delete.append(pjoin(root, f))
for d in dirs:
self._dirs_to_delete.append(pjoin(root, d))
# reverse dir list to only get empty dirs
self._dirs_to_delete.reverse()
self._dirs_to_delete.append('build')
def finalize_options(self):
args, obj = fancy_getopt(self.user_options, {}, None, None)
# Ugly as sin, but distutils forced me to do it :(
# All I wanted was this command to default to quiet...
if "--verbose" not in args and "-v" not in args:
self.verbose = 0
def run(self):
for clean_me in self._files_to_delete:
if self.dry_run:
log.info("Would have unlinked " + clean_me)
else:
try:
self.announce("Deleting " + clean_me, level=2)
os.unlink(clean_me)
except Exception, e:
message = " ".join(["Failed to delete file", clean_me, str(e)])
log.warn(message)
for clean_me in self._dirs_to_delete:
if self.dry_run:
log.info("Would have rmdir'ed " + clean_me)
else:
if os.path.exists(clean_me):
try:
self.announce("Going to remove " + clean_me, level=2)
os.rmdir(clean_me)
except Exception, e:
message = " ".join(
["Failed to delete dir", clean_me, str(e)])
log.warn(message)
elif clean_me != "build":
log.warn(clean_me + " does not exist")
setup(
name = "intermine-bio",
packages = ["interminebio"],
cmdclass = { 'test': TestCommand, 'clean': CleanCommand },
version = "0.99.01",
description = "Biological Extensions to the InterMine WebService client",
author = "Alex Kalderimis",
author_email = "dev@intermine.org",
url = "http://www.intermine.org",
download_url = "http://www.intermine.org/lib/python-webservice-client-0.98.02.tar.gz",
keywords = ["webservice", "genomic", "bioinformatics"],
requires=["intermine"],
classifiers = [
"Programming Language :: Python",
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Information Analysis",
"Operating System :: OS Independent",
],
license = "LGPL",
long_description = """\
Biological Extensions to the InterMine Webservice Client
--------------------------------------------------------
Provides access routines to datawarehouses powered
by InterMine technology.
""",
)