[Distutils] using sub_commands in distutils
Manlio Perillo
manlio_perillo at libero.it
Fri May 14 19:22:40 CEST 2010
P.J. Eby ha scritto:
> [...]
>> I want messages to be compiled (using compile_catalog distutils command
>> from babel) in all these cases:
>> 1) create a binary distribution
>> 2) create an egg
>> 3) running the setup using develop command
>>
>>
>> > [...]
> [...]
>> However I noted that running
>> python setup.py develop
>>
>> does not execute the compile_catalog command.
>
> Ah. Okay, so yes, you'd need to subclass develop as well as bdist_egg.
I have subclassed develop command:
class develop(develop):
sub_commands = [('compile_catalog', None)] + develop.sub_commands
cmdclass = dict(build=build, develop=develop),
However compile_catalog is not called.
> An easier way, however, might be to define aliases in setup.cfg:
>
> [alias]
> develop = build_mo develop
> bdist_egg = build_mo bdist_egg
Thanks, this seems a good solution.
I think I will use this.
Note however that the configuration group is "aliases", not "alias".
It is unfortunate that aliases are not executed internally.
That is, I would really like to define an alias for the "build" command,
and have it expanded when "build" command is called by other commands
like "bdist".
> [...]
> Still another way to accomplish this, would be to add your built files
> to your source distribution(s), so that recipients don't need to do it
> themselves. (Of course, that won't work if the files are
> platform-specific.)
>
In my case this is not a problem, but I prefer to generate them during
setup, if this is not inconvenient.
Regards Manlio
More information about the Distutils-SIG
mailing list