Opened 10 years ago

Closed 10 years ago

#44472 closed enhancement (fixed)

py27-pyphant-imageprocessing @1.0b3 replace py27-pil dependency by py27-Pillow

Reported by: alexander.held@… Owned by: rowue@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: Ionic (Mihai Moldovan), servicegruppe.wissinfo@…, rowue@…, mojca (Mojca Miklavec)
Port: py27-pyphant-imageprocessing

Description

The path-based approach for removing the py27-pil dependency as suggested in #44285 is not working in a straight-forward way for py27-pyphant-imageprocessing, as PIL is also a dependency on the setuptools level. The runtime plugin mechanism for adding the py27-pyphant-imageprocessing toolbox to py-pyphant will fail when it cannot resolve this dependency as it is based on pkg_resources. The Pillow/PIL fallback mechanism would also have to be implemented on the setuptools level.

A possible solution could be to completely remove the py27-pil dependency from py27-pyphant-imageprocessing, replacing it by py27-Pillow and patching the setup.py file to also refer to Pillow instead of PIL.

Change History (10)

comment:1 Changed 10 years ago by rowue@…

Owner: changed from macports-tickets@… to rowue@…

comment:2 Changed 10 years ago by rowue@…

One question: migth it be possible to simply work with patches. So if py*-Pillow is present, the config for setup-tools is set to py*-Pillow, otherwise py*-pil is used?

comment:3 in reply to:  2 Changed 10 years ago by alexander.held@…

Replying to rowue@…:

One question: migth it be possible to simply work with patches. So if py*-Pillow is present, the config for setup-tools is set to py*-Pillow, otherwise py*-pil is used?

This should also be possible. I will try to prepare a fix for the Portfile using the path-based dependency and a conditional patch.

comment:4 Changed 10 years ago by Ionic (Mihai Moldovan)

Not sure... but it seems like that's possible.

if {![catch [set Pillow_installed [lindex [registry_active py27-Pillow] 0]}] } {
    # patch for Pillow
} # else { leave PIL or patch for PIL }

Should be doing that. post-patch sounds appropriate as a phase for this.

comment:5 in reply to:  4 ; Changed 10 years ago by alexander.held@…

Replying to ionic@…:

Not sure... but it seems like that's possible.

if {![catch [set Pillow_installed [lindex [registry_active py27-Pillow] 0]}] } {
    # patch for Pillow
} # else { leave PIL or patch for PIL }

Should be doing that. post-patch sounds appropriate as a phase for this.

I experimented around a bit. My problem is that the patch phase is not run at all, when a pre-built version is fetched from the macports server. So conditional patching would also require to set the revision dynamically before the fetch phase but after it is clear, which dependency is actually used. I don't know, if this is possible.

Alternatively, one could maybe patch the egg-info in a later phase and change the dependency in the requires.txt file instead of in the setup.py?

comment:6 in reply to:  5 ; Changed 10 years ago by mojca (Mojca Miklavec)

Replying to alexander.held@…:

I experimented around a bit. My problem is that the patch phase is not run at all, when a pre-built version is fetched from the macports server.

Which is why the port should use port variants (one variant for dependency on pil and the other variant for dependency on pillow).

You cannot use path-based dependency for that, but it is straightforward to do. You can check whether Pil is activated and if so, use +pil. Else use +pillow. You then define the patching inside the variant.

comment:7 in reply to:  6 Changed 10 years ago by alexander.held@…

Replying to mojca@…:

...

Which is why the port should use port variants (one variant for dependency on pil and the other variant for dependency on pillow).

You cannot use path-based dependency for that, but it is straightforward to do. You can check whether Pil is activated and if so, use +pil. Else use +pillow. You then define the patching inside the variant.

This seems to be a cleaner solution. I'll try to go this way.

comment:8 Changed 10 years ago by alexander.held@…

A solution using only one fallback variant (pil) has been committed in r122800. The default dependency for the "blank" variant is now Pillow. If there is a good reason to have two variants, it should be straight-forward to alter r122800.

comment:9 Changed 10 years ago by Ionic (Mihai Moldovan)

I like it. :)

comment:10 Changed 10 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed
Version: 2.3.1

Thank you, I'm closing the ticket. I also deleted files/pyphant in r122814. It was a leftover from wxGTK and should no longer be needed.

(I would merge these two patches into a single one which would only leave you with patchfiles patch-pillow.diff, but that's just cosmetics.)

Note: See TracTickets for help on using tickets.