Bug 957868 - Can't import Declarative extension
Summary: Can't import Declarative extension
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-sqlalchemy
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Toshio Ernie Kuratomi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-29 18:33 UTC by Andrei Lapshin
Modified: 2013-05-22 03:20 UTC (History)
7 users (show)

Fixed In Version: python-sqlalchemy-0.8.1-1.fc19
Clone Of:
Environment:
Last Closed: 2013-05-22 03:20:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andrei Lapshin 2013-04-29 18:33:35 UTC
Description of problem:
When I'm trying to import Declarative extension I get ImportError.


Version-Release number of selected component (if applicable):
python3-sqlalchemy.x86_64 0:0.8.0-1.fc19


How reproducible:
Always


Steps to Reproduce:
1. python3 -c 'from sqlalchemy.ext.declarative import declarative_base'

  
Actual results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.3/site-packages/sqlalchemy/ext/declarative/__init__.py", line 1254, in <module>
    from .api import declarative_base, synonym_for, comparable_using, \
  File "/usr/lib/python3.3/site-packages/sqlalchemy/ext/declarative/api.py", line 10, in <module>
    from ...orm import synonym as _orm_synonym, mapper,\
  File "/usr/lib/python3.3/site-packages/sqlalchemy/orm/__init__.py", line 16, in <module>
    from .mapper import (
  File "/usr/lib/python3.3/site-packages/sqlalchemy/orm/mapper.py", line 20, in <module>
    from .collections import deque
ImportError: cannot import name deque


Expected results:
Successful import.


Additional info:
Sqlaclhemy installed through pip works as expected.

Comment 1 Toshio Ernie Kuratomi 2013-04-29 19:26:16 UTC
Well -- this looks like 2to3 mistranslating the lib/sqlalchemy/orm/mapper.py file.  That should stay "from collections import deque" instead of being changed into a relative import.

If you know what pip is doing in that case, maybe I could figure out what the reason the build in he package is doing things differently.

Comment 2 Toshio Ernie Kuratomi 2013-04-29 19:31:21 UTC
Hmm.... and running the conversion script python3 sa2to3.py on F20 is currently not translating that line.... I wonder if it was a problem in 2to3 at the time the package was built.

/me kicks off a rebuild to see.

Comment 3 Toshio Ernie Kuratomi 2013-04-29 20:31:04 UTC
The rebuild seems to show that running sa2to3.py doesn't change that import line either:

http://kojipkgs.fedoraproject.org//work/tasks/5479/5315479/build.log

Search for "--- lib/sqlalchemy/orm/mapper.py"

But the rpm that is generated at the end does have the wrong import in that file.  So at some point it is being changed... just not shown in the output.

Also happens with 0.8.1

Comment 4 Toshio Ernie Kuratomi 2013-04-29 22:41:06 UTC
I think I've got a fix.  It seems that calling sa2to3.py on the sources and then doing python setup.py build causes this.  It's still documented that you're supposed to call sa2to3.py explicitly so this might be a bug in the documentation.  (Working on fixed builds that also update to 0.8.1 right now).

Comment 5 Fedora Update System 2013-04-30 03:46:00 UTC
python-sqlalchemy-0.8.1-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-sqlalchemy-0.8.1-1.fc19

Comment 6 Toshio Ernie Kuratomi 2013-04-30 03:50:07 UTC
That should fix the issue.  Let me know if it doesn't.

Comment 7 Andrei Lapshin 2013-04-30 04:06:03 UTC
Yes, new build fixed the issue. Thank you for fast response.

Comment 8 Fedora Update System 2013-04-30 19:58:20 UTC
Package python-sqlalchemy-0.8.1-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-sqlalchemy-0.8.1-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7038/python-sqlalchemy-0.8.1-1.fc19
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2013-05-22 03:20:32 UTC
python-sqlalchemy-0.8.1-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.