Tackling setup.py - A bug??

Alexander Petrov zowers at gmail.com
Sat Jun 9 10:28:17 EDT 2007


Hi,

I've successfully compiled p4python with modified setup.py
the key to success was to split extra_compile_args's argument '-arch'
into 2 args.

below is fixed part:

[code]
             ext_modules=[Extension("P4Client", [ "P4Clientmodule.cc"
],
                            include_dirs=[ os.path.join( p4_api_dir,
"include", "p4" ) ],
                            library_dirs=[ os.path.join( p4_api_dir,
"lib" ) ],
                            libraries=["client", "rpc", "supp"],    #
P4API libs
                            extra_compile_args=["-DCASE_INSENSITIVE",
"-fpascal-strings",
                                                "-isysroot",
"/Developer/SDKs/MacOSX10.4u.sdk",
                                                "-DOS_MACOSX",
"-DOS_MACOSX104"
                                                , "-arch", "ppc"
                                                ,"-D%s" % p4_api_ver],
                            extra_link_args=[
"-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
                                      , "-arch", "ppc"
                            , "-framework", "System"
                            , "-framework", "CoreFoundation"
                            , "-framework", "Carbon"
                            ],
                            )]
[/code]

hope it will help


--- Original Message: ---
And this followed by an setup.py install seemed to work just fine.  Ok
so now I need to backport these options into setup.py.  Here is what I
came up with..

    elif os.name == "posix":
        setup(name=NAME,
             version=VERSION,
             description=DESCRIPTION,
             author=AUTHOR,
             author_email=AUTHOR_EMAIL,
             maintainer=MAINTAINER,
             maintainer_email=MAINTAINER_EMAIL,
             license=LICENSE,
             url=URL,
             keywords=KEYWORDS,
             classifiers = filter(None, classifiers.split("\n")),
             long_description = "\n".join(doclines[2:]),
             py_modules=PY_MODULES,
             ext_modules=[Extension("P4Client", ["P4Clientmodule.cc"],
                            include_dirs=[p4_api_dir],
                            library_dirs=[p4_api_dir],
                            libraries=["client", "rpc", "supp"],    #
P4API libs
                            extra_compile_args=["-DCASE_INSENSITIVE",
"-fpascal-strings",
                                                "-isysroot/Developer/
SDKs/MacOSX10.4u.sdk",
                                                "-DOS_MACOSX", "-
DOS_MACOSX104",
                                                "-DOS_MACOSXPPC", "-
DOS_MACOSX104PPC" ,"-D%s" % p4_api_ver],
                            extra_link_args=[ "-Wl,-syslibroot,/
Developer/SDKs/MacOSX10.4u.sdk", "-arch ppc", "-framework Carbon" ],
                            )])

But low and behold it didn't work...  In the course of debugging I
found that the compile works.  The linking appears to be a problem.
In the link stage I see the command which is being run looks very
similar to my command

g++ -bundle -undefined dynamic_lookup build/temp.macosx-10.3-ppc-2.5/
P4Clientmodule.o \
-Lp4api6.1 -lclient -lrpc -lsupp -o build/lib.macosx-10.3-ppc-2.5/
P4Client.so \
 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -framework
Carbon

Not quite the same but close enough.  HERE is where the bug shows
up........
If I rerun this same EXACT command at the command line - followed by a
setup.py install it works.

Can someone with a larger python brain than mine please help me figure
this out?  It's bugging the crap out fo me...
-- 
BR. Alexander 'zowers' Petrov.    jabber:zowers at jabber.ru    icq:69694782
http://zowers.googlepages.com/    mailto:zowers at gmail.com



More information about the Python-list mailing list