
The following .cfg file produces an error:
[sdist] manifest = MANIFEST no-defaults = 1 keep-tree = 1 formats=bztar,gztar,tar,zip,ztar
... error: error in setup.cfg: command 'sdist' has no such option 'keep-tree'
Looks as if the config file parser doesn't like options with embedded hyphens (or maybe it's just me not knowing how to pass the options ?).

"M.-A. Lemburg" wrote:
The following .cfg file produces an error:
[sdist] manifest = MANIFEST no-defaults = 1 keep-tree = 1 formats=bztar,gztar,tar,zip,ztar
... error: error in setup.cfg: command 'sdist' has no such option 'keep-tree'
Looks as if the config file parser doesn't like options with embedded hyphens (or maybe it's just me not knowing how to pass the options ?).
You have to call it keep_tree. It is documented in "Distributing Python Modules" "4. Writing the Setup Configuration File". ( Note that an option spelled --foo-bar on the command-line is spelled foo_bar in configuration files. )
May be distutils should accept both, foo-bar and foo_bar. It is not to hard to change it, lets see what is Gregs opinion.
kind regards
Rene Liebscher

Rene Liebscher wrote:
"M.-A. Lemburg" wrote:
The following .cfg file produces an error:
[sdist] manifest = MANIFEST no-defaults = 1 keep-tree = 1 formats=bztar,gztar,tar,zip,ztar
... error: error in setup.cfg: command 'sdist' has no such option 'keep-tree'
Looks as if the config file parser doesn't like options with embedded hyphens (or maybe it's just me not knowing how to pass the options ?).
You have to call it keep_tree. It is documented in "Distributing Python Modules" "4. Writing the Setup Configuration File". ( Note that an option spelled --foo-bar on the command-line is spelled foo_bar in configuration files. )
Ah ok. Thanks... after having made the change I now get:
error: error in setup.cfg: command 'sdist' has no such option 'no_defaults'
May be distutils should accept both, foo-bar and foo_bar. It is not to hard to change it, lets see what is Gregs opinion.
Would be easier to understand, I guess.
Thanks,

Rene Liebscher wrote:
May be distutils should accept both, foo-bar and foo_bar. It is not to hard to change it, lets see what is Gregs opinion.
M.-A. Lemburg writes:
Would be easier to understand, I guess.
Wouldn't it be easiest to understand if it just used the hyphen in both places? The underscore is a programmers' character, not meant for end users!
-Fred

"M.-A. Lemburg" wrote:
Rene Liebscher wrote:
"M.-A. Lemburg" wrote:
The following .cfg file produces an error:
[sdist] manifest = MANIFEST no-defaults = 1 keep-tree = 1 formats=bztar,gztar,tar,zip,ztar
...
...
Ah ok. Thanks... after having made the change I now get:
error: error in setup.cfg: command 'sdist' has no such option 'no_defaults'
There are two options 'use_defaults' and 'no_defaults'. 'use_defaults' is normally 1 and will be set to 0 if you give the 'no-defaults' option.
'use_defaults = 0' instead 'no_defaults = 1' should work.
kind regards
Rene Liebscher

Hello Fred,
Wouldn't it be easiest to understand if it just used the hyphen in both places? The underscore is a programmers' character, not meant for end users!
It is very easy to "parse" config files if they are written in correct Python code. You just use the Python builtin program parser. Unfortunately Python does not allow a hyphen in a variable name.
Bastian

Bastian Kleineidam writes:
It is very easy to "parse" config files if they are written in correct Python code. You just use the Python builtin program parser. Unfortunately Python does not allow a hyphen in a variable name.
That doesn't seem like the right way to parse config data. Why not use the ConfigParser module? Hyphens are allowed, and the syntax seems to match. (Greg might even have written it this way; not sure.)
-Fred

