diff options
-rw-r--r-- | tosca2heat/heat-translator/setup.cfg | 2 | ||||
-rw-r--r-- | tosca2heat/heat-translator/setup.py | 47 |
2 files changed, 48 insertions, 1 deletions
diff --git a/tosca2heat/heat-translator/setup.cfg b/tosca2heat/heat-translator/setup.cfg index 863b97d..2a10811 100644 --- a/tosca2heat/heat-translator/setup.cfg +++ b/tosca2heat/heat-translator/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = heat-translator +name = nfv-heattranslator version = url = https://wiki.opnfv.org/display/parser summary = Tool to translate non-heat templates to Heat Orchestration Template in nfv. diff --git a/tosca2heat/heat-translator/setup.py b/tosca2heat/heat-translator/setup.py index 566d844..bf9aa00 100644 --- a/tosca2heat/heat-translator/setup.py +++ b/tosca2heat/heat-translator/setup.py @@ -14,8 +14,13 @@ # limitations under the License. # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import os import setuptools +from distutils.command.install_data import install_data +from setuptools.command.build_py import build_py +from setuptools.command.install import install + # In python < 2.7.4, a lazy loading of package `pbr` will break # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 @@ -24,6 +29,48 @@ try: except ImportError: pass + +class HeatTranslator_build_py(build_py): + """Override build_py to call customized build.""" + + def run(self): + print(" === Before nfv heat translator build === ") + # self.run_command('xxx') + super(HeatTranslator_build_py, self).run() + print(" === After nfv heat heat translator build === ") + + +class HeatTranslator_install(install): + """Override install to call customized install.""" + + def run(self): + print(" === Before nfv heat translator install === ") + # Make sure uninstall toscaparser from openstack + os.system("pip uninstall -y heat-translator") + + super(HeatTranslator_install, self).run(self) + # Custom stuff here + # distutils.command.install actually has some nice helper methods + # and interfaces. I strongly suggest reading the docstrings. + print(" === After nfv heat translator install === ") + + +class HeatTranslator_post_install(install_data): + """Override install_data to call customized install_data.""" + + def run(self): + print(" === Before nfv heat translator post install data === ") + # Call parent + super(HeatTranslator_post_install, self).run(self) + # Execute commands + print(" === After nfv heat translator post install data ===") + + setuptools.setup( setup_requires=['pbr>=2.0.0'], + cmdclass={ + "build_py": HeatTranslator_build_py, + "install_data": HeatTranslator_install, + "post_install": HeatTranslator_post_install, + }, pbr=True) |