Changeset 301 for pyyaml/trunk/setup.py
- Timestamp:
- 11/30/08 09:06:13 (4 years ago)
- File:
-
- 1 edited
-
pyyaml/trunk/setup.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/setup.py
r298 r301 58 58 from distutils.dir_util import mkpath 59 59 from distutils.command.build_ext import build_ext as _build_ext 60 from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm 60 61 from distutils.errors import CompileError, LinkError, DistutilsPlatformError 61 62 … … 95 96 self.negative_opt = self.negative_opt.copy() 96 97 self.negative_opt[ext.neg_option_name] = ext.option_name 98 99 def has_ext_modules(self): 100 if not self.ext_modules: 101 return False 102 for ext in self.ext_modules: 103 with_ext = self.ext_status(ext) 104 if with_ext is None or with_ext: 105 return True 106 return False 107 108 def ext_status(self, ext): 109 if isinstance(ext, Extension): 110 with_ext = getattr(self, ext.attr_name) 111 return with_ext 112 else: 113 return True 97 114 98 115 … … 122 139 disabled = True 123 140 for ext in self.extensions: 124 if isinstance(ext, Extension): 125 with_ext = getattr(self.distribution, ext.attr_name) 126 if with_ext is None: 127 disabled = False 128 elif with_ext: 129 optional = False 130 disabled = False 131 else: 141 with_ext = self.distribution.ext_status(ext) 142 if with_ext is None: 143 disabled = False 144 elif with_ext: 132 145 optional = False 133 146 disabled = False … … 159 172 return filenames 160 173 174 def get_outputs(self): 175 self.check_extensions_list(self.extensions) 176 outputs = [] 177 for ext in self.extensions: 178 fullname = self.get_ext_fullname(ext.name) 179 filename = os.path.join(self.build_lib, 180 self.get_ext_filename(fullname)) 181 if os.path.isfile(filename): 182 outputs.append(filename) 183 return outputs 184 161 185 def build_extensions(self): 162 186 self.check_extensions_list(self.extensions) 163 187 for ext in self.extensions: 164 if isinstance(ext, Extension): 165 with_ext = getattr(self.distribution, ext.attr_name) 166 if with_ext is None: 167 with_ext = self.check_extension_availability(ext) 168 if not with_ext: 169 continue 188 with_ext = self.distribution.ext_status(ext) 189 if with_ext is None: 190 with_ext = self.check_extension_availability(ext) 191 if not with_ext: 192 continue 170 193 if with_pyrex: 171 194 ext.sources = self.pyrex_sources(ext.sources, ext) … … 183 206 src = os.path.join(self.build_temp, 'check_%s.c' % ext.feature_name) 184 207 open(src, 'w').write(ext.feature_check) 185 log.info("checking if %s compiles" % ext.feature_name)208 log.info("checking if %s is compilable" % ext.feature_name) 186 209 try: 187 210 [obj] = self.compiler.compile([src], … … 199 222 return False 200 223 prog = 'check_%s' % ext.feature_name 201 log.info("checking if %s links" % ext.feature_name)224 log.info("checking if %s is linkable" % ext.feature_name) 202 225 try: 203 226 self.compiler.link_executable([obj], prog, … … 219 242 220 243 221 class test(Command): 222 223 user_options = [] 224 225 def initialize_options(self): 226 pass 227 228 def finalize_options(self): 229 pass 230 231 def run(self): 232 build_cmd = self.get_finalized_command('build') 233 build_cmd.run() 234 sys.path.insert(0, build_cmd.build_lib) 235 sys.path.insert(0, 'tests') 236 import test_all 237 test_all.main() 244 class bdist_rpm(_bdist_rpm): 245 246 def _make_spec_file(self): 247 argv0 = sys.argv[0] 248 features = [] 249 for ext in self.distribution.ext_modules: 250 if not isinstance(ext, Extension): 251 continue 252 with_ext = getattr(self.distribution, ext.attr_name) 253 if with_ext is None: 254 continue 255 if with_ext: 256 features.append('--'+ext.option_name) 257 else: 258 features.append('--'+ext.neg_option_name) 259 sys.argv[0] = ' '.join([argv0]+features) 260 spec_file = _bdist_rpm._make_spec_file(self) 261 sys.argv[0] = argv0 262 return spec_file 238 263 239 264 … … 264 289 cmdclass={ 265 290 'build_ext': build_ext, 266 # 'test': test,291 'bdist_rpm': bdist_rpm, 267 292 }, 268 293 )
Note: See TracChangeset
for help on using the changeset viewer.
