comparison setup.py @ 786:291700beaa94 trunk

Set zip_safe to False if the c speedup module is successfully built. Closes #252.
author jonas
date Sun, 03 Aug 2008 20:15:13 +0000
parents 8718e1e94c1c
children f5076e2a9786
comparison
equal deleted inserted replaced
785:36fb0a57fe74 786:291700beaa94
18 import doctest 18 import doctest
19 from glob import glob 19 from glob import glob
20 import os 20 import os
21 try: 21 try:
22 from setuptools import setup, Extension, Feature 22 from setuptools import setup, Extension, Feature
23 from setuptools.command.bdist_egg import bdist_egg
23 except ImportError: 24 except ImportError:
24 from distutils.core import setup, Extension 25 from distutils.core import setup, Extension
25 Feature = None 26 Feature = None
27 bdist_egg = None
26 import sys 28 import sys
27 29
28 sys.path.append(os.path.join('doc', 'common')) 30 sys.path.append(os.path.join('doc', 'common'))
29 try: 31 try:
30 from doctools import build_doc, test_doc 32 from doctools import build_doc, test_doc
31 except ImportError: 33 except ImportError:
32 build_doc = test_doc = None 34 build_doc = test_doc = None
33 35
36 _speedup_available = False
34 37
35 class optional_build_ext(build_ext): 38 class optional_build_ext(build_ext):
36 # This class allows C extension building to fail. 39 # This class allows C extension building to fail.
37 def run(self): 40 def run(self):
38 try: 41 try:
41 self._unavailable() 44 self._unavailable()
42 45
43 def build_extension(self, ext): 46 def build_extension(self, ext):
44 try: 47 try:
45 build_ext.build_extension(self, ext) 48 build_ext.build_extension(self, ext)
49 global _speedup_available
50 _speedup_available = True
46 except CCompilerError, x: 51 except CCompilerError, x:
47 self._unavailable() 52 self._unavailable()
48 53
49 def _unavailable(self): 54 def _unavailable(self):
50 print '*' * 70 55 print '*' * 70
63 ], 68 ],
64 ) 69 )
65 else: 70 else:
66 speedups = None 71 speedups = None
67 72
73
74 # Setuptools need some help figuring out if the egg is "zip_safe" or not
75 if bdist_egg:
76 class my_bdist_egg(bdist_egg):
77 def zip_safe(self):
78 return not _speedup_available and bdist_egg.zip_safe(self)
79
80
81 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc,
82 'build_ext': optional_build_ext}
83 if bdist_egg:
84 cmdclass['bdist_egg'] = my_bdist_egg
85
68 setup( 86 setup(
69 name = 'Genshi', 87 name = 'Genshi',
70 version = '0.6', 88 version = '0.6',
71 description = 'A toolkit for generation of output for the web', 89 description = 'A toolkit for generation of output for the web',
72 long_description = \ 90 long_description = \
77 author = 'Edgewall Software', 95 author = 'Edgewall Software',
78 author_email = 'info@edgewall.org', 96 author_email = 'info@edgewall.org',
79 license = 'BSD', 97 license = 'BSD',
80 url = 'http://genshi.edgewall.org/', 98 url = 'http://genshi.edgewall.org/',
81 download_url = 'http://genshi.edgewall.org/wiki/Download', 99 download_url = 'http://genshi.edgewall.org/wiki/Download',
82 zip_safe = True,
83 100
84 classifiers = [ 101 classifiers = [
85 'Development Status :: 4 - Beta', 102 'Development Status :: 4 - Beta',
86 'Environment :: Web Environment', 103 'Environment :: Web Environment',
87 'Intended Audience :: Developers', 104 'Intended Audience :: Developers',
110 genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] 127 genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
111 genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin] 128 genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin]
112 """, 129 """,
113 130
114 features = {'speedups': speedups}, 131 features = {'speedups': speedups},
115 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc, 132 cmdclass = cmdclass
116 'build_ext': optional_build_ext}
117 ) 133 )
Copyright (C) 2012-2017 Edgewall Software