From c9ce27c981d74c18f844fa71339c0177c3f76b28 Mon Sep 17 00:00:00 2001 From: marios Date: Fri, 29 Nov 2013 15:12:33 +0200 Subject: [PATCH] Make merge.py installable as a package using pbr Now that merge.py is invokable from another script (Ia6b6416fe10358d23f2b120283eecaf4c1178cfd) and from comments at that review, it makes sense to offer a nicer way to consume the merge functionality. Once you git clone tripleo-heat-templates you can python setup.py install and get /usr/bin/tripleo_heat_merge as well as a tripleo_heat_merge package in python2.7/site-packages. Makefile edits required because we moved merge.py into the tripleo_heat_merge directory for the packaging. Change-Id: I587fa7a826f93f89e8e5c266af7f5765438fe738 --- .gitignore | 4 ++++ Makefile | 10 +++++----- setup.cfg | 10 +++++----- test_merge.bash | 9 +++++---- tripleo_heat_merge/__init__.py | 0 merge.py => tripleo_heat_merge/merge.py | 0 6 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 tripleo_heat_merge/__init__.py rename merge.py => tripleo_heat_merge/merge.py (100%) diff --git a/.gitignore b/.gitignore index 0801599023..90c6090d47 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,7 @@ nosetests.xml *.swp doc/_build + +# Built by pbr (python setup.py sdist): +AUTHORS +ChangeLog diff --git a/Makefile b/Makefile index 38e495e5e5..b05f951a55 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,23 @@ overcloud.yaml: overcloud-source.yaml nova-compute-instance.yaml swift-source.yaml # $^ won't work here because we want to list nova-compute-instance.yaml as # a prerequisite but don't want to pass it into merge.py - python merge.py overcloud-source.yaml swift-source.yaml > $@.tmp + python ./tripleo_heat_merge/merge.py overcloud-source.yaml swift-source.yaml > $@.tmp mv $@.tmp $@ undercloud-vm.yaml: undercloud-source.yaml undercloud-vm-source.yaml - python merge.py $^ > $@.tmp + python ./tripleo_heat_merge/merge.py $^ > $@.tmp mv $@.tmp $@ undercloud-bm.yaml: undercloud-source.yaml undercloud-bm-source.yaml - python merge.py $^ > $@.tmp + python ./tripleo_heat_merge/merge.py $^ > $@.tmp mv $@.tmp $@ undercloud-vm-tuskar.yaml: undercloud-source.yaml undercloud-vm-source.yaml tuskar-source.yaml - python merge.py $^ > $@.tmp + python ./tripleo_heat_merge/merge.py $^ > $@.tmp mv $@.tmp $@ undercloud-vm-ironic.yaml: undercloud-source.yaml undercloud-vm-source.yaml ironic-source.yaml - python merge.py $^ > $@.tmp + python ./tripleo_heat_merge/merge.py $^ > $@.tmp mv $@.tmp $@ test: diff --git a/setup.cfg b/setup.cfg index 1a5cb59b56..28adf7c299 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,8 +17,8 @@ classifier = Environment :: Console [files] -data_files = - share/tripleo-heat-tempaltes/examples = examples/* - share/tripleo-heat-templates = - Makefile - *.yaml +packages = + tripleo_heat_merge +[entry_points] +console_scripts = + tripleo-heat-merge = tripleo_heat_merge.merge:main diff --git a/test_merge.bash b/test_merge.bash index e6bfb19262..2f8a4cc93a 100755 --- a/test_merge.bash +++ b/test_merge.bash @@ -23,10 +23,11 @@ run_test() { cleanup } echo -run_test "python merge.py examples/source.yaml" examples/source_lib_result.yaml -run_test "python merge.py examples/source2.yaml" examples/source2_lib_result.yaml -run_test "python merge.py examples/source_include_subkey.yaml" examples/source_include_subkey_result.yaml -run_test "python merge.py examples/launchconfig1.yaml examples/launchconfig2.yaml" examples/launchconfig_result.yaml +merge_py="./tripleo_heat_merge/merge.py" +run_test "python $merge_py examples/source.yaml" examples/source_lib_result.yaml +run_test "python $merge_py examples/source2.yaml" examples/source2_lib_result.yaml +run_test "python $merge_py examples/source_include_subkey.yaml" examples/source_include_subkey_result.yaml +run_test "python $merge_py examples/launchconfig1.yaml examples/launchconfig2.yaml" examples/launchconfig_result.yaml echo trap - EXIT exit $fail diff --git a/tripleo_heat_merge/__init__.py b/tripleo_heat_merge/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/merge.py b/tripleo_heat_merge/merge.py similarity index 100% rename from merge.py rename to tripleo_heat_merge/merge.py