[Distutils] complicated setup

Nick Coghlan ncoghlan at gmail.com
Sat Jun 29 11:07:17 CEST 2013


On 29 June 2013 10:09, Ethan Furman <ethan at stoneleaf.us> wrote:
> Am I making this too complicated?  Can I just do my renaming in the setup.py
> script before calling the setup function?

You can't easily create a wheel that way.

What would actually be better is if you could avoid the need for any
Python 3 specific syntax in the first place. Are you sure you can't
tweak the code to use types.new_class or an inner function call to
avoid the syntax problems?

For example, Python 2 can do keyword only arguments like this:

    def _unpack_args(module=None, type=None):
        return module, type

    class CallableWithKeywordOnlyArgs
        def  __call__(cls, value, names=None, **kwargs):
            module, type = _unpack_kwargs(**kwargs)

The introspection support and error messages aren't as good as those
for true Python 3 keyword-only arguments, but they're not *that* bad.

There's a reason shared syntax compatible 2/3 source has become the
most popular approach for straddling the 2/3 boundary - the
alternatives are all lousy by comparison. Conditional distribution of
version specific source files is far more painful than jumping through
a few syntactic hoops to stay within the common 2/3 subset of the
language.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list