Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue14443] Distutils test_bdist_rpm failure

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Apr 25, 2012, 9:25 AM

Post #1 of 5 (185 views)
Permalink
[issue14443] Distutils test_bdist_rpm failure

Éric Araujo <merwok [at] netwok> added the comment:

> I'm wondering if there may be a deeper problem here: how certain are we that bdist_rpm isn't using the system Python
> to handle the byte compilation step? It would explain why the files are still being generated in the old locations.

I’ve had a quick look at bdist_rpm and found nothing suspect (like filename + 'c'). You may have the right idea: There are --python and --fix-python options for this command that decide what executable will be used to run setup.py, so maybe the system Python is used. The default is 'python' instead of 'python3' though, so if that’s the cause I don’t understand how it worked at all.

> It occurs to me there's a way to check my theory: if we update the failing test to explicitly check the magic cookie in at
> least one of the precompiled pyc files (rather than just expecting the files' existence), then it should also start failing
> on the 2.7 RHEL 6 buildbot.

I’ve been looking for a way to inspect byte-compiled files for some time; please share any ideas on #13473.

To help debug this, I could apply #11599.

The rpm vs. rpmbuild bug is #11122.

#5875 and #13307 are bugs similar to this one.

----------
assignee: -> eric.araujo
components: +Distutils
title: Distutils test failure -> Distutils test_bdist_rpm failure

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Apr 25, 2012, 6:47 PM

Post #2 of 5 (181 views)
Permalink
[issue14443] Distutils test_bdist_rpm failure [In reply to]

Nick Coghlan <ncoghlan [at] gmail> added the comment:

Antoine (added to nosy list) indicated he wasn't seeing the failure on a Mageia system, so that's another point in favour of a Fedora/RHEL specific problem.

Also added Dave Malcolm as the Fedora Python package maintainer.

Applying #11599 to get the full failing command line sounds worthwhile, but #11122 shouldn't be related, since the RHEL buildbot definitely has rpmbuild available.

----------
nosy: +dmalcolm, pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Apr 26, 2012, 8:32 AM

Post #3 of 5 (184 views)
Permalink
[issue14443] Distutils test_bdist_rpm failure [In reply to]

Dave Malcolm <dmalcolm [at] redhat> added the comment:

As a post-processing step, rpmbuild will attempt to byte-compile any .py files it encounters, and the results must be listed in the %files manifest. [1]

This is done by the script brp-python-bytecompile, which uses the compileall module. However, my guess is that it's not using the correct version of python when invoking "compileall", which would explain why it's using the pre-PEP3147 location for the .pyc/.pyo files.

Can you run "file" on the .pyc files and confirm which version of Python they're bytecode for? My guess is that it's bytecompiled them with /usr/bin/python, rather than your local build of python.

Some notes: In older versions of RPM, brp-python-bytecompile took a single optional argument: the python interpreter to use, defaulting to /usr/bin/python. I generalized this to support multiple defaults when adding Python 3 support to Fedora: see https://bugzilla.redhat.com/show_bug.cgi?id=531117 That patch could be generalized to support /usr/local/lib.

[1] In Fedora we do this using "__os_install_post", which is defined
in /usr/lib/rpm/redhat/macros (from the redhat-rpm-config package),
which has the invocation of /usr/lib/rpm/brp-python-bytecompile So it could be possible to override the python interpreter to use by redefining __os_install_post

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Apr 26, 2012, 9:26 AM

Post #4 of 5 (184 views)
Permalink
[issue14443] Distutils test_bdist_rpm failure [In reply to]

Dave Malcolm <dmalcolm [at] redhat> added the comment:

__os_install_post is defined within /usr/lib/rpm/redhat/macros and contains this fragment:
/usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \

Hence it will use %{__python} as the default when byte-compiling.

%__python has the default definition of /usr/bin/python, but this can be overridden, either in the spec file using:
%global __python some_path_to_the_python_to_use
or in the command-line invocation of rpmbuild:
rpmbuild --define="__python some_path_to_the_python_to_use"

You can use the --showrc option to rpmbuild to see all of the macro expansions it's using (lots of output).

So if it is indeed using the wrong python executable to do the bytecompiling, the above ought to fix it. The simplest fix would probably be for bdist_rpm to add:
--define="__python %s" % sys.executable
to the rpmbuild invocation, I think.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Apr 26, 2012, 6:13 PM

Post #5 of 5 (182 views)
Permalink
[issue14443] Distutils test_bdist_rpm failure [In reply to]

Nick Coghlan <ncoghlan [at] gmail> added the comment:

I tried the simple fix a couple of different ways on the RHEL6 buildbot. First by changing line 315 of Lib/distutils/command/bdist_rpm.py" to be:

rpm_cmd = ['rpmbuild', '--define', '__python %s' % sys.executable]

And then a second time by adding the new "--define" after the "-ba" option. (changing the spawn command to show the full command on error indicating the new arguments *were* being passed in, though)

Neither worked - I still got the same error. Since I'm seeing the same fault on my Fedora system, I'll start poking around there instead (not sure when I'll get to it though).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.