Rene Liebscher wrote:
"M.-A. Lemburg" wrote:
Rene Liebscher wrote:
"M.-A. Lemburg" wrote:
The following .cfg file produces an error:
[sdist] manifest = MANIFEST no-defaults = 1 keep-tree = 1 formats=bztar,gztar,tar,zip,ztar
...
...
Ah ok. Thanks... after having made the change I now get:
error: error in setup.cfg: command 'sdist' has no such option 'no_defaults'
There are two options 'use_defaults' and 'no_defaults'. 'use_defaults' is normally 1 and will be set to 0 if you give the 'no-defaults' option.
'use_defaults = 0' instead 'no_defaults = 1' should work.
Weird, but works ;-)
Thanks,

"Fred L. Drake, Jr." wrote:
Rene Liebscher wrote:
May be distutils should accept both, foo-bar and foo_bar. It is not to hard to change it, lets see what is Gregs opinion.
M.-A. Lemburg writes:
Would be easier to understand, I guess.
Wouldn't it be easiest to understand if it just used the hyphen in both places? The underscore is a programmers' character, not meant for end users!
I guess it would break existing setup.cfg files, but having both and just documenting one (the hyphen version) should "fix" this for future setup.cfg writers ;-)

M.-A. Lemburg writes:
I guess it would break existing setup.cfg files, but having both and just documenting one (the hyphen version) should "fix" this for future setup.cfg writers ;-)
Annoying, but I could live with that.
-Fred

On 20 September 2000, M.-A. Lemburg said:
Ah ok. Thanks... after having made the change I now get:
error: error in setup.cfg: command 'sdist' has no such option 'no_defaults'
I'm open to config files accepting hyphens as well as underscores. The current config parsing code was thrown together pretty quickly, and yes it *does* use ConfigParser. Accepting hyphens would make the documentation a bit simpler, which is always a good metric of software complexity.
The no_default vs. use_defaults could definitely be massaged a bit. It's not documented at *all*; in fact, the docs as written would lead you to believe that anything you see in "--help" output can be used in a config file (modulo the underscore/hyphen thingy).
But that's not so: some options are just "negative aliases" for others. The underlying reason for this is sound (--use-defaults and --no-default both set the same instance attribute: 'use_defaults'), but that's just an explanation, not an excuse. IMHO the config file should accept as close to what the command-line accepts as possible: this means hyphens too, and it means handling "negative alias" options.
Hmmm. I'll look into it -- just added it to the TODO file, FWIW. Anyone who wants to give it a shot and submit a patch should look at the 'parse_config_files()' method in dist.py.
Greg

Greg Ward wrote:
On 20 September 2000, M.-A. Lemburg said:
Ah ok. Thanks... after having made the change I now get:
error: error in setup.cfg: command 'sdist' has no such option 'no_defaults'
I'm open to config files accepting hyphens as well as underscores. The current config parsing code was thrown together pretty quickly, and yes it *does* use ConfigParser. Accepting hyphens would make the documentation a bit simpler, which is always a good metric of software complexity.
Indeed :-)
The no_default vs. use_defaults could definitely be massaged a bit. It's not documented at *all*; in fact, the docs as written would lead you to believe that anything you see in "--help" output can be used in a config file (modulo the underscore/hyphen thingy).
Right, that's what I thought... didn't work out all the way, but would certainly make understanding distutils a lot easier.
But that's not so: some options are just "negative aliases" for others. The underlying reason for this is sound (--use-defaults and --no-default both set the same instance attribute: 'use_defaults'), but that's just an explanation, not an excuse. IMHO the config file should accept as close to what the command-line accepts as possible: this means hyphens too, and it means handling "negative alias" options.
Right again :-)
Hmmm. I'll look into it -- just added it to the TODO file, FWIW. Anyone who wants to give it a shot and submit a patch should look at the 'parse_config_files()' method in dist.py.
Apropos patch: have you seen the patch I posted here which allows distutils to compile PYC and PYO files in one go ? It basically adds a new util function compile() which takes care of the logic.
Python's sys module should really support e.g. sys.setoptimization() for this kind of task... it's on the plate, but we're in a feature freeze so it won't make it into 2.0.
participants (5)
-
Bastian Kleineidam
-
Fred L. Drake, Jr.
-
Greg Ward
-
M.-A. Lemburg
-
Rene Liebscher