Ticket #64442: Portfile

File Portfile, 3.0 KB (added by essandess (Steve Smith), 2 years ago)

Portfile for updated py-tensorflow-metadata

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2
3PortSystem          1.0
4PortGroup           github 1.0
5PortGroup           python 1.0
6
7github.setup        tensorflow metadata 1.5.0 v
8revision            0
9name                py-${github.author}-${github.project}
10
11platforms           darwin
12license             Apache-2
13maintainers         nomaintainer
14
15description         Library and standards for schema and statistics.
16long_description    TensorFlow Metadata provides standard representations \
17                    for metadata that are useful when training machine \
18                    learning models with TensorFlow.
19
20homepage            https://github.com/tensorflow/metadata
21
22checksums           rmd160  c9445e2f238c58b231c887ae0f440c58bac5fce1 \
23                    sha256  f240f8dac7f0487b674754dc03b7b9605bbccc6d3990016cc47226da37934fe7 \
24                    size    35122
25
26python.versions     37 38 39
27
28proc python_listify {tcl_list} {
29    set python_list {}
30    foreach item [lreverse ${tcl_list}] {
31        set python_list "'${item}', ${python_list}"
32    }
33    return ${python_list}
34}
35
36if {${name} ne ${subport}} {
37    PortGroup       bazel 1.0
38
39    bazel.version   3.7
40   
41    # Disable bazel configure and build phase configuration
42    bazel.build_cmd
43    bazel.configure_cmd
44
45    depends_build-append \
46                    port:py${python.version}-pip \
47                    port:py${python.version}-pkginfo \
48                    port:py${python.version}-setuptools
49
50    depends_run-append \
51                    port:py${python.version}-google-api \
52                    port:py${python.version}-protobuf3
53
54    # see ${worksrcpath}/bazel-bin/tensorflow_metadata/move_generated_files
55    set bazel_build_workspace_path \
56                    ${workpath}/build
57    set bazel_build_proto_path \
58                    ${bazel_build_workspace_path}/tensorflow_metadata/proto/v0
59   
60    post-extract {
61        xinstall -d ${bazel_build_proto_path}
62    }
63
64    # Use correct python in bazel build
65    bazel.python_version ${python.branch}
66
67    bazel.build_opts-append \
68                    --sandbox_debug
69
70    # replace with patch files after this repo is a little more stable
71    post-patch {
72        reinplace -E "s|\\\[(self\\._bazel_cmd), ('run'),|\[\\1, [python_listify [option bazel.build_cmd_opts]] 'build',|" \
73                    ${worksrcpath}/setup.py
74        reinplace -E "s|(self\\._additional_build_options = )\\\[\\\]|\\1\[[python_listify [option bazel.build_opts]]]|" \
75                    ${worksrcpath}/setup.py
76    }
77
78    build.asroot    yes
79    destroot.asroot yes
80
81    test.run        yes
82    test.cmd        python${python.branch}
83    test.target     ${github.author}_${github.project}/python/proto_test.py
84    test.env-append PYTHONPATH=${worksrcpath}/build/lib
85
86    post-destroot {
87        set docdir ${prefix}/share/doc/${subport}
88        xinstall -d ${destroot}${docdir}
89        xinstall -m 0644 -W ${worksrcpath} LICENSE README.md ${destroot}${docdir}
90    }
91
92    livecheck.type  none
93}