From cb3395823086005f04971adf935062c556fabff6 Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Tue, 11 Aug 2015 16:38:44 -0700 Subject: [PATCH] Add vmtp_genchart into pip console_scripts Change-Id: I17fa14d7917cdcc1bae21c22b1bc57bd2faa2b79 --- .gitignore | 1 + doc/source/installation.rst | 4 ++-- images | 1 - setup.cfg | 1 + vmtp/{genchart.py => vmtp_genchart.py} | 10 +++++++--- 5 files changed, 11 insertions(+), 6 deletions(-) delete mode 120000 images rename vmtp/{genchart.py => vmtp_genchart.py} (98%) mode change 100644 => 100755 diff --git a/.gitignore b/.gitignore index 58d97fd..c115f12 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ ChangeLog # vmtp *.local* *.json +*.html diff --git a/doc/source/installation.rst b/doc/source/installation.rst index eb463e6..f7e15ea 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -29,7 +29,7 @@ RHEL/CentOS based: .. code-block:: bash $ sudo yum install python-devel python-virtualenv git - # sudo yum install libxml2-devel libxslt-devel libffi-devel libyaml-devel openssl-devel + $ sudo yum install libxml2-devel libxslt-devel libffi-devel libyaml-devel openssl-devel MacOSX: @@ -87,7 +87,7 @@ Super quick installation on RHEL/CentOS .. code-block:: bash $ sudo yum install python-devel python-virtualenv git - # sudo yum install libxml2-devel libxslt-devel libffi-devel libyaml-devel openssl-devel + $ sudo yum install libxml2-devel libxslt-devel libffi-devel libyaml-devel openssl-devel $ # create a virtual environment $ virtualenv ./vmtpenv $ source ./vmtpenv/bin/activate diff --git a/images b/images deleted file mode 120000 index 9b06f86..0000000 --- a/images +++ /dev/null @@ -1 +0,0 @@ -doc/source/images \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index e2dd300..8f6b835 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,6 +31,7 @@ package_data = [entry_points] console_scripts = vmtp = vmtp.vmtp:main + vmtp_genchart = vmtp.vmtp_genchart:main [build_sphinx] source-dir = doc/source diff --git a/vmtp/genchart.py b/vmtp/vmtp_genchart.py old mode 100644 new mode 100755 similarity index 98% rename from vmtp/genchart.py rename to vmtp/vmtp_genchart.py index f8d87c9..1f1e3de --- a/vmtp/genchart.py +++ b/vmtp/vmtp_genchart.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Copyright 2014 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -232,11 +233,10 @@ def gen_chart(files, chart_dest, browser, protocols=''): chart = GoogleChartsBarChart(results, protocols.lower()) chart.plot(chart_dest) if browser: - url = 'file://' + os.path.abspath(opts.chart) + url = 'file://' + os.path.abspath(chart_dest) webbrowser.open(url, new=2) -if __name__ == '__main__': - +def main(): parser = argparse.ArgumentParser(description='VMTP Chart Generator V' + __version__) parser.add_argument('-c', '--chart', dest='chart', @@ -271,3 +271,7 @@ if __name__ == '__main__': sys.exit(0) gen_chart(opts.files, opts.chart, opts.browser, opts.protocols) + + +if __name__ == '__main__': + main()