<html><head><base href="x-msg://1/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">FYI, I recall homebrew has tensorflow, so you might get some hints looking at their formula.<div><br></div><div>Marius was taking this on a few months ago as well, so might have some thoughts.</div><div><br></div><div>Ken</div><div><br></div><div><br><div><div>On 2017-12-18, at 1:52 PM, Enrico Maria Crisostomo wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo, Arial; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="font-family: Menlo, Arial; word-wrap: break-word; "><div id="bloop_customfont" style="font-family: Menlo, Arial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi,</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">I’m trying to create a port for TensorFlow and I have already accumulated quite a number of doubts in just a couple of hours I've been working on it.</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">First of all, I realised (late) that TensorFlow (and some of its dependencies) is built as a wheel package (a .whl file), and as such it gets uploaded to the Python Package Index: ​<a href="https://pypi.python.org/pypi/tensorflow/1.4.1" style="font-family: Menlo, Arial; ">https://pypi.python.org/pypi/tensorflow/1.4.1</a>.  whl files are meant to be installed with pip, so my current port file does the following:</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; "><div style="font-family: Menlo, Arial; ">  if {${name} ne ${subport}} {</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">    build {</div><div style="font-family: Menlo, Arial; ">    }</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">    destroot.cmd        pip-${python.branch}</div><div style="font-family: Menlo, Arial; ">    destroot.pre_args</div><div style="font-family: Menlo, Arial; ">    destroot.args       \</div><div style="font-family: Menlo, Arial; ">        install \</div><div style="font-family: Menlo, Arial; ">        --no-cache-dir \</div><div style="font-family: Menlo, Arial; ">        --no-dependencies \</div><div style="font-family: Menlo, Arial; ">        --target ${destroot}${python.pkgd} \</div><div style="font-family: Menlo, Arial; ">        ${worksrcpath}/${distname}${extract.suffix}</div><div style="font-family: Menlo, Arial; ">    destroot.post_args</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">    livecheck.type      none</div><div style="font-family: Menlo, Arial; ">  }</div></div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">You can see the PR here: <a href="https://github.com/macports/macports-ports/pull/1131" style="font-family: Menlo, Arial; ">https://github.com/macports/macports-ports/pull/1131</a></div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">The port apparently work, but I'd like to submit this port for review for the following reasons:</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">  * I'm not sure we should install a whl file this way, invoking `pip`.</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">  * I had to redefine `master_sites` and `checksums` for each version of Phyton.</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">  * I had to redefine the `extract` properties to skip extraction and just copy the downloaded file into `${worksrcpath}`:</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">      extract.suffix      .whl</div><div style="font-family: Menlo, Arial; "><div style="font-family: Menlo, Arial; ">      extract.cmd         cp</div><div style="font-family: Menlo, Arial; ">      extract.pre_args</div><div style="font-family: Menlo, Arial; ">      extract.post_args   ${worksrcpath}</div><div style="font-family: Menlo, Arial; ">      extract.mkdir       yes</div></div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">  * Is there a better idiom to refer to the currently-installed `pip`?</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">      destroot.cmd        pip-${python.branch}</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">  * Is there a better idiom to refer to the Python site packages directory in the staging area?</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">      ${destroot}${python.pkgd}</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">Finally, I'm wondering whether this is a good idea at all.  I've grep-ed the ports and I saw no other whl file installed this way.</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">If you can have a look at the PR I will appreciate any feedback and insight.</div><div style="font-family: Menlo, Arial; "><br style="font-family: Menlo, Arial; "></div><div style="font-family: Menlo, Arial; ">Cheers,</div><div style="font-family: Menlo, Arial; ">-- </div><div style="font-family: Menlo, Arial; ">Enrico</div></div></span></blockquote></div><br></div></body></html>