forked from bukzor/RefactorLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·72 lines (63 loc) · 1.9 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
#!/usr/bin/env python
def main():
from refactorlib import __version__
import setuptools
setuptools.setup(
name = 'refactorlib',
version = __version__,
author = 'Buck Golemon',
author_email = 'buck@yelp.com',
description = 'A library to help automate refactoring',
long_description = open('README.markdown').read(),
url = 'http://github.com/bukzor/RefactorLib/',
packages = ['refactorlib'],
platforms = 'any',
cmdclass = {'test': PyTest},
license = 'BSD',
install_requires = [ 'lxml>=2.2' ], # We run with 2.2.4.0
scripts = [ 'xmlfrom', 'xmlstrip' ],
# See http://pypi.python.org/pypi?%3Aaction==list_classifiers
classifiers = [
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
#'Programming Language :: Python :: 2.4',
#'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
#'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
from setuptools.command.test import test
class PyTest(test):
"""
Hook up py.test to `setup.py test`
see: http://pytest.org/latest/goodpractises.html
"""
def get_pytest(self):
try:
import pytest
return pytest
except ImportError:
from os import environ
if 'VIRTUAL_ENV' in environ:
# We run with 2.2.1
import subprocess
errno = subprocess.call(['pip', 'install', 'pytest>=2.2'])
if errno: raise SystemExit(errno)
import pytest
return pytest
else:
raise
def run(self):
pytest = self.get_pytest()
# remove commandline args so that pytest doesn't get confused
from sys import argv
del argv[:]
print 'Run `py.test` for more control over testing.'
raise SystemExit(pytest.cmdline.main())
if __name__ == '__main__':
main()