-
Notifications
You must be signed in to change notification settings - Fork 32
/
setup.py
executable file
·60 lines (53 loc) · 1.49 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
#!/usr/bin/env python
import fnmatch
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
package_exclude = [
"*.tests",
"*.tests.*",
"tests.*",
"tests",
]
file_exclude = []
tests_require = []
py_install_requires = [
'pyyaml',
'bottle',
]
if sys.version_info.major == 2:
# these sources are python3 only, they raise SyntaxError on python2
package_exclude.extend([
'*.daemon',
'*.daemon.*',
'*.rpc',
'*.rpc.*',
])
file_exclude.extend([
'*/daemon.py',
])
tests_require.extend([
'mock<=3.0.5', # for python2, version >=4.0.0 drops support for py2
])
py_install_requires.extend([
'enum34', # for python2, enum support requires this package
])
class build_py_with_exclude(build_py):
def find_package_modules(self, package, package_dir):
modules = build_py.find_package_modules(self, package, package_dir)
return [
(pkg, mod, f)
for (pkg, mod, f) in modules
if not any(fnmatch.fnmatchcase(f, pat=pattern) for pattern in file_exclude)
]
setup(
name='platform-arista',
version='%s' % os.environ.get('ARISTA_PLATFORM_MODULE_VERSION', '1.0'),
description='Module to initialize arista platforms',
install_requires=py_install_requires,
packages=find_packages(exclude=package_exclude),
test_suite='arista.tests.selftest.allTests',
tests_require=tests_require,
cmdclass={'build_py': build_py_with_exclude},
)