Installing a Python wheel (whl) file using a port

Enrico Maria Crisostomo enrico.m.crisostomo at gmail.com
Mon Dec 18 21:52:39 UTC 2017


Hi,

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.

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: ​
https://pypi.python.org/pypi/tensorflow/1.4.1.  whl files are meant to be
installed with pip, so my current port file does the following:

  if {${name} ne ${subport}} {

    build {
    }

    destroot.cmd        pip-${python.branch}
    destroot.pre_args
    destroot.args       \
        install \
        --no-cache-dir \
        --no-dependencies \
        --target ${destroot}${python.pkgd} \
        ${worksrcpath}/${distname}${extract.suffix}
    destroot.post_args

    livecheck.type      none
  }

You can see the PR here:
https://github.com/macports/macports-ports/pull/1131

The port apparently work, but I'd like to submit this port for review for
the following reasons:

  * I'm not sure we should install a whl file this way, invoking `pip`.

  * I had to redefine `master_sites` and `checksums` for each version of
Phyton.

  * I had to redefine the `extract` properties to skip extraction and just
copy the downloaded file into `${worksrcpath}`:

      extract.suffix      .whl
      extract.cmd         cp
      extract.pre_args
      extract.post_args   ${worksrcpath}
      extract.mkdir       yes

  * Is there a better idiom to refer to the currently-installed `pip`?

      destroot.cmd        pip-${python.branch}

  * Is there a better idiom to refer to the Python site packages directory
in the staging area?

      ${destroot}${python.pkgd}

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.

If you can have a look at the PR I will appreciate any feedback and insight.

Cheers,
-- 
Enrico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20171218/51c5b75f/attachment.html>


More information about the macports-dev mailing list