sdist.py 733 B

123456789101112131415161718192021222324252627
  1. import sys
  2. if 'setuptools' in sys.modules:
  3. from setuptools.command.sdist import sdist as old_sdist
  4. else:
  5. from distutils.command.sdist import sdist as old_sdist
  6. from numpy.distutils.misc_util import get_data_files
  7. class sdist(old_sdist):
  8. def add_defaults (self):
  9. old_sdist.add_defaults(self)
  10. dist = self.distribution
  11. if dist.has_data_files():
  12. for data in dist.data_files:
  13. self.filelist.extend(get_data_files(data))
  14. if dist.has_headers():
  15. headers = []
  16. for h in dist.headers:
  17. if isinstance(h, str): headers.append(h)
  18. else: headers.append(h[1])
  19. self.filelist.extend(headers)
  20. return