Bug 600036

Summary: FTBFS python-lxml-2.2.6-1.fc14
Product: [Fedora] Fedora Reporter: FTBFS <ftbfs>
Component: python-lxmlAssignee: Jeffrey C. Ollie <jeff>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 14CC: dmalcolm, jeff, jpopelka
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://linux.dell.com/files/fedora/FixBuildRequires/mock-results/
Whiteboard:
Fixed In Version: python-lxml-2.3-1.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-26 16:02:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 596849    
Attachments:
Description Flags
root.log
none
build.log
none
mock.log
none
root.log
none
build.log
none
mock.log
none
Patch the various "from itertools import *" none

Description FTBFS 2010-06-03 21:19:37 UTC
python-lxml-2.2.6-1.fc14.src.rpm Failed To Build From Source against the rawhide tree.  See http://fedoraproject.org/wiki/FTBFS for more information.
If you believe this is actually a bug in another package, do NOT change the component in this bug or close this bug.  Instead, add the appropriate bug number from the other package to the "Depends on" line in this bug.  If the other package does not yet have a bug created that you think matches, please create one.  Doing so helps us properly track bugs and their dependencies, just as we track package dependencies.  (If you close this bug, and the other package is not fixed before the next FTBFS run, a new bug will get created.  Please follow the above advice to avoid such duplication.)

Comment 1 FTBFS 2010-06-03 21:19:40 UTC
Created attachment 421019 [details]
root.log

root.log for i386

Comment 2 FTBFS 2010-06-03 21:19:41 UTC
Created attachment 421020 [details]
build.log

build.log for i386

Comment 3 FTBFS 2010-06-03 21:19:42 UTC
Created attachment 421021 [details]
mock.log

mock.log for i386

Comment 4 FTBFS 2010-06-03 21:19:43 UTC
Created attachment 421022 [details]
root.log

root.log for x86_64

Comment 5 FTBFS 2010-06-03 21:19:44 UTC
Created attachment 421023 [details]
build.log

build.log for x86_64

Comment 6 FTBFS 2010-06-03 21:19:46 UTC
Created attachment 421024 [details]
mock.log

mock.log for x86_64

Comment 7 Dave Malcolm 2010-06-03 21:26:05 UTC
Traceback from 2to3 during %prep:

Traceback (most recent call last):
  File "/usr/bin/2to3", line 6, in <module>
    sys.exit(main("lib2to3.fixes"))
  File "/usr/lib/python2.6/lib2to3/main.py", line 165, in main
    options.processes)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 613, in refactor
    items, write, doctests_only)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 271, in refactor
    self.refactor_dir(dir_or_file, write, doctests_only)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 290, in refactor_dir
    self.refactor_file(fullname, write, doctests_only)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 653, in refactor_file
    *args, **kwargs)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 325, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 355, in refactor_string
    self.refactor_tree(tree, name)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 389, in refactor_tree
    self.traverse_by(self.post_order_heads, tree.post_order())
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 413, in traverse_by
    new = fixer.transform(node, results)
  File "/usr/lib/python2.6/lib2to3/fixes/fix_itertools_imports.py", line 24, in transform
    assert child.type == syms.import_as_name

Comment 8 Dave Malcolm 2010-06-03 21:26:51 UTC
The 2to3 traceback is with python-2.6.5-12

Comment 9 Dave Malcolm 2010-06-03 21:47:52 UTC
Adding --verbose to invocation of 2to3 indicates the problem is when running on:
  python3-python-lxml-2.2.6-1.fc14/benchmark/bench_etree.py

The issue appears to be the line:
  from itertools import *

Comment 10 Dave Malcolm 2010-06-03 21:53:26 UTC
I believe the only two names from itertools that are used are "islice" and "repeat", so this could be replaced with:
  from itertools import islice, repeat

Looks like 2to3 could handle this better, if only by giving a better error message.

Comment 11 Dave Malcolm 2010-06-03 22:23:07 UTC
2to3 issue filed upstream as http://bugs.python.org/issue8892

