Package for funectest
[parser.git] / tosca2heat / tosca-parser / 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
28
29 try:
30     import multiprocessing  # noqa
31 except ImportError:
32     pass
33
34
35 class Toscaparser_build_py(build_py):
36     """Override build_py to call customized build."""
37
38     def run(self):
39         print(" ===  Before nfv toscaparser build === ")
40         # self.run_command('xxx')
41         super(Toscaparser_build_py, self).run()
42         print(" ===  After nfv toscaparser build === ")
43
44
45 class Toscaparser_install(install):
46     """Override install to call customized install."""
47
48     def run(self):
49         print(" ===  Before nfv toscaparser install === ")
50         # Make sure uninstall toscaparser from openstack
51         os.system("pip uninstall -y tosca-parser")
52
53         super(Toscaparser_install, self).run(self)
54         # Custom stuff here
55         # distutils.command.install actually has some nice helper methods
56         # and interfaces. I strongly suggest reading the docstrings.
57         print(" === After nfv toscaparser install === ")
58
59
60 class Toscaparser_post_install(install_data):
61     """Override install_data to call customized install_data."""
62
63     def run(self):
64         print(" === Before nfv toscaparser post install data === ")
65         # Call parent
66         super(Toscaparser_post_install, self).run(self)
67         # Execute commands
68         print(" === After nfv toscaparser post install data ===")
69
70
71 setuptools.setup(
72     setup_requires=['pbr>=2.0.0'],
73     cmdclass={
74         "build_py": Toscaparser_build_py,
75         "install_data": Toscaparser_install,
76         "post_install": Toscaparser_post_install,
77     },
78     pbr=True)