diff --git a/setup.py b/setup.py index dbb422f1f3..a0bfbcaa0e 100644 --- a/setup.py +++ b/setup.py @@ -47,6 +47,7 @@ main_functions = { if __name__ == '__main__': from setuptools import setup, find_packages + from setuptools.command.build_py import build_py as _build_py, convert_path from distutils.command.build import build as _build from distutils.core import Command as _Command from pyqtdistutils import PyQtExtension, build_ext, Extension @@ -65,6 +66,25 @@ if __name__ == '__main__': newest_source, oldest_target = max(stimes), min(ttimes) return newest_source > oldest_target + class build_py(_build_py): + + def find_data_files(self, package, src_dir): + """ + Return filenames for package's data files in 'src_dir' + Modified to treat data file specs as paths not globs + """ + globs = (self.package_data.get('', []) + + self.package_data.get(package, [])) + files = self.manifest_files.get(package, [])[:] + for pattern in globs: + # Each pattern has to be converted to a platform-specific path + pattern = os.path.join(src_dir, convert_path(pattern)) + next = glob.glob(pattern) + files.extend(next if next else [pattern]) + + return self.exclude_data_files(package, src_dir, files) + + class Command(_Command): user_options = [] def initialize_options(self): pass @@ -413,7 +433,6 @@ if __name__ == '__main__': author_email = 'kovid@kovidgoyal.net', url = 'http://%s.kovidgoyal.net'%APPNAME, package_data = {'calibre':plugins}, - include_package_data = True, entry_points = entry_points, zip_safe = False, options = { 'bdist_egg' : {'exclude_source_files': True,}, }, @@ -454,7 +473,8 @@ if __name__ == '__main__': ], cmdclass = { 'build_ext' : build_ext, - 'build' : build, + 'build' : build, + 'build_py' : build_py, 'pot' : pot, 'manual' : manual, 'resources' : resources, diff --git a/upload.py b/upload.py index 2784a6b36f..b3bf009403 100644 --- a/upload.py +++ b/upload.py @@ -237,10 +237,10 @@ def stage_three(): check_call('python setup.py register') check_call('sudo rm -rf build src/calibre/plugins/*') os.mkdir('build') - check_call('python2.5 setup.py bdist_egg --exclude-source-files upload') + check_call('python2.5 setup.py build_ext bdist_egg --exclude-source-files upload') check_call('sudo rm -rf build src/calibre/plugins/*') os.mkdir('build') - check_call('python setup.py bdist_egg --exclude-source-files upload') + check_call('python setup.py build_ext bdist_egg --exclude-source-files upload') check_call('python setup.py sdist upload') upload_src_tarball() check_call('''rm -rf dist/* build/*''')