Tackling setup.py - A bug??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander Petrov

    #1

    Tackling setup.py - A bug??

    Hi,

    I've successfully compiled p4python with modified setup.py
    the key to success was to split extra_compile_a rgs'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"
    ],
    )]
    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=DES CRIPTION,
    author=AUTHOR,
    author_email=AU THOR_EMAIL,
    maintainer=MAIN TAINER,
    maintainer_emai l=MAINTAINER_EM AIL,
    license=LICENSE ,
    url=URL,
    keywords=KEYWOR DS,
    classifiers = filter(None, classifiers.spl it("\n")),
    long_descriptio n = "\n".join(docli nes[2:]),
    py_modules=PY_M ODULES,
    ext_modules=[Extension("P4Cl ient", ["P4Clientmodule .cc"],
    include_dirs=[p4_api_dir],
    library_dirs=[p4_api_dir],
    libraries=["client", "rpc", "supp"], #
    P4API libs
    extra_compile_a rgs=["-DCASE_INSENSITI VE",
    "-fpascal-strings",
    "-isysroot/Developer/
    SDKs/MacOSX10.4u.sdk ",
    "-DOS_MACOSX", "-
    DOS_MACOSX104",
    "-DOS_MACOSXPPC", "-
    DOS_MACOSX104PP C" ,"-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@j abber.ru icq:69694782
    http://zowers.googlepages.com/ mailto:zowers@g mail.com
Working...