forked from SciTools/cf-units
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
56 lines (41 loc) · 1.46 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
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
import versioneer
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.verbose = True
def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
def file_walk_relative(top, remove=''):
"""
Returns a generator of files from the top of the tree, removing
the given prefix from the root/file result.
"""
top = top.replace('/', os.path.sep)
remove = remove.replace('/', os.path.sep)
for root, dirs, files in os.walk(top):
for file in files:
yield os.path.join(root, file).replace(remove, '')
rootpath = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
return open(os.path.join(rootpath, *parts), 'r').read()
long_description = '{}'.format(read('README.rst'))
cmdclass = {'test': PyTest}
cmdclass.update(versioneer.get_cmdclass())
setup(
name='cf_units',
version=versioneer.get_version(),
url='https://github.com/SciTools/cf_units',
author='UK Met Office',
packages=['cf_units', 'cf_units/tests'],
package_data={'cf_units': list(file_walk_relative('cf_units/etc',
remove='cf_units/'))},
data_files=[('cf_units', ['COPYING', 'COPYING.LESSER'])],
tests_require=['pytest', 'pep8'],
cmdclass=cmdclass
)