summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2016-11-27 22:13:03 -0800
committerSteve Piercy <web@stevepiercy.com>2016-12-13 17:30:51 -0800
commit0c208dd7bf66a41a056514025fa42be8fc428513 (patch)
treea425f0043ad5f10e499db021139f8eb45a71e674
parentcae3840bc43f54ae55d1e2c97da90cecdf49a95e (diff)
downloadpyramid-0c208dd7bf66a41a056514025fa42be8fc428513.tar.gz
pyramid-0c208dd7bf66a41a056514025fa42be8fc428513.tar.bz2
pyramid-0c208dd7bf66a41a056514025fa42be8fc428513.zip
move parser outside of main into own function get_parser(), and call it from pdistreport.rst
-rw-r--r--docs/pscripts/pdistreport.rst2
-rw-r--r--pyramid/scripts/pdistreport.py10
2 files changed, 8 insertions, 4 deletions
diff --git a/docs/pscripts/pdistreport.rst b/docs/pscripts/pdistreport.rst
index 8eebaf8cb..f88ea7fe1 100644
--- a/docs/pscripts/pdistreport.rst
+++ b/docs/pscripts/pdistreport.rst
@@ -6,7 +6,7 @@
``pdistreport``
---------------
-.. autoprogram:: pyramid.scripts.pdistreport:parser
+.. autoprogram:: pyramid.scripts.pdistreport:get_parser()
:prog: pdistreport
.. seealso:: :ref:`showing_distributions`
diff --git a/pyramid/scripts/pdistreport.py b/pyramid/scripts/pdistreport.py
index 64837a36c..6622b4bd8 100644
--- a/pyramid/scripts/pdistreport.py
+++ b/pyramid/scripts/pdistreport.py
@@ -10,12 +10,16 @@ def out(*args): # pragma: no cover
sys.stdout.write(' ')
sys.stdout.write('\n')
+def get_parser():
+ _parser = argparse.ArgumentParser(
+ usage="%(prog)s",
+ description="Show Python distribution versions and locations in use")
+ return _parser
+
def main(argv=sys.argv, pkg_resources=pkg_resources, platform=platform.platform,
out=out):
# all args except argv are for unit testing purposes only
- parser = argparse.ArgumentParser(
- usage="%(prog)s",
- description="Show Python distribution versions and locations in use")
+ parser = get_parser()
parser.parse_args(argv[1:])
packages = []
for distribution in pkg_resources.working_set: