Is this just by name? I don't see in here how B.pyx that references  
A.pxd and C.pxi gets its dependancies updated.

- Robert


On Mar 14, 2008, at 2:43 AM, Stefan Behnel wrote:

> Hi,
>
> based on a problem description by Arc Riley, here's a simple patch  
> that adds
> dependency support to Cython's build_ext implementation (distutils).
>
> It allows you to simply add all .pxd and .pxi files that your .pyx  
> depends on
> to the list of module sources, and have Cython rebuild your module  
> when the
> dependencies are updated.
>
> It does, however, not deal with the case of multiple .pyx files  
> with separate
> dependencies that build a single module. But that could be added  
> through a
> convention in the source order.
>
> Stefan
> # HG changeset patch
> # User Stefan Behnel <[EMAIL PROTECTED]>
> # Date 1205487293 -3600
> # Node ID 1abce3b0dd95220bb0b9b6a86dbe891c5923cc9c
> # Parent  d49c041d08535698109742a2cc4fe9e78eede234
> support adding pxd/pxi dependencies to Extension sources and force  
> rebuild on dependency updates
>
> diff -r d49c041d0853 -r 1abce3b0dd95 Distutils/build_ext.py
> --- a/Distutils/build_ext.py  Sun Mar 09 00:40:34 2008 -0800
> +++ b/Distutils/build_ext.py  Fri Mar 14 10:34:53 2008 +0100
> @@ -155,6 +155,7 @@ class build_ext(_build_ext.build_ext):
>          else:
>              target_dir = None
>
> +        newest_dependency = None
>          for source in sources:
>              (base, ext) = os.path.splitext(os.path.basename(source))
>              if ext == ".pyx":                          # Cython source file
> @@ -162,6 +163,10 @@ class build_ext(_build_ext.build_ext):
>                  new_sources.append(os.path.join(output_dir, base +  
> target_ext))
>                  pyrex_sources.append(source)
>                  pyrex_targets[source] = new_sources[-1]
> +            elif ext == '.pxi' or ext == '.pxd':
> +                if newest_dependency is None \
> +                        or newer(source, newest_dependency):
> +                    newest_dependency = source
>              else:
>                  new_sources.append(source)
>
> @@ -172,7 +177,10 @@ class build_ext(_build_ext.build_ext):
>
>          for source in pyrex_sources:
>              target = pyrex_targets[source]
> -            if self.force or newer(source, target):
> +            rebuild = self.force or newer(source, target)
> +            if not rebuild and newest_dependency is not None:
> +                rebuild = newer(newest_dependency, target)
> +            if rebuild:
>                  log.info("cythoning %s to %s", source, target)
>                  self.mkpath(os.path.dirname(target))
>                  options = CompilationOptions(pyrex_default_options,
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to