Changeset 290
- Timestamp:
- 10/01/08 19:16:09 (5 years ago)
- Location:
- pyyaml/trunk
- Files:
-
- 1 deleted
- 3 edited
-
MANIFEST.in (modified) (1 diff)
-
announcement.msg (modified) (1 diff)
-
examples/pygments-lexer/example.raw (deleted)
-
setup.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/MANIFEST.in
r285 r290 1 include ext/_yaml.pyx ext/_yaml.pxd ext/_yaml.h ext/_yaml.c 2 exclude announcement.msg MANIFEST.in Makefile 1 include README LICENSE setup.py 2 recursive-include examples *.py *.cfg *.yaml 3 recursive-include tests *.py 4 recursive-include tests/data * -
pyyaml/trunk/announcement.msg
r283 r290 19 19 * 'yaml.load()' raises an exception if the input stream contains 20 20 more than one YAML document. 21 * Improved compatibility with Python 2.3. 21 22 * Use setuptools for setup.py. If you want to build optional LibYAML 22 23 bindings, run 'python setup.py --with-libyaml install'. Building -
pyyaml/trunk/setup.py
r281 r290 31 31 ] 32 32 33 from ez_setup import use_setuptools34 use_setuptools(version='0.6c5')35 33 36 from setuptools import setup, Extension, Feature 34 from distutils.core import setup, Command 35 from distutils.core import Distribution as _Distribution 36 from distutils.core import Extension as _Extension 37 from distutils.command.build_ext import build_ext as _build_ext 38 39 try: 40 from Pyrex.Distutils import Extension as _Extension 41 from Pyrex.Distutils import build_ext as _build_ext 42 with_pyrex = True 43 except ImportError: 44 with_pyrex = False 45 46 import sys, os.path 47 48 49 class Distribution(_Distribution): 50 51 def __init__(self, attrs=None): 52 _Distribution.__init__(self, attrs) 53 if not self.ext_modules: 54 return 55 for ext in reversed(self.ext_modules): 56 if not isinstance(ext, Extension): 57 continue 58 setattr(self, ext.attr_name, None) 59 self.global_options = [ 60 (ext.option_name, None, 61 "include %s" % ext.feature_description), 62 (ext.neg_option_name, None, 63 "exclude %s (default)" % ext.feature_description), 64 ] + self.global_options 65 self.negative_opt = self.negative_opt.copy() 66 self.negative_opt[ext.neg_option_name] = ext.option_name 67 68 69 class Extension(_Extension): 70 71 def __init__(self, name, sources, feature_name, feature_description, **kwds): 72 if not with_pyrex: 73 for filename in sources[:]: 74 base, ext = os.path.splitext(filename) 75 if ext == 'pyx': 76 sources.replace(filename, '%s.c' % base) 77 _Extension.__init__(self, name, sources, **kwds) 78 self.feature_name = feature_name 79 self.feature_description = feature_description 80 self.attr_name = 'with_' + feature_name.replace('-', '_') 81 self.option_name = 'with-' + feature_name 82 self.neg_option_name = 'without-' + feature_name 83 84 85 class build_ext(_build_ext): 86 87 def get_source_files(self): 88 self.check_extensions_list(self.extensions) 89 filenames = [] 90 for ext in self.extensions: 91 if with_pyrex: 92 self.pyrex_sources(ext.sources, ext) 93 for filename in ext.sources: 94 filenames.append(filename) 95 base = os.path.splitext(filename)[0] 96 for ext in ['c', 'h', 'pyx', 'pxd']: 97 filename = '%s.%s' % (base, ext) 98 if filename not in filenames and os.path.isfile(filename): 99 filenames.append(filename) 100 return filenames 101 102 def build_extensions(self): 103 self.check_extensions_list(self.extensions) 104 for ext in self.extensions: 105 if isinstance(ext, Extension): 106 if not getattr(self.distribution, ext.attr_name): 107 continue 108 if with_pyrex: 109 ext.sources = self.pyrex_sources(ext.sources, ext) 110 self.build_extension(ext) 111 112 113 class test(Command): 114 115 user_options = [] 116 117 def initialize_options(self): 118 pass 119 120 def finalize_options(self): 121 pass 122 123 def run(self): 124 build_cmd = self.get_finalized_command('build') 125 build_cmd.run() 126 sys.path.insert(0, build_cmd.build_lib) 127 sys.path.insert(0, 'tests') 128 import test_all 129 test_all.main() 130 37 131 38 132 if __name__ == '__main__': … … 53 147 package_dir={'': 'lib'}, 54 148 packages=['yaml'], 149 ext_modules=[ 150 Extension('yaml/_yaml', ['ext/_yaml.pyx'], 151 'libyaml', "LibYAML bindings", 152 libraries=['yaml']), 153 ], 55 154 56 features = { 57 'libyaml': Feature( 58 description="LibYAML bindings", 59 ext_modules=[ 60 Extension('_yaml', ['ext/_yaml.pyx'], libraries=['yaml']), 61 ], 62 ), 155 distclass=Distribution, 156 cmdclass={ 157 'build_ext': build_ext, 158 'test': test, 63 159 }, 64 160 )
Note: See TracChangeset
for help on using the changeset viewer.
