Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify Pyphen version requirement #188

Closed
Smylers opened this issue May 1, 2014 · 3 comments
Closed

Specify Pyphen version requirement #188

Smylers opened this issue May 1, 2014 · 3 comments

Comments

@Smylers
Copy link
Contributor

Smylers commented May 1, 2014

Hi. I think WeasyPrint needs to specify which version of Pyphen it depends on, since it looks like it no longer works with older versions of Pyphen.

Specifically, we had WeasyPrint 0.19.2 and Pyphen 0.7 installed. Upgrading WeasyPrint to version 0.21 broke things, with this message:

  File "/usr/local/lib/python2.6/dist-packages/weasyprint/text.py", line 488, in split_first_line
    lang = style.lang and pyphen.language_fallback(style.lang)
AttributeError: 'module' object has no attribute 'language_fallback'

Upgrading to the latest Pyphen (version 0.9.1) made WeasyPrint work again, so I'm guessing that language_fallback was added some time between 0.7 and 0.9.1.

I'm hoping that specifying a minimum Pyphen version here would make pip automatically upgrade Pyphen when upgrading WeasyPrint: https://github.com/Kozea/WeasyPrint/blob/master/setup.py#L36

@SimonSapin
Copy link
Member

I'm hoping that specifying a minimum Pyphen version here would make pip automatically upgrade Pyphen

Yes, I believe that should work.

@liZe, what’s the relevant version number?

@liZe
Copy link
Member

liZe commented May 5, 2014

language_fallback has been added in 0.8.

@SimonSapin
Copy link
Member

Fixed in 51e0510, released on PyPI as 0.22.

$ virtualenv /tmp/a
[…]
$ /tmp/a/bin/pip install Pyphen==0.7 WeasyPrint==0.21
[…]
Successfully installed Pyphen WeasyPrint […]
$ /tmp/a/bin/weasyprint 'data:,<p lang=en style="-weasy-hyphens: auto; width: 5px">foo' /tmp/a.pdf
[…]
AttributeError: 'module' object has no attribute 'language_fallback'
$ /tmp/a/bin/pip install --upgrade git+https://github.com/Kozea/WeasyPrint.git@51e0510e5230d81b9855d93caad9483d0aab833
[…]
Successfully installed Pyphen WeasyPrint
$ /tmp/a/bin/weasyprint 'data:,<p lang=en style="-weasy-hyphens: auto; width: 5px">foo' /tmp/a.pdf
$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants