Ticket #1696: make-some-rpms-3-1696.patch
File make-some-rpms-3-1696.patch, 4.1 KB (added by , 10 years ago) |
---|
-
new file setup.cfg
diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9dbe235
- + 1 # Some RPM-based distributions configure RPM to automatically create .pyo files 2 # when .py files are installed, but don't configure bdist_rpm to add .pyo files 3 # to the list-of-files-to-be-installed. Since RPM will exit with an error if 4 # files are installed that aren't in the list-of-files-to-be-installed, this 5 # prevents bdist_rpm from working. This has been a problem for a very long time 6 # (at least since Fedora 6, if not before), but is due to be fixed in Fedora 7 # 11, with the same workaround we present here. For more details, see the 8 # upstream Fedora bug: 9 # 10 # https://bugzilla.redhat.com/show_bug.cgi?id=236535 11 # 12 [install] 13 optimize = 1 -
setup.py
diff --git a/setup.py b/setup.py index 529fda5..860e713 100755
a b def main(args): 44 44 sys.path.insert(0, '.') 45 45 from twisted import copyright 46 46 from twisted.python.dist import getDataFiles, getScripts, getPackages 47 from twisted.python.dist import setup, _SDistTwisted 47 from twisted.python.dist import setup, _SDistTwisted, _BuildPyTwisted 48 48 49 49 # "" is included because core scripts are directly in bin/ 50 50 projects = [''] + [x for x in os.listdir('bin') … … on event-based network programming and multiprotocol integration. 74 74 conditionalExtensions = getExtensions(), 75 75 scripts = scripts, 76 76 data_files=getDataFiles('twisted'), 77 cmdclass = {'sdist': _SDistTwisted}, 77 cmdclass = { 78 'sdist': _SDistTwisted, 79 'build_py': _BuildPyTwisted, 80 }, 78 81 ) 79 82 80 83 if 'setuptools' in sys.modules: -
twisted/python/dist.py
diff --git a/twisted/python/dist.py b/twisted/python/dist.py index 6d91b52..9b89b78 100644
a b Don't use this outside of Twisted. 6 6 Maintainer: Christopher Armstrong 7 7 """ 8 8 9 import sys 9 10 import os 10 from distutils.command import (build_scripts, install_data, build_ext,11 sdist) 11 from distutils.command import build_scripts, install_data, build_ext 12 from distutils.command import sdist, build_py 12 13 from distutils.errors import CompileError 13 14 from distutils import core 14 15 from distutils.core import Extension … … class _SDistTwisted(sdist.sdist): 377 378 builder.buildTwistedFiles(version, basedir) 378 379 379 380 self.distribution.metadata.write_pkg_info(basedir) 381 382 383 384 class _BuildPyTwisted(build_py.build_py): 385 """ 386 Install Python source files, except the ones we don't want. 387 """ 388 389 blacklist = { 390 (2, 5): [ 391 "twisted/test/generator_failure_tests.py", 392 ], 393 } 394 395 396 def _check_file(self, filepath): 397 incompatible_versions = [v for v in self.blacklist.keys() 398 if v > sys.version_info] 399 400 for version in incompatible_versions: 401 for victim in self.blacklist[version]: 402 # Ignore plain Python files 403 if filepath.endswith(victim): 404 print "Rejecting Python script %r" % (victim,) 405 return False 406 407 # Ignore byte-compiled files 408 if filepath.endswith(victim + "c"): 409 print "Rejecting compiled version of %r" % (victim,) 410 return False 411 412 # Ignore optimized byte-compiled files 413 if filepath.endswith(victim + "o"): 414 print "Rejecting optimized version of %r" % (victim,) 415 return False 416 417 return True 418 419 420 def get_outputs(self, *args, **kwargs): 421 outfiles = build_py.build_py.get_outputs(self, *args, **kwargs) 422 423 filtered = [filepath for filepath in outfiles 424 if self._check_file(filepath)] 425 426 assert len(filtered) < len(outfiles) 427 428 return filtered 429 430 431 def build_module(self, module, module_file, package): 432 if self._check_file(module_file): 433 build_py.build_py.build_module(self, module, module_file, package)