Subject: pkg/29704: fsh doesn't like python 2.4
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <lukem@NetBSD.org>
List: pkgsrc-bugs
Date: 03/16/2005 05:28:00
>Number:         29704
>Category:       pkg
>Synopsis:       fsh doesn't like python 2.4
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 16 05:28:00 +0000 2005
>Originator:     Luke Mewburn
>Release:        NetBSD 2.99.10
>Organization:
TNF
>Environment:
>Description:
	The fsh package (security/fsh) doesn't operate correctly
	with python 2.4, because the FCNTL module was deprecated
	in the latter.
	
>How-To-Repeat:
	Try to run fsh.

	% fsh
	Traceback (most recent call last):
	  File "/usr/pkg/bin/fsh", line 6, in ?
	    import fsh
	  File "/usr/pkg/share/fsh/fsh.py", line 28, in ?
	    import fshlib
	  File "/usr/pkg/share/fsh/fshlib.py", line 24, in ?
	    import fshcompat
	  File "/usr/pkg/share/fsh/fshcompat.py", line 67, in ?
	    import FCNTL
	ImportError: No module named FCNTL

>Fix:
	Apply this patch.  It seems to work, but I'm not python clued
	enough to know if it's strictly correct.
	Once fixed correctly, feed the fix upstream.


--- fshcompat.py.orig	2001-12-23 22:08:26.000000000 +1100
+++ fshcompat.py
@@ -52,20 +52,23 @@ except:
 # in Python 2.2 as a bug.  See <URL:http://sourceforge.net/tracker/
 # ?func=detail&aid=496171&group_id=5470&atid=105470>.
 try:
-    # Stop Python 2.2 from warning that we import a deprecated module.
-    # But Python 1.5.2 doesn't have the warnings module, so be prepared
-    # for the import statement to fail.
     try:
-        import warnings
-        warnings.filterwarnings(
-            "ignore",
-            "the FCNTL module is deprecated; please use fcntl",
-            DeprecationWarning)
-    except ImportError:
-        pass
+	FD_CLOEXEC = fcntl.FD_CLOEXEC
+    except:
+	# Stop Python 2.2 from warning that we import a deprecated module.
+	# But Python 1.5.2 doesn't have the warnings module, so be prepared
+	# for the import statement to fail.
+	try:
+	    import warnings
+	    warnings.filterwarnings(
+		"ignore",
+		"the FCNTL module is deprecated; please use fcntl",
+		DeprecationWarning)
+	except ImportError:
+	    pass
 
-    import FCNTL
-    FD_CLOEXEC = FCNTL.FD_CLOEXEC
+	import FCNTL
+	FD_CLOEXEC = FCNTL.FD_CLOEXEC
 
 except AttributeError: