Distutils vs. Extension header files

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

    #1

    Distutils vs. Extension header files

    I've got a package that includes an extension that has a number of
    header files in the directory with the extension. They are specified
    as "depends = [...]" in the Extension class. However, Distutils
    doesn't seem to do anything with them.

    If I do an sdist, the include files aren't added to the tarball.

    If I do a bdist_rpm, the source files get copied into the build
    directory and the build starts, but the header files aren't copied
    with the source file, so the build fails with a missing header file.

    I find it hard to believe that this is a bug in distutils, so I'd
    appreciate it if someone could tell me what I'm doing wrong.

    Thanks,
    <mike
    --
    Mike Meyer <mwm@mired.or g> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
  • vincent wehren

    #2
    Re: Distutils vs. Extension header files

    Mike Meyer wrote:[color=blue]
    > I've got a package that includes an extension that has a number of
    > header files in the directory with the extension. They are specified
    > as "depends = [...]" in the Extension class. However, Distutils
    > doesn't seem to do anything with them.
    >
    > If I do an sdist, the include files aren't added to the tarball.[/color]

    IIRC you need to add a MANIFEST.IN file to get non-Python files
    (including those already referenced in your setup.py) in the mix. You'll
    propably need a MANIFEST.IN looking something like the following:

    include *.txt
    include MANIFEST.in
    include setup.py
    include setup.cfg

    recursive-include src *.c *.h
    recursive-include docs *.html *.css *.gif *.jpg *.txt

    prune someolddir


    HTH,
    --

    Vincent Wehren

    [color=blue]
    >
    > If I do a bdist_rpm, the source files get copied into the build
    > directory and the build starts, but the header files aren't copied
    > with the source file, so the build fails with a missing header file.
    >
    > I find it hard to believe that this is a bug in distutils, so I'd
    > appreciate it if someone could tell me what I'm doing wrong.
    >
    > Thanks,
    > <mike[/color]

    Comment

    • David M. Cooke

      #3
      Re: Distutils vs. Extension header files

      Mike Meyer <mwm@mired.or g> writes:
      [color=blue]
      > I've got a package that includes an extension that has a number of
      > header files in the directory with the extension. They are specified
      > as "depends = [...]" in the Extension class. However, Distutils
      > doesn't seem to do anything with them.
      >
      > If I do an sdist, the include files aren't added to the tarball.
      >
      > If I do a bdist_rpm, the source files get copied into the build
      > directory and the build starts, but the header files aren't copied
      > with the source file, so the build fails with a missing header file.
      >
      > I find it hard to believe that this is a bug in distutils, so I'd
      > appreciate it if someone could tell me what I'm doing wrong.[/color]

      vincent has the solution (you need to specify them in MANIFEST.in),
      but I'll add my 2 cents.

      depends = [...] is used in building (it's like dependencies in make).
      If one of those files change, distutils will rebuild the extension.
      But that's all distutils does with it. It's braindead including stuff
      in the source distribution, including depends, data files, and other
      stuff you'd think it would do. When in doubt, add it to MANIFEST.in.

      --
      |>|\/|<
      /--------------------------------------------------------------------------\
      |David M. Cooke
      |cookedm(at)phy sics(dot)mcmast er(dot)ca

      Comment

      • Mike Meyer

        #4
        Re: Distutils vs. Extension header files

        cookedm+news@ph ysics.mcmaster. ca (David M. Cooke) writes:
        [color=blue]
        > vincent has the solution (you need to specify them in MANIFEST.in),
        > but I'll add my 2 cents.[/color]

        Yup. That solved the problem.
        [color=blue]
        > depends = [...] is used in building (it's like dependencies in make).
        > If one of those files change, distutils will rebuild the extension.
        > But that's all distutils does with it. It's braindead including stuff
        > in the source distribution, including depends, data files, and other
        > stuff you'd think it would do. When in doubt, add it to MANIFEST.in.[/color]

        That pretty much sucks. I've filed a bug report (1083299) about it. If
        I find time, I'll look into a fixing it myself.

        <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...