Commits

Jurko Gospodnetić  committed 266e9fa

inline the setup.py script's main() function

It no longer does anything except call setup().

  • Participants
  • Parent commits d489a87
  • Branches setup cleanup

Comments (0)

Files changed (1)

     return '%s%s' % (name, version_spec)
 
 
-def main():
+def cmdline_entrypoints(versioninfo, platform, basename):
+    target = 'pytest:main'
+    if platform.startswith('java'):
+        points = {'py.test-jython': target}
+    else:
+        if basename.startswith('pypy'):
+            points = {'py.test-%s' % basename: target}
+        else: # cpython
+            points = {'py.test-%s.%s' % versioninfo[:2] : target,}
+        points['py.test'] = target
+    return points
+
+
+def make_entry_points():
+    basename = os.path.basename(sys.executable)
+    points = cmdline_entrypoints(sys.version_info, sys.platform, basename)
+    keys = list(points.keys())
+    keys.sort()
+    l = ['%s = %s' % (x, points[x]) for x in keys]
+    return {'console_scripts': l}
+
+
+class PyTest(Command):
+    user_options = []
+    def initialize_options(self):
+        pass
+    def finalize_options(self):
+        pass
+    def run(self):
+        import sys,subprocess
+        PPATH = [x for x in os.environ.get('PYTHONPATH', '').split(':') if x]
+        PPATH.insert(0, os.getcwd())
+        os.environ['PYTHONPATH'] = ':'.join(PPATH)
+        errno = subprocess.call([sys.executable, 'pytest.py', '--ignore=doc'])
+        raise SystemExit(errno)
+
+
+if __name__ == '__main__':
     setup(
         name='pytest',
         description='pytest: simple powerful testing with Python',
         py_modules=['pytest'],
         zip_safe=False,
     )
-
-
-def cmdline_entrypoints(versioninfo, platform, basename):
-    target = 'pytest:main'
-    if platform.startswith('java'):
-        points = {'py.test-jython': target}
-    else:
-        if basename.startswith('pypy'):
-            points = {'py.test-%s' % basename: target}
-        else: # cpython
-            points = {'py.test-%s.%s' % versioninfo[:2] : target,}
-        points['py.test'] = target
-    return points
-
-
-def make_entry_points():
-    basename = os.path.basename(sys.executable)
-    points = cmdline_entrypoints(sys.version_info, sys.platform, basename)
-    keys = list(points.keys())
-    keys.sort()
-    l = ['%s = %s' % (x, points[x]) for x in keys]
-    return {'console_scripts': l}
-
-
-class PyTest(Command):
-    user_options = []
-    def initialize_options(self):
-        pass
-    def finalize_options(self):
-        pass
-    def run(self):
-        import sys,subprocess
-        PPATH = [x for x in os.environ.get('PYTHONPATH', '').split(':') if x]
-        PPATH.insert(0, os.getcwd())
-        os.environ['PYTHONPATH'] = ':'.join(PPATH)
-        errno = subprocess.call([sys.executable, 'pytest.py', '--ignore=doc'])
-        raise SystemExit(errno)
-
-
-if __name__ == '__main__':
-    main()