Changeset 306
- Timestamp:
- 08/13/06 15:57:09 (2 years ago)
- Files:
-
- z3wingdbg/trunk/setup.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
z3wingdbg/trunk/setup.py
r305 r306 4 4 5 5 from distutils.core import setup 6 from distutils.command.build_py import build_py 7 from distutils.command.install_data import install_data 6 8 import os 7 9 … … 9 11 VERSION = file(os.path.join(base, "version.txt")).readline().strip() 10 12 13 # Build package and data_files structures 14 data_globs = ['*.txt', '*.pt', '*.zcml'] 11 15 packages = ['z3wingdbg'] 16 package_data=dict( 17 z3wingdbg=data_globs + ['locales/*.pot', 'locales/*/*/*.po', 18 'locales/*/*/*.mo']) 12 19 for path, dirs, files in os.walk(base): 13 20 for dir in list(dirs): 14 21 if os.path.exists(os.path.join(path, dir, '__init__.py')): 15 package_path = filter(None, path[len(base):].split(os.path.sep)) 16 packages.append('.'.join(['z3wingdbg'] + package_path + [dir])) 22 package_base = filter(None, path[len(base):].split(os.path.sep)) 23 package = '.'.join(['z3wingdbg'] + package_base + [dir]) 24 packages.append(package) 25 package_data[package] = data_globs[:] 17 26 else: 18 27 dirs.remove(dir) 28 29 # Distutils adjustments (*sigh*) 30 class fixed_build_py(build_py): 31 """Bug-fixed version of get_data_files""" 32 def get_data_files (self): 33 """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" 34 data = [] 35 if not self.packages: 36 return data 37 for package in self.packages: 38 # Locate package source directory 39 src_dir = self.get_package_dir(package) 40 41 # Compute package build directory 42 build_dir = os.path.join(*([self.build_lib] + package.split('.'))) 43 44 # Length of path to strip from found files (if src_dir != '') 45 plen = len(src_dir) and len(src_dir)+1 46 47 # Strip directory from globbed filenames 48 filenames = [ 49 file[plen:] for file in self.find_data_files(package, src_dir) 50 ] 51 data.append((package, src_dir, build_dir, filenames)) 52 return data 53 54 class package_install_data(install_data): 55 """Install data into package directories""" 56 def finalize_options (self): 57 self.set_undefined_options('install', ('install_lib', 'install_dir'), 58 ('root', 'root'), ('force', 'force')) 19 59 20 60 setup( … … 36 76 download_url='http://www.zopatista.com/projects/z3wingdbg/' 37 77 'releases/%s/z3wingdbg-%s.tar.gz' % (VERSION, VERSION), 38 keywords='debugger,Zope3,Wing IDE ',78 keywords='debugger,Zope3,Wing IDE,HTTP', 39 79 packages=packages, 80 package_data=package_data, 40 81 package_dir=dict(z3wingdbg=''), 41 82 classifiers=[ … … 49 90 'Programming Language :: Python', 50 91 'Topic :: Software Development :: Debuggers', 51 ] 92 ], 93 cmdclass = dict(build_py=fixed_build_py, install_data=package_install_data) 52 94 )
