distutils setup.cfg question.

Discussion in 'Python' started by Mike Meyer, Nov 19, 2004.

  1. Mike Meyer

    Mike Meyer Guest

    Ok, I give up. I searched the CVS code, and can't find the place that
    turns an include_dirs option in setup.cfg into a list of
    directories. The reason I was looking for it is that I can't figure
    out how to make include_dirs include multiple directories from
    setup.cfg. Everything I try winds up putting
    -I<contents_of_include_dirs>. I couldn't even find the place where the
    string value that is returned by ConfigParser is enclosed in a list.

    Help?

    Thankx,
    <mike
    --
    Mike Meyer <> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
    Mike Meyer, Nov 19, 2004
    #1
    1. Advertising

  2. Mike Meyer wrote:
    > Ok, I give up. I searched the CVS code, and can't find the place that
    > turns an include_dirs option in setup.cfg into a list of
    > directories. The reason I was looking for it is that I can't figure
    > out how to make include_dirs include multiple directories from
    > setup.cfg. Everything I try winds up putting
    > -I<contents_of_include_dirs>. I couldn't even find the place where the
    > string value that is returned by ConfigParser is enclosed in a list.


    I did it this way:

    % cd work/py2.4/Lib/distutils/
    % grep setup.cfg *
    dist.py: on Windows/Mac, and setup.cfg in the current directory.
    dist.py: # All platforms support local setup.cfg
    dist.py: local_file = "setup.cfg"

    So it is clearly dist.py. There, setup.cfg is returned from
    find_config_files. This is called a single time only in dist.py,
    namely from parse_config_files. As you can see, this is then set
    as the global include_dirs option. Apparently, include_dirs really
    *is* a single string, then.

    Now, where is it split into multiple substrings?
    % grep include_dirs *.py */*.py

    This gives a long list. However, in two places, include_dirs is split:
    command/config.py: self.include_dirs =
    string.split(self.include_dirs, os.pathsep)
    command/build_ext.py: self.include_dirs =
    string.split(self.include_dirs, os.pathsep)

    Both places have similar code:

    if self.include_dirs is None:
    self.include_dirs = self.distribution.include_dirs or []
    elif type(self.include_dirs) is StringType:
    self.include_dirs = string.split(self.include_dirs, os.pathsep)

    HTH,
    Martin
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=, Nov 19, 2004
    #2
    1. Advertising

  3. Mike Meyer

    Mike Meyer Guest

    "Martin v. Löwis" <> writes:

    > Mike Meyer wrote:
    >> Ok, I give up. I searched the CVS code, and can't find the place that
    >> turns an include_dirs option in setup.cfg into a list of
    >> directories. The reason I was looking for it is that I can't figure
    >> out how to make include_dirs include multiple directories from
    >> setup.cfg. Everything I try winds up putting
    >> -I<contents_of_include_dirs>. I couldn't even find the place where the
    >> string value that is returned by ConfigParser is enclosed in a list.

    >
    > % grep include_dirs *.py */*.py
    >
    > This gives a long list. However, in two places, include_dirs is split:
    > command/config.py: self.include_dirs =
    > string.split(self.include_dirs, os.pathsep)
    > command/build_ext.py: self.include_dirs =
    > string.split(self.include_dirs, os.pathsep)


    That's the code I was missing. And I missed it because I wasn't
    looking in subdirectories (duh).

    > Both places have similar code:
    >
    > if self.include_dirs is None:
    > self.include_dirs = self.distribution.include_dirs or []
    > elif type(self.include_dirs) is StringType:
    > self.include_dirs = string.split(self.include_dirs, os.pathsep)


    That helps immensely. But it seems to make setup.cfg non-portable, in
    that you have to change the path separator in it to the one for the
    platform you are on. I guess that since editing setup.cfg is expected,
    that's not to bad.

    Next question: I'd like to submit a bug report and patch for the
    documentation of distutils. Where do I get copies of the source to
    work on?

    Thanks,
    <mike
    --
    Mike Meyer <> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
    Mike Meyer, Nov 19, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. salvage

    CFG / INI file

    salvage, Mar 5, 2004, in forum: C++
    Replies:
    1
    Views:
    853
    Julie
    Mar 5, 2004
  2. Alexandre Guimond

    libraries options not split in setup.cfg

    Alexandre Guimond, Oct 19, 2006, in forum: Python
    Replies:
    0
    Views:
    247
    Alexandre Guimond
    Oct 19, 2006
  3. Chris Shenton
    Replies:
    1
    Views:
    1,446
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Aug 24, 2007
  4. Jasiu

    version in setup.cfg

    Jasiu, Feb 9, 2009, in forum: Python
    Replies:
    2
    Views:
    297
    Jasiu
    Feb 10, 2009
  5. Chris Withers
    Replies:
    0
    Views:
    198
    Chris Withers
    Sep 9, 2009
Loading...

Share This Page