Python version : 2.7.5 OS : CentOS 6.3 When I tried to build a rpm with "python ./setup.py bdist_rpm", I get the following error : Traceback (most recent call last): File "setup.py", line 221, in ... and much more ;)""" File "/usr/local/python2.7/lib/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "/usr/local/python2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/local/python2.7/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/local/python2.7/lib/python2.7/python2.7/distutils/command/bdist_rpm.py", line 383, in run pyversion = get_python_version() NameError: global name 'get_python_version' is not defined I find that we do not import function get_python_version in python2.7/distutils/command/bdist_rpm.py. I think we need to add “from distutils.sysconfig import get_python_version” in this file.
Thanks for catching this. I think the patch is incorrect when it replaces “from sysconfig import get_python_version” by “from distutils.sysconfig import get_python_version”; it should only add the missing import in bdist_rpm.py, not touch the other modules.
I would agree that the patch is incorrect, if it was produced with additional refactoring or changes in functionality, not described in the issue. It's just a PEP8 compliance at package level.