diff -r 37d3b95a289b Lib/distutils/command/bdist_rpm.py --- a/Lib/distutils/command/bdist_rpm.py Sat Sep 19 15:49:57 2015 -0400 +++ b/Lib/distutils/command/bdist_rpm.py Sat Sep 19 21:47:43 2015 -0400 @@ -338,6 +338,22 @@ nvr_string = "%{name}-%{version}-%{release}" src_rpm = nvr_string + ".src.rpm" non_src_rpm = "%{arch}/" + nvr_string + ".%{arch}.rpm" + + eval_cmd = "rpm --eval '%{_rpmfilename}'" + + out = os.popen(eval_cmd) + try: + line = out.readline() + if line: + non_src_rpm = line.strip() + + status = out.close() + if status: + raise DistutilsExecError("Failed to execute: %s" % repr(eval_cmd)) + + finally: + out.close() + q_cmd = r"rpm -q --qf '%s %s\n' --specfile '%s'" % ( src_rpm, non_src_rpm, spec_path)