distutils setup.cfg question.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Meyer

    #1

    distutils setup.cfg question.

    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_i nclude_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 <mwm@mired.or g> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
  • Martin v. Löwis

    #2
    Re: distutils setup.cfg question.

    Mike Meyer wrote:[color=blue]
    > 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_i nclude_dirs>. I couldn't even find the place where the
    > string value that is returned by ConfigParser is enclosed in a list.[/color]

    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_fil es. This is called a single time only in dist.py,
    namely from parse_config_fi les. 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_di rs =
    string.split(se lf.include_dirs , os.pathsep)
    command/build_ext.py: self.include_di rs =
    string.split(se lf.include_dirs , os.pathsep)

    Both places have similar code:

    if self.include_di rs is None:
    self.include_di rs = self.distributi on.include_dirs or []
    elif type(self.inclu de_dirs) is StringType:
    self.include_di rs = string.split(se lf.include_dirs , os.pathsep)

    HTH,
    Martin

    Comment

    • Mike Meyer

      #3
      Re: distutils setup.cfg question.

      "Martin v. Löwis" <martin@v.loewi s.de> writes:
      [color=blue]
      > Mike Meyer wrote:[color=green]
      >> 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_i nclude_dirs>. I couldn't even find the place where the
      >> string value that is returned by ConfigParser is enclosed in a list.[/color]
      >
      > % grep include_dirs *.py */*.py
      >
      > This gives a long list. However, in two places, include_dirs is split:
      > command/config.py: self.include_di rs =
      > string.split(se lf.include_dirs , os.pathsep)
      > command/build_ext.py: self.include_di rs =
      > string.split(se lf.include_dirs , os.pathsep)[/color]

      That's the code I was missing. And I missed it because I wasn't
      looking in subdirectories (duh).
      [color=blue]
      > Both places have similar code:
      >
      > if self.include_di rs is None:
      > self.include_di rs = self.distributi on.include_dirs or []
      > elif type(self.inclu de_dirs) is StringType:
      > self.include_di rs = string.split(se lf.include_dirs , os.pathsep)[/color]

      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 <mwm@mired.or g> http://www.mired.org/home/mwm/
      Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

      Comment

      Working...