Comment 12 Dave Malcolm 2010-06-03 22:59:09 UTC
Created attachment 421061 [details]
Patch the various "from itertools import *"

Attached patch changes various lines of the form 
  from itertools import *
to instead list the specific names to be imported.  I may have got the lists wrong.

With this patch 2to3 from python-2.6.5 works

Comment 13 Dave Malcolm 2010-07-26 13:06:23 UTC
I've cherrypicked the lib2to3 patch from upstream, rebuilding python into dist-f14-py27-rebuild as python-2.7-6.fc14:
http://koji.fedoraproject.org/koji/taskinfo?taskID=2351230

Comment 14 Jeffrey C. Ollie 2010-07-26 15:01:44 UTC
Getting a new error:

Bytecompiling .py files below /builddir/build/BUILDROOT/python-lxml-2.2.6-2.fc14.x86_64/usr/lib64/python3.1/ using /usr/bin/python3.1
*** Error compiling /builddir/build/BUILDROOT/python-lxml-2.2.6-2.fc14.x86_64/usr/lib64/python3.1/site-packages/lxml/html/__init__.py ...
Sorry: IndentationError: unexpected unindent (__init__.py, line 827)
error: Bad exit status from /var/tmp/rpm-tmp.XjRxDR (%install)
    Bad exit status from /var/tmp/rpm-tmp.XjRxDR (%install)
RPM build errors:
Child returncode was: 1
EXCEPTION: Command failed. See logs for output.
 # ['bash', '--login', '-c', 'rpmbuild -bb --target x86_64 --nodeps builddir/build/SPECS/python-lxml.spec']
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/site-packages/mock/util.py", line 333, in do
    raise mock.exception.Error, ("Command failed. See logs for output.\n # %s" % (command,), child.returncode)
Error: Command failed. See logs for output.
 # ['bash', '--login', '-c', 'rpmbuild -bb --target x86_64 --nodeps builddir/build/SPECS/python-lxml.spec']
LEAVE do --> EXCEPTION RAISED

Comment 15 Dave Malcolm 2010-07-26 15:28:03 UTC
Relevant code looks like this:

> def open_http_urllib(method, url, values):
>     ## FIXME: should test that it's not a relative URL or something
>     try:
>         from urllib.parse import urlencode
> from urllib.request import urlopen
>     except ImportError: # Python 3
>         from urllib.request import urlopen
>         from urllib.parse import urlencode

Clearly the "from urllib.request import urlopen" is at the wrong indentation level

Comment 16 Dave Malcolm 2010-07-26 15:28:49 UTC
To clarify, this is in the generated:
  /usr/lib64/python3.1/site-packages/lxml/html/__init__.py
and looks like another 2to3 bug within the python 2 package.

Comment 17 Dave Malcolm 2010-07-26 15:56:54 UTC
Relevant input code, before 2to3 is invoked:
> def open_http_urllib(method, url, values):
>     ## FIXME: should test that it's not a relative URL or something
>     try:
>        from urllib import urlencode, urlopen
>     except ImportError: # Python 3

Comment 18 Dave Malcolm 2010-07-26 17:29:52 UTC
Filed the 2to3 bug upstream here:
http://bugs.python.org/issue9386

Workaround for now may be to fix it up in lxml so the import is two separate lines.

Comment 19 Dave Malcolm 2010-07-26 18:35:33 UTC
I've patched around this in python-lxml for now, as proposed in comment #18

Comment 20 Bug Zapper 2010-07-30 12:01:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 21 Fedora Update System 2011-04-20 14:03:59 UTC
python-lxml-2.3-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/python-lxml-2.3-1.fc15

Comment 22 Fedora Update System 2011-04-21 03:00:35 UTC
Package python-lxml-2.3-1.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-lxml-2.3-1.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/python-lxml-2.3-1.fc15
then log in and leave karma (feedback).

Comment 23 Fedora Update System 2011-04-26 16:02:37 UTC
python-lxml-2.3-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.