forked from marook/tagfs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
133 lines (118 loc) · 3.94 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
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env python
#
# Copyright 2009 Peter Prohaska
#
# This file is part of tagfs.
#
# tagfs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# tagfs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with tagfs. If not, see <http://www.gnu.org/licenses/>.
#
from distutils.core import setup, Command
import sys
import os
from os.path import (
basename,
dirname,
abspath,
splitext,
join as pjoin
)
from glob import glob
from unittest import TestLoader, TextTestRunner
projectdir = dirname(abspath(__file__))
srcdir = pjoin(projectdir, 'src')
moddir = pjoin(srcdir, 'modules')
testdir = pjoin(projectdir, 'test')
testdatadir = pjoin(projectdir, 'etc', 'test', 'events')
testmntdir = pjoin(projectdir, 'mnt')
class test(Command):
description = 'run tests'
user_options = []
def initialize_options(self):
self._cwd = os.getcwd()
self._verbosity = 2
def finalize_options(self): pass
def run(self):
import re
testPyMatcher = re.compile('(.*/)?test[^/]*[.]py', re.IGNORECASE)
tests = ['.'.join([
basename(testdir), splitext(basename(f))[0]
]) for f in glob(pjoin(
testdir, '*.py'
)) if testPyMatcher.match(f)]
print "..using:"
print " testdir:", testdir
print " testdatadir:", testdatadir
print " testmntdir:", testmntdir
print " tests:", tests
print " sys.path:", sys.path
print
sys.path.insert(0, moddir)
sys.path.insert(0, srcdir)
suite = TestLoader().loadTestsFromNames(tests)
TextTestRunner(verbosity=self._verbosity).run(suite)
# Overrides default clean (which cleans from build runs)
# This clean should probably be hooked into that somehow.
class clean_pyc(Command):
description = 'remove *.pyc files from source directory'
user_options = []
def initialize_options(self):
self._delete = []
for cwd, dirs, files in os.walk(projectdir):
self._delete.extend(
pjoin(cwd, f) for f in files if f.endswith('.pyc')
)
def finalize_options(self): pass
def run(self):
for f in self._delete:
try:
os.unlink(f)
except OSError, e:
print "Strange '%s': %s" % (f, e)
# Could be a directory.
# Can we detect file in use errors or are they OSErrors
# as well?
# Shall we catch all?
setup(
cmdclass = {
'test': test,
'clean_pyc': clean_pyc,
},
name = 'tagfs',
version = '0.1',
url = 'http://wiki.github.com/marook/tagfs',
description = '',
long_description = '',
author = 'Markus Pielmeier',
author_email = '[email protected]',
license = 'GPLv3',
download_url = 'http://github.com/marook/tagfs/downloads/tagfs_0.1-src.tar.bz2',
platforms = 'Linux',
requires = [],
classifiers = [
'Development Status :: 2 - Pre-Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Topic :: System :: Filesystems'
],
data_files = [
(pjoin('share', 'doc', 'tagfs'), ['AUTHORS', 'COPYING', 'README'])
],
scripts = [pjoin('src', 'tagfs')],
packages = ['tagfs'],
package_dir = {'': pjoin('src', 'modules')},
)