Opened 17 years ago

Closed 17 years ago

#1990 closed defect (fixed)

python mapscript setup.py doesn't handle framework link options — at Version 11

Reported by: kyngchaos@… Owned by: hobu@…
Priority: high Milestone:
Component: MapScript-Python Version: 4.10
Severity: normal Keywords:
Cc:

Description (last modified by hobu)

If a Mac OS X framework or framework path option are passed to setup.py, they are dropped because 
the setup script strips unknown options.  This patch did the trick for me:

--- setup.py-orig	2006-05-31 09:48:31.000000000 -0500
+++ setup.py	2006-12-22 20:57:35.000000000 -0600
@@ -57,18 +57,27 @@
 
 libs = []
 extras = []
+ex_next = False
 
 for x in lib_opts:
-    if x[:2] == '-l':
+    if ex_next:
+        extras.append(x)
+        ex_next = False
+    elif x[:2] == '-l':
         libs.append( x[2:] )
-    if x[-4:] == '.lib' or x[-4:] == '.LIB':
+    elif x[-4:] == '.lib' or x[-4:] == '.LIB':
 	    dir, lib = os.path.split(x)
 	    libs.append( lib[:-4] )
 	    if len(dir) > 0:
 	        lib_dirs.append( dir )
-    if x[-2:] == '.a':
+    elif x[-2:] == '.a':
+        extras.append(x)
+    elif x[:10] == '-framework':
         extras.append(x)
-        
+        ex_next = True
+    elif x[:2] == '-F':
+        extras.append(x)
+
 libs = unique(libs)
 
 # if we're msvc, just link against the stub lib


Frameworks use the form: -framework foo, so are two words, thus the ex_next tracking.  Framework 
path flags are like library path flags, but with -F.  Distutils doesn't appear to know about frameworks, 
so I dump them all into extras.

Change History (11)

comment:1 by dmorissette, 17 years ago

Component: Build ProblemsMapScript-Python
Owner: changed from mapserverbugs to hobu@…
Reassigned bug to owner of Python-MapScript component

comment:2 by dmorissette, 17 years ago

Cc: dmorissette@… added

comment:3 by hobu, 17 years ago

Status: newassigned
William,

I applied this in the head branch.  Please confirm.

Howard

comment:4 by kyngchaos@…, 17 years ago

looks like part of it didn't get applied:

+    if ex_next:
+        extras.append(x)
+        ex_next = False

ex_next = False is missing.  This is needed to reset the -framework flag after grabbing the value following 
it.  Otherwise, *everything* after a framework flag will dumped into extras.

comment:5 by hobu, 17 years ago

added

comment:6 by kyngchaos@…, 17 years ago

Looks good to me.

comment:7 by kyngchaos@…, 17 years ago

I see that this patch didn't make it into the 4.10.1 release.  Maybe because it didn't get closed?

comment:8 by dmorissette, 17 years ago

The patch was applied only in the development version (V4.99, CVS HEAD) and has
not been backported to the 4.10 branch. It is up to Howard to decide whether it
is safe to backport this to the 4.10 branch to be included in a future 4.10.2
release.

comment:9 by hobu, 17 years ago

I just spaced this one out as far as backporting.  William, I have applied it in
the 4.10 branch.  Can you confirm it does what it is supposed to now?

Howard

comment:10 by kyngchaos@…, 17 years ago

After patching my 4.10.1 source, it still works as desired.  It looks right in CVS (rev 1.19.2.1).

comment:11 by hobu, 17 years ago

Description: modified (diff)
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.