Merge "Disable syslog in heat-translator for functest integration"
[parser.git] / tosca2heat / heat-translator / setup.py
1 # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
17 import os
18 import setuptools
19
20 from distutils.command.install_data import install_data
21 from setuptools.command.build_py import build_py
22 from setuptools.command.install import install
23
24 # In python < 2.7.4, a lazy loading of package `pbr` will break
25 # setuptools if some other modules registered functions in `atexit`.
26 # solution from: http://bugs.python.org/issue15881#msg170215
27 try:
28     import multiprocessing  # noqa
29 except ImportError:
30     pass
31
32
33 class HeatTranslator_build_py(build_py):
34     """Override build_py to call customized build."""
35
36     def run(self):
37         print(" ===  Before nfv heat translator build === ")
38         # self.run_command('xxx')
39         super(HeatTranslator_build_py, self).run()
40         print(" ===  After nfv heat heat translator build === ")
41
42
43 class HeatTranslator_install(install):
44     """Override install to call customized install."""
45
46     def run(self):
47         print(" ===  Before nfv heat translator install === ")
48         # Make sure uninstall toscaparser from openstack
49         os.system("pip uninstall -y heat-translator")
50
51         super(HeatTranslator_install, self).run(self)
52         # Custom stuff here
53         # distutils.command.install actually has some nice helper methods
54         # and interfaces. I strongly suggest reading the docstrings.
55         print(" === After nfv heat translator install === ")
56
57
58 class HeatTranslator_post_install(install_data):
59     """Override install_data to call customized install_data."""
60
61     def run(self):
62         print(" === Before nfv heat translator post install data === ")
63         # Call parent
64         super(HeatTranslator_post_install, self).run(self)
65         # Execute commands
66         print(" === After nfv heat translator post install data ===")
67
68
69 setuptools.setup(
70     setup_requires=['pbr>=2.0.0'],
71     cmdclass={
72         "build_py": HeatTranslator_build_py,
73         "install_data": HeatTranslator_install,
74         "post_install": HeatTranslator_post_install,
75     },
76     pbr=True)