Discovering and using setup.py options
Ryan Schmidt
ryandesign at macports.org
Wed Nov 7 07:32:59 UTC 2018
On Nov 6, 2018, at 17:50, Chris Jones wrote:
> On 6 Nov 2018, at 11:05 pm, Ryan Schmidt wrote:
>
>> For Python projects that build using a setup.py file, how do I discover what options are available -- what's the equivalent of "./configure --help"? I've tried "python2.7 setup.py --help" and "python2.7 setup.py build --help" which seem to provide only generic help and not help specific to this setup.py file.
>>
>> Once I know what options are available, how do I provide them to setup.py? I've tried adding them to build.args, which gives me an "option not recognized" error.
>>
>> I've tried a couple times in recent days, with setup.py files that, based on my reading of them, provide some custom options that I would like to use, but I can't figure out how to use them. Can anyone help?
>
> Can you post a link to an example of such a file you have been looking at ?
One example is pyobjc-core.
https://bitbucket.org/ronaldoussoren/pyobjc/src/default/pyobjc-core/setup.py
It contains this code:
user_options = [
('use-system-libffi=', None, "use the system installation of libffi"),
('deployment-target=', None, "deployment target to use (can also be set using ${MACOSX_DEPLOYMENT_TARGET})"),
('sdk-root=', None, "Path to the SDK to use (can also be set using ${SDKROOT})"),
]
I assume this means that somehow I should be able to specify the SDK. Yes, I could set the SDKROOT environment variable, but that's described as "also"; that implies there's another way, somehow related to the string "sdk-root=", which I would like to understand.
https://trac.macports.org/ticket/53173
Another is pyopencl.
https://github.com/inducer/pyopencl/blob/master/setup.py
It contains these lines:
StringListOption("CXXFLAGS", default_cxxflags,
help="Any extra C++ compiler options to include"),
StringListOption("LDFLAGS", default_ldflags,
help="Any extra linker options to include"),
I assume this means I can somehow supply CXXFLAGS and LDFLAGS, but I can't figure out how.
https://trac.macports.org/ticket/57520
Both of these examples include help strings. I assume there is some command I could run that would print all the available options along with their help strings. I would like to know what that command is.
More information about the macports-dev
mailing list