Ticket #109: patch2.txt

File patch2.txt, 1.8 KB (added by Zooko, 15 years ago)
Line 
1diff -r f2bc95a71091 setup.py
2--- a/setup.py  Wed Jun 24 17:21:48 2009 -0700
3+++ b/setup.py  Sun Aug 16 14:15:53 2009 -0600
4@@ -48,21 +48,43 @@
5 
6         'packages': ["foolscap", "foolscap/slicers", "foolscap/logging",
7                      "foolscap/appserver", "foolscap/test"],
8-        'scripts': ["bin/flogtool", "bin/flappserver", "bin/flappclient"],
9 }
10 
11+use_console_scripts = None
12+
13 try:
14     # If setuptools is installed, then we'll add setuptools-specific
15     # arguments to the setup args.
16     import setuptools
17 except ImportError:
18-    pass
19+    use_console_scripts = False
20 else:
21     setup_args['install_requires'] = ['twisted >= 2.4.0']
22     setup_args['extras_require'] = { 'secure_connections' : ["pyOpenSSL"] }
23     # note that pyOpenSSL-0.7 and recent Twisted causes unit test failures,
24     # see bug #62
25 
26+    # Now if setuptools is < 0.6c8 then we might be on an old Linux
27+    # distribution where packages have had their .egg-info files stripped out.
28+    # (Hardy and Lenny don't have this problem, and they each have
29+    # setuptools-0.6c8.)
30+    import pkg_resources # comes with setuptools
31+    pv = pkg_resources.parse_version
32+    if pv(setuptools.__version__) < pv("0.6c8"):
33+        # Don't use the console_scripts feature -- it interacts badly with old
34+        # Linux distributions that have stripped out the .egg-info files.
35+        use_console_scripts = False
36+    else:
37+        use_console_scripts = True
38+
39+if use_console_scripts:
40+    setup_args['entry_points'] = { 'console_scripts': [
41+        'flogtool = foolscap.logging.cli:run_flogtool',
42+        'flappserver = foolscap.appserver.cli:run_flappserver',
43+        'flappclient = foolscap.appserver.client:run_flappclient',
44+        ] }
45+else:
46+    setup_args['scripts'] = ["bin/flogtool", "bin/flappserver", "bin/flappclient"]
47+
48 if __name__ == '__main__':
49     setup(**setup_args)
50-