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

Fix cairocffi build #56839

Merged
merged 4 commits into from Mar 13, 2019
Merged

Fix cairocffi build #56839

merged 4 commits into from Mar 13, 2019

Conversation

avnik
Copy link
Contributor

@avnik avnik commented Mar 4, 2019

Motivation for this change

cairocffi doesn't build, preventing qtile from build.
(patch doesn't applying correctly)

Patch was refreshed, as well as more packages required for tests added.

/cc @FRidh

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh
Copy link
Member

FRidh commented Mar 5, 2019

@GrahamcOfBorg python2.pkgs.cairocffi python3.pkgs.cairocffi

@avnik
Copy link
Contributor Author

avnik commented Mar 5, 2019 via email

@FRidh
Copy link
Member

FRidh commented Mar 5, 2019

@GrahamcOfBorg build python3.pkgs.cairocffi

@avnik
Copy link
Contributor Author

avnik commented Mar 5, 2019 via email

@Ma27
Copy link
Member

Ma27 commented Mar 7, 2019

@FRidh @avnik I'd propose to add an cairoffi_1 package as well (similar to cairosvg1) to retain Python 2 support for now. This affects thumbor, graphite-web and cairosvg1 and I think it's too early to drop Python 2 support if some dependants still need it.

Also wondering if the Python update script should contain some functionality to actually test the package before bumping it (and pushing this to master).

@avnik
Copy link
Contributor Author

avnik commented Mar 7, 2019

@Ma27 cairocffi_py2 be better name, than _1.

Other option -- add some backporing patch to this package, I am ok with both solutions.

@Ma27
Copy link
Member

Ma27 commented Mar 7, 2019

cairocffi_py2 be better name, than _1.

Ack. Didn't look at the package's version when writing this 😅

Other option -- add some backporing patch to this package, I am ok with both solutions.

Can you please be more precise in what you mean? Not sure if I understand correctly what you meant :)

@avnik
Copy link
Contributor Author

avnik commented Mar 7, 2019 via email

@Ma27
Copy link
Member

Ma27 commented Mar 9, 2019

I mean, if you take commit, which removing 2.x support, make reversing patch, and will support it ;)

I doubt that it'll be that easy. Python 2.x and 3.x diverge pretty much.

But I'll have a look at this and see how to proceed here :)

@avnik
Copy link
Contributor Author

avnik commented Mar 9, 2019 via email

@Ma27
Copy link
Member

Ma27 commented Mar 9, 2019

Just a short update: I created a cairocffi_0_9 package locally and played around with it. I'll push this tomorrow to this PRs branch as I'm fairly sleepy atm :)

@Ma27
Copy link
Member

Ma27 commented Mar 10, 2019

I pushed three commits on top of your branch:

  • 8d23630: qasm2image doesn't support Python older than 3.5. It's more obvious to raise an error since this package doesn't support old Python rather than breaking the evaluation when trying to use the cairocffi derivation.

  • ad550de: move the entire cairocffi build instructions into a generic function that is invoked for cairocffi 1.0 and 0.9. The older version should be supported for now to keep older software like thumbor working. I'd probably revert that before 19.09 as Python 2.x will be dropped by the end of the year.

    This affects the following packages:

    • cairosvg1: Built with cairocffi 1.x by default, but when using Python 2.x (which is still supported here), cairocffi can be overridden by cairocffi_0_9. (Also wondering if we should add a cairosvg1_py2 to make this more obvious.
    • thumbor: Python 3.x support is in progress, but until then we can only build with Python 2 here.
    • graphite-api with Python 2.x (nix-build -E 'with import ./. {}; pythonPackages.graphite_api.override { cairocffi = pythonPackages.cairocffi_0_9; }')
    • graphite_web (doesn't work with Python 3.x)
    • and probably some more...
  • da86a8e: unbreak thumbor (by using cairocffi_0_9 and adding some minor fixes to the test suite).

@FRidh @avnik it would be great if you could review this as well :)

@@ -1311,7 +1311,7 @@ in {

canmatrix = callPackage ../development/python-modules/canmatrix {};

cairocffi = callPackage ../development/python-modules/cairocffi {};
inherit (callPackage ../development/python-modules/cairocffi {}) cairocffi cairocffi_0_9;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

Suggested change
inherit (callPackage ../development/python-modules/cairocffi {}) cairocffi cairocffi_0_9;
cairocffi = if isPy3k then
(callPackage ../development/python-modules/cairocffi {}).cairocffi
else
(callPackage ../development/python-modules/cairocffi {}).cairocffi_0_9;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! That made the fix for thumbor far easier. I also exposed cairocffi_1_0 and cairocffi_0_9 for now as it seems to be a common pattern to add all versioned attributes to the package set and alias one of those to the default package name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to expose them because pythonPackages should only contain a single version of each package. Btw, I think the prettiest way to do this is by using let inherit (calPackage ...) cairocffi cairocffi_0_9; in if isPy3k ....

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit messages for cairocffi should say pythonPackages.cairocffi: ....

Ma27 and others added 3 commits March 13, 2019 11:36
According to `setup.py` in 0.8 older Python wouldn't work.
This patch ensures that the currently broken `thumbor`[1] package builds
and works again.

The following problems were fixed:

* Rather than placing required packages (like `gifsicle` or `exiftool`)
  into the build input list, we reference them explicitly where needed
  to ensure that the package works after the build without further
  installs.

* Skip the `test_redeye_applied` test case which is broken for a while
  now.

[1] https://hydra.nixos.org/build/90290998
This patch ensures that Python2 can be used if cairocffi is used.
Version 1.0 dropped Python 2 support.
@dotlambda dotlambda merged commit b8f0c18 into NixOS:master Mar 13, 2019
@dotlambda
Copy link
Member

Cherry picked in ab89b6b..3274b1d.

Btw, I also pushed f721655 (cherry picked in cdc714f).

@kamilchm
Copy link
Member

kamilchm commented Mar 18, 2019

@avnik is there a way to use it with overridden withXcffib like in

let cairocffi-xcffib = python37Packages.cairocffi.override {
withXcffib = true;
};
in
?
I can't make it work after this change.

@dotlambda
Copy link
Member

@kamilchm Sorry for messing that up. An easy way to make it work would be to use three files: default.nix and 0_9.nix, which both call common.nix. I'll make the change once I have time for it.

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

Successfully merging this pull request may close these issues.

None yet

6 participants