Opened 6 years ago

Closed 6 years ago

#56863 closed enhancement (fixed)

py-enchant: update to version 2.0.0

Reported by: josephsacco Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc:
Port: py-enchant

Description

I updated py-enchant from version 1.6.6 to version 2.0.0. In addition:

  • support for python3.7 was added
  • dependency on enchant 1.6.6 was replaced by enchant2 [current version 2.2.3]

-Joseph

Attachments (2)

Portfile.diff (1.2 KB) - added by josephsacco 6 years ago.
Portfile diff
Portfile.diff_17sep2018.diff (1.1 KB) - added by josephsacco 6 years ago.
Portfile diff to build py-enchant@2.00 using enchant @ 1.6.x

Download all attachments as: .zip

Change History (14)

Changed 6 years ago by josephsacco

Attachment: Portfile.diff added

Portfile diff

comment:1 Changed 6 years ago by mf2k (Frank Schima)

Type: updateenhancement

Thanks. Some comments:

  • The revision line should be deleted because it starts at 0 when increasing the version and that is the default value.
  • This does not build for me.

Error is:

:info:build ImportError: The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI.

comment:2 Changed 6 years ago by mf2k (Frank Schima)

Missing dependency?

comment:3 Changed 6 years ago by josephsacco

I see it...

I updated the dependency on enchant 1.6.6 to enchant2 2.2.3. I have both enchant and enchant2 installed. The setup.py file is looking for the enchant C library in /opt/lib/enchant, which is where enchant 1.6.6 stores the library. enchant2 stores its libraries in /opt/local/lib.

What to do?

The simplest thing to do is to retreat to using enchant instead of enchant2. This approach resets depends_lib-append back to

depends_lib-append port:py${python.version}-setuptools port:enchant

-Joseph

comment:4 Changed 6 years ago by mf2k (Frank Schima)

Looking at the python portgroup, I think you can set ${python.setup_args} to try to tell setuptools the correct location.

comment:5 Changed 6 years ago by josephsacco

Frank,

Give it a try and see if that works. I merely copied and pasted what was in the original Portfile.

-Joseph

comment:6 Changed 6 years ago by mf2k (Frank Schima)

I'm not sure how to do it exactly.

python.setup_args  ????=${prefix}/lib

comment:7 Changed 6 years ago by josephsacco

As may have deduced by now from my monkey-see-monkey-do approach, I am not the right person to ask... :-)

-Joseph

comment:8 Changed 6 years ago by mf2k (Frank Schima)

The spelling libraries are here:

$ port contents enchant | grep applespell
  /opt/local/lib/enchant/libenchant_applespell.a
  /opt/local/lib/enchant/libenchant_applespell.so
$ port contents enchant2 | grep applespell
  /opt/local/lib/enchant-2/enchant_applespell.a
  /opt/local/lib/enchant-2/enchant_applespell.so

comment:9 Changed 6 years ago by josephsacco

Frank,

I admire your tenacity, which has nudged me to take another look... :-).

To build py-enchant using enchant2 rather than enchant1, it is sufficient to tweak the original patch file, replacing libenchant.dylib -> libenchant-2.dylib:

--- enchant/_enchant.orig.py
+++ enchant/_enchant.py
@@ -76,7 +76,7 @@
     yield find_library("libenchant-1")
     # Special-case handling for enchant installed by macports.
     if sys.platform == 'darwin':
-         yield "/opt/local/lib/libenchant.dylib"
+         yield "@PREFIX@/lib/libenchant-2.dylib"


 # On win32 we ship a bundled version of the enchant DLLs.

The reason this works is seen by looking at:

cavandish:lib jsacco$ ls -l /opt/local/lib/libenchant*
-rwxr-xr-x  1 root  admin  42348 Mar 11 18:43 /opt/local/lib/libenchant-2.2.dylib
-rw-r--r--  1 root  admin  41984 Mar 11 18:43 /opt/local/lib/libenchant-2.a
lrwxr-xr-x  1 root  admin     20 Mar 11 18:43 /opt/local/lib/libenchant-2.dylib -> libenchant-2.2.dylib
-rwxr-xr-x  1 root  admin  43064 Nov  2  2017 /opt/local/lib/libenchant.1.dylib
-rw-r--r--  1 root  admin  45712 Nov  2  2017 /opt/local/lib/libenchant.a
lrwxr-xr-x  1 root  admin     18 Nov  2  2017 /opt/local/lib/libenchant.dylib -> libenchant.1.dylib

That "fixes" the problem when building with enchant2, but... The enchant2 build of py36-enchant fails more tests than the enchant1 build:

$ sudo port build py36-enchant
$ cd work/pyenchant-2.0.0
$ sudo sh -c "python3.6 setup.py test 2>&1 | tee test.log"

enchant1

Ran 57 tests in 3.028s

FAILED (failures=6)
Test failed: <unittest.runner.TextTestResult run=57 errors=0 failures=6>
error: Test failed: <unittest.runner.TextTestResult run=57 errors=0 failures=6>

enchant2

Ran 57 tests in 2.926s

FAILED (failures=12, errors=2)
Test failed: <unittest.runner.TextTestResult run=57 errors=2 failures=12>
error: Test failed: <unittest.runner.TextTestResult run=57 errors=2 failures=12>

What to do?

In the short term, use enchant1 rather than enchant2:

  • Use the original patch
  • Edit the dependency in the Portfile to use enchant rather than enchant2

In the longer term pour over the test errors and figure out the problems.

It should be noted that pyenchant is currently lacking a maintainer. See

https://github.com/rfk/pyenchant/

-Joseph

comment:10 Changed 6 years ago by mf2k (Frank Schima)

Sorry for the long delay. I finally had a chance to look at this again. It seems that only one port - gspell - depends on enchant2. But everything else depends on enchant. So let's stick to using enchant(1). Can you post an updated patch for this?

$ port echo depends:enchant
abiword-x11                     
bibledit                        
bluefish                        
claws-mail                      
conglomerate                    
empathy                         
eric4                           
gspell                          
gtkspell2                       
gtkspell3                       
kdelibs4                        
libgtkhtml3                     
libgtkhtml4                     
LyX                             
php53-enchant                   
php54-enchant                   
php55-enchant                   
php56-enchant                   
php70-enchant                   
php71-enchant                   
php72-enchant                   
php73-enchant                   
py-enchant                      
py27-enchant                    
py34-enchant                    
py35-enchant                    
py36-enchant                    
rednotebook                     
webkit-gtk                      
webkit-gtk-2.0                  
webkit-gtk3                     
webkit-gtk3-2.0                 
webkit2-gtk                     
webkit2-gtk-devel               

comment:11 Changed 6 years ago by josephsacco

enchant was taken over by Rueben Thomas:

https://github.com/AbiWord/enchant/blob/master/NEWS

pyenchant is currently unmaintained:

https://github.com/rfk/pyenchant/

I have uploaded a Portfile patch to build py-enchant @2.0.0 using enchant 1.6.x. See attachments.

-Joseph

Changed 6 years ago by josephsacco

Portfile diff to build py-enchant@2.00 using enchant @ 1.6.x

comment:12 Changed 6 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.