Issue 18045: get_python_version is not import in bdist_rpm.py (original) (raw)

Created on 2013-05-24 00:37 by maoliping455, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue18045.patch dmi.baranov,2013-05-27 21:39 review
issue18045-py27.diff l,2013-09-04 20:04 Add missing import statement review
Messages (7)
msg189888 - (view) Author: Matt Mao (maoliping455) Date: 2013-05-24 00:37
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.
msg190155 - (view) Author: Dmi Baranov (dmi.baranov) * Date: 2013-05-27 21:39
Added a patch. Not covered by test, because this case require external module in test package definition.
msg190364 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-05-30 15:25
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.
msg190368 - (view) Author: Dmi Baranov (dmi.baranov) * Date: 2013-05-30 15:54
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.
msg196947 - (view) Author: Lukas Wunner (l) Date: 2013-09-04 20:04
The attached patch adds just the missing import statement (which already exists in all 3.x versions) and changes nothing else.
msg213223 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-12 09:04
New changeset 677327810121 by Éric Araujo in branch '2.7': Fix missing import in bdist_rpm (#18045) http://hg.python.org/cpython/rev/677327810121
msg213224 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-12 09:04
Thanks for the report and patches.
History
Date User Action Args
2022-04-11 14:57:45 admin set github: 62245
2014-03-12 09:04:42 eric.araujo set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2014-03-12 09:04:07 python-dev set nosy: + python-devmessages: +
2013-09-04 20:04:25 l set files: + issue18045-py27.diffnosy: + lmessages: +
2013-06-03 12:54:09 ncoghlan set nosy: + ncoghlan
2013-05-30 15:54:11 dmi.baranov set messages: +
2013-05-30 15:25:53 eric.araujo set messages: +
2013-05-30 08:54:06 berker.peksag set type: behaviorstage: patch review
2013-05-30 08:52:32 berker.peksag link issue18051 superseder
2013-05-27 21:39:36 dmi.baranov set files: + issue18045.patchnosy: + dmi.baranovmessages: + keywords: + patch
2013-05-24 00:37:22 maoliping455 create