<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 3, 2015 at 4:07 PM David Verelst <<a href="mailto:david.verelst@gmail.com">david.verelst@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><p style="margin:1.2em 0px!important">Hi,</p>
<p style="margin:1.2em 0px!important">For the wafo [1] package we are trying to include the extension compilation process in <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">setup.py</code> [2] by using <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">setuptools</code> and <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">numpy.distutils</code> [3]. Some of the extensions have one Fortran interface source file, but it depends on several other Fortran sources (modules). The manual compilation process would go as follows:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,255) none repeat scroll 0% 0%">gfortran -fPIC -c source_01.f
gfortran -fPIC -c source_02.f
f2py -m module_name -c source_01.o source_02.o source_interface.f
</code></pre><p style="margin:1.2em 0px!important">Can this workflow be incorporated into <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">setuptools</code>/<code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">numpy.distutils</code>? Something along the lines as:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,255) none repeat scroll 0% 0%">from numpy.distutils.core import setup, Extension
ext = Extension('<a href="http://module.name" target="_blank">module.name</a>',
               depends=['source_01.f', 'source_02.f'],
               sources=['source_interface.f'])
</code></pre><p style="margin:1.2em 0px!important">(note that the above does not work)</p>
<p style="margin:1.2em 0px!important">[1] <a href="https://github.com/wafo-project/pywafo" target="_blank">https://github.com/wafo-project/pywafo</a><br>[2] <a href="https://github.com/wafo-project/pywafo/blob/pipinstall/setup.py" target="_blank">https://github.com/wafo-project/pywafo/blob/pipinstall/setup.py</a><br>[3] <a href="http://docs.scipy.org/doc/numpy/reference/distutils.html" target="_blank">http://docs.scipy.org/doc/numpy/reference/distutils.html</a></p>
<p style="margin:1.2em 0px!important">Regards,<br>David</p>
<div title="MDH:PGRpdj48ZGl2PkhpLDxicj48YnI+PC9kaXY+Rm9yIHRoZSB3YWZvIFsxXSBwYWNrYWdlIHdlIGFy
ZSB0cnlpbmcgdG8gaW5j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3NvdXJjZV8wMS5m
JywgJ3NvdXJjZV8wMi5mJ10sPGJyPiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNw
OyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyBzb3VyY2Vz
PVsnc291cmNlX2ludGVyZmFjZS5mJ10pPGJyPmBgYDxicj48L2Rpdj48ZGl2Pihub3RlIHRoYXQg
dGhlIGFib3ZlIGRvZXMgbm90IHdvcmspPGJyPjwvZGl2PjxkaXY+PGJyPlsxXSBodHRwczovL2dp
dGh1Yi5jb20vd2Fmby1wcm9qZWN0L3B5d2Fmbzxicj5bMl0gaHR0cHM6Ly9naXRodWIuY29tL3dh
Zm8tcHJvamVjdC9weXdhZm8vYmxvYi9waXBpbnN0YWxsL3NldHVwLnB5PGJyPlszXSBodHRwOi8v
ZG9jcy5zY2lweS5vcmcvZG9jL251bXB5L3JlZmVyZW5jZS9kaXN0dXRpbHMuaHRtbDxicj48YnI+
PC9kaXY+PGRpdj5SZWdhcmRzLDxicj48L2Rpdj48ZGl2PkRhdmlkPGJyPjwvZGl2Pg==" style="min-height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a></blockquote><div><br></div><div>This might be helpful:</div><div><a href="https://github.com/timcera/wdmtoolbox/blob/master/setup.py">https://github.com/timcera/wdmtoolbox/blob/master/setup.py</a></div><div><br></div><div>Looks like I created the *.pyf file and include that in sources.  I think I only used f2py to create the pyf file and not directly part of the compilation process.  If memory serves the Extension function knows what to do with the pyf file.</div><div><br></div><div>Kindest regards,</div><div>Tim</div></div></div>