Passing the library path as a command line argument to setup.py

Alexey picture Alexey · Jun 7, 2013 · Viewed 8.7k times · Source
modules = [Extension("MyLibrary",
                    src,
                    language = "c++",
                    extra_compile_args=["-fopenmp", "-std=c++11", "-DNOLOG4CXX"], # log4cxx is not currently used
                    extra_link_args=["-fopenmp", "-std=c++11"],
                    include_dirs=[os.path.join(os.path.expanduser("~"), (os.path.join(gtest, "include"))],
                    library_dirs=[log4cxx_library, os.path.join(os.path.expanduser("~"), gtest)],
                    libraries=["log4cxx", "gtest"])]

This is a part of my setup.py script. How do I pass options like include_dirs or library_dirs through command line arguments, so that path could be set up by the user?

Answer

Tom Dalton picture Tom Dalton · Jun 7, 2013

Think this may be what you're looking for:

http://docs.python.org/2/distutils/configfile.html