
I am trying to put the option --no-rpm-opt-flags to bdist_rpm permanently into setup.cfg. According to my understanding of the manual, I should add the line no-rpm-opt-flags = 1 But that doesn't work: running bdist_rpm error: error in setup.cfg: command 'bdist_rpm' has no such option 'no_rpm_opt_flags' What am I doing wrong? Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------------

From: "Konrad Hinsen" <hinsen@cnrs-orleans.fr>
It seems no_rpm_opt_flags is not a 'first-class' option (whatever this may be ;-). According to the source no_rpm_opt_flags is a negative option - inverting the value of use_rpm_opt_flags. You should probably try to add the line use_rpm_opt_flags = 0 in the setup.cfg file (but this is simply guesswork).
Konrad.
HTH, Thomas

"Thomas Heller" <thomas.heller@ion-tof.com> writes:
Good start, this is accepted - but has no effect, unfortunately. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------------

Konrad Hinsen wrote:
I suggest you take the debugger and skip to the end of finalize_options() in bdist_rpm.py. I don't see any magic in that routine which would reset .use_rpm_opt_flags, so the magic has to be built into some other part of distutils ;-) What Thomas suggest *should* work. If it doesn't, then something is wrong and we have a bug. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/

I think so... Here's what happens. When I specify the option --no-rpm-opt-flags on the command line, the value of self.use_rpm_opt_flags in the bdist_rpm code is the integer 0. When I set use_rpm_opt_flags=0 in setup.cfg, the value becomes the string '0'. For the subsequent test "if self.use_rpm_opt_flags", that makes a big difference. I'll file a bug report about this. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------------

There's another bug related to options specified in the configuration file. The following entry [install] verbose=0 will also lead to self.verbose having a value of '0' (string) at the end of the finalize_options() method, and The problem is in dist.py, near line 821: bool_opts = map(translate_longopt, command_obj.boolean_options) ... try: is_string = type(value) is StringType if neg_opt.has_key(option) and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) else: raise DistutilsOptionError, \ ("error in %s: command '%s' has no such option '%s'" % (source, command_name, option)) except ValueError, msg: raise DistutilsOptionError, msg Since command_obj.boolean_options does not include 'verbose' (verbose is an attribute of class Distribution), 'verbose' is not recognized as a boolean option, and the value will not be converted by strtobool(). Hm, reading the dist.py source, I find about the [global] section... It seems the [globals] section is not documented anywhere. I should probably use [global] verbose=0 instead, but, nevertheless, the above also looks like a bug to me. I propose the following fix (Note that the #ugh! comment is copied from another, similar code on line 343 ;-) Or should instead using global options in non-global sections of the config file be forbidden? Thomas Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.53 diff -c -r1.53 dist.py *** dist.py 6 Dec 2001 20:51:35 -0000 1.53 --- dist.py 14 Feb 2002 19:35:25 -0000 *************** *** 822,828 **** is_string = type(value) is StringType if neg_opt.has_key(option) and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) ! elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) --- 822,828 ---- is_string = type(value) is StringType if neg_opt.has_key(option) and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) ! elif (option in bool_opts + ['verbose', 'dry_run']) and is_string: # ugh! setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value)

Thomas Heller wrote:
Looks, uhm, ok... :-)
Or should instead using global options in non-global sections of the config file be forbidden?
What are (or would be) the semantics of having a local and a global option of the same name ? -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/

From: "Konrad Hinsen" <hinsen@cnrs-orleans.fr>
It seems no_rpm_opt_flags is not a 'first-class' option (whatever this may be ;-). According to the source no_rpm_opt_flags is a negative option - inverting the value of use_rpm_opt_flags. You should probably try to add the line use_rpm_opt_flags = 0 in the setup.cfg file (but this is simply guesswork).
Konrad.
HTH, Thomas

"Thomas Heller" <thomas.heller@ion-tof.com> writes:
Good start, this is accepted - but has no effect, unfortunately. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------------

Konrad Hinsen wrote:
I suggest you take the debugger and skip to the end of finalize_options() in bdist_rpm.py. I don't see any magic in that routine which would reset .use_rpm_opt_flags, so the magic has to be built into some other part of distutils ;-) What Thomas suggest *should* work. If it doesn't, then something is wrong and we have a bug. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/

I think so... Here's what happens. When I specify the option --no-rpm-opt-flags on the command line, the value of self.use_rpm_opt_flags in the bdist_rpm code is the integer 0. When I set use_rpm_opt_flags=0 in setup.cfg, the value becomes the string '0'. For the subsequent test "if self.use_rpm_opt_flags", that makes a big difference. I'll file a bug report about this. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais -------------------------------------------------------------------------------

There's another bug related to options specified in the configuration file. The following entry [install] verbose=0 will also lead to self.verbose having a value of '0' (string) at the end of the finalize_options() method, and The problem is in dist.py, near line 821: bool_opts = map(translate_longopt, command_obj.boolean_options) ... try: is_string = type(value) is StringType if neg_opt.has_key(option) and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) else: raise DistutilsOptionError, \ ("error in %s: command '%s' has no such option '%s'" % (source, command_name, option)) except ValueError, msg: raise DistutilsOptionError, msg Since command_obj.boolean_options does not include 'verbose' (verbose is an attribute of class Distribution), 'verbose' is not recognized as a boolean option, and the value will not be converted by strtobool(). Hm, reading the dist.py source, I find about the [global] section... It seems the [globals] section is not documented anywhere. I should probably use [global] verbose=0 instead, but, nevertheless, the above also looks like a bug to me. I propose the following fix (Note that the #ugh! comment is copied from another, similar code on line 343 ;-) Or should instead using global options in non-global sections of the config file be forbidden? Thomas Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.53 diff -c -r1.53 dist.py *** dist.py 6 Dec 2001 20:51:35 -0000 1.53 --- dist.py 14 Feb 2002 19:35:25 -0000 *************** *** 822,828 **** is_string = type(value) is StringType if neg_opt.has_key(option) and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) ! elif option in bool_opts and is_string: setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value) --- 822,828 ---- is_string = type(value) is StringType if neg_opt.has_key(option) and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) ! elif (option in bool_opts + ['verbose', 'dry_run']) and is_string: # ugh! setattr(command_obj, option, strtobool(value)) elif hasattr(command_obj, option): setattr(command_obj, option, value)

Thomas Heller wrote:
Looks, uhm, ok... :-)
Or should instead using global options in non-global sections of the config file be forbidden?
What are (or would be) the semantics of having a local and a global option of the same name ? -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
participants (3)
-
Konrad Hinsen
-
M.-A. Lemburg
-
Thomas Heller