]> git.proxmox.com Git - ovs.git/blame - python/setup.py
python: Send old values of the updated cols in notify for update2
[ovs.git] / python / setup.py
CommitLineData
77e2b031
TW
1# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at:
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13from __future__ import print_function
14import sys
15
c63b04d6
TW
16from distutils.command.build_ext import build_ext
17from distutils.errors import CCompilerError, DistutilsExecError, \
18 DistutilsPlatformError
19
77e2b031
TW
20import setuptools
21
22VERSION = "unknown"
23
24try:
25 # Try to set the version from the generated ovs/version.py
3ab76c56 26 exec(open("ovs/version.py").read())
77e2b031
TW
27except IOError:
28 print("Ensure version.py is created by running make python/ovs/version.py",
29 file=sys.stderr)
30 sys.exit(-1)
31
c63b04d6
TW
32ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
33if sys.platform == 'win32':
34 ext_errors += (IOError, ValueError)
35
36
37class BuildFailed(Exception):
38 pass
39
40
41class try_build_ext(build_ext):
42 # This class allows C extension building to fail
43 # NOTE: build_ext is not a new-style class
44
45 def run(self):
46 try:
47 build_ext.run(self)
48 except DistutilsPlatformError:
49 raise BuildFailed()
77e2b031 50
c63b04d6
TW
51 def build_extension(self, ext):
52 try:
53 build_ext.build_extension(self, ext)
54 except ext_errors:
55 raise BuildFailed()
56
57
58setup_args = dict(
77e2b031
TW
59 name='ovs',
60 description='Open vSwitch library',
61 version=VERSION,
62 url='http://www.openvswitch.org/',
63 author='Open vSwitch',
64 author_email='dev@openvswitch.org',
65 packages=['ovs', 'ovs.db', 'ovs.unixctl'],
66 keywords=['openvswitch', 'ovs', 'OVSDB'],
67 license='Apache 2.0',
68 classifiers=[
69 'Development Status :: 5 - Production/Stable',
70 'Topic :: Database :: Front-Ends',
71 'Topic :: Software Development :: Libraries :: Python Modules',
72 'Topic :: System :: Networking',
99c8be3e
RB
73 'License :: OSI Approved :: Apache Software License',
74 'Programming Language :: Python :: 2',
75 'Programming Language :: Python :: 2.7',
76 'Programming Language :: Python :: 3',
77 'Programming Language :: Python :: 3.4',
c63b04d6
TW
78 ],
79 ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"],
80 libraries=['openvswitch'])],
81 cmdclass={'build_ext': try_build_ext},
77e2b031 82)
c63b04d6
TW
83
84try:
85 setuptools.setup(**setup_args)
86except BuildFailed:
87 BUILD_EXT_WARNING = ("WARNING: The C extension could not be compiled, "
88 "speedups are not enabled.")
89 print("*" * 75)
90 print(BUILD_EXT_WARNING)
91 print("Failure information, if any, is above.")
92 print("Retrying the build without the C extension.")
93 print("*" * 75)
94
95 del(setup_args['cmdclass'])
96 del(setup_args['ext_modules'])
97 setuptools.setup(**setup_args)