[Python-checkins] cpython: Remove redundant __main__ blocks from packaging modules.

eric.araujo python-checkins at python.org
Mon Nov 7 18:11:42 CET 2011


http://hg.python.org/cpython/rev/31ab61957d78
changeset:   73426:31ab61957d78
user:        Éric Araujo <merwok at netwok.org>
date:        Sun Nov 06 11:38:58 2011 +0100
summary:
  Remove redundant __main__ blocks from packaging modules.

The one interface we commit to maintain is the run module
(a.k.a. the pysetup script).

files:
  Lib/packaging/create.py   |  4 ----
  Lib/packaging/depgraph.py |  5 +----
  Lib/packaging/install.py  |  9 ---------
  3 files changed, 1 insertions(+), 17 deletions(-)


diff --git a/Lib/packaging/create.py b/Lib/packaging/create.py
--- a/Lib/packaging/create.py
+++ b/Lib/packaging/create.py
@@ -674,7 +674,3 @@
     # program.write_setup_script()
     # packaging.util.cfg_to_args()
     program()
-
-
-if __name__ == '__main__':
-    main()
diff --git a/Lib/packaging/depgraph.py b/Lib/packaging/depgraph.py
--- a/Lib/packaging/depgraph.py
+++ b/Lib/packaging/depgraph.py
@@ -224,6 +224,7 @@
 
 
 def main():
+    # XXX move to run._graph
     from packaging.database import get_distributions
     tempout = StringIO()
     try:
@@ -267,7 +268,3 @@
     else:
         print('Supported option: -d [filename]')
         sys.exit(1)
-
-
-if __name__ == '__main__':
-    main()
diff --git a/Lib/packaging/install.py b/Lib/packaging/install.py
--- a/Lib/packaging/install.py
+++ b/Lib/packaging/install.py
@@ -527,12 +527,3 @@
             logger.info('%r conflicts with %s', project, ','.join(projects))
 
     return True
-
-
-def _main(**attrs):
-    if 'script_args' not in attrs:
-        attrs['requirements'] = sys.argv[1]
-    get_infos(**attrs)
-
-if __name__ == '__main__':
-    _main()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list