Ticket #1990 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

python mapscript setup.py doesn't handle framework link options

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

Description (last modified by hobu) (diff)

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

Changed 6 years ago by dmorissette

  • owner changed from mapserverbugs to hobu@…
  • component changed from Build Problems to MapScript-Python
Reassigned bug to owner of Python-MapScript component

Changed 6 years ago by dmorissette

  • cc dmorissette@… added

Changed 6 years ago by hobu

  • status changed from new to assigned
William,

I applied this in the head branch.  Please confirm.

Howard

Changed 6 years ago by kyngchaos@…

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.

Changed 6 years ago by hobu

added

Changed 6 years ago by kyngchaos@…

Looks good to me.

Changed 6 years ago by kyngchaos@…

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

Changed 6 years ago by dmorissette

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.

Changed 6 years ago by hobu

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

Changed 6 years ago by kyngchaos@…

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

Changed 6 years ago by hobu

  • status changed from assigned to closed
  • resolution set to fixed
  • description modified (diff)
Note: See TracTickets for help on using tickets.