source: trunk/dports/lang/python34/Portfile

Last change on this file was 153800, checked in by larryv@…, 9 months ago

python*: Enable loadable SQLite extensions

This is disabled by default because Apple's system SQLite does not
support loadable extensions. But ours does.

Closes #49317.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.7 KB
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# $Id: Portfile 153800 2016-10-11 19:38:22Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6
7name                python34
8
9# Remember to keep py34-tkinter and py34-gdbm's versions sync'd with this
10version             3.4.5
11revision            1
12
13epoch               20160627
14
15set major           [lindex [split $version .] 0]
16set branch          [join [lrange [split ${version} .] 0 1] .]
17categories          lang
18license             PSF
19platforms           darwin
20maintainers         jwa openmaintainer
21
22description         An interpreted, object-oriented programming language
23long_description    Python is an interpreted, interactive, object-oriented \
24                    programming language.
25
26homepage            http://www.python.org/
27master_sites        ${homepage}ftp/python/${version}/
28
29distname            Python-${version}
30
31use_xz              yes
32
33checksums           rmd160  47604be01f37671a16c17e27316af327a1048fd6 \
34                    sha256  ee64b1c8a47461009abf25252332d29a4e587cb4f0c1c96aa793a3732e9d898a
35
36patchfiles          patch-setup.py.diff \
37                    patch-Lib-cgi.py.diff \
38                    patch-configure.diff \
39                    patch-setup.py-disabled_modules.diff \
40                    patch-Lib-ctypes-macholib-dyld.py.diff \
41                    patch-libedit.diff \
42                    omit-local-site-packages.patch
43
44depends_lib         port:zlib path:lib/libssl.dylib:openssl \
45                    port:sqlite3 port:ncurses \
46                    port:bzip2 port:libedit port:gettext \
47                    port:xz
48depends_run         port:python_select \
49                    port:python3_select
50
51# blacklist llvm-gcc-4.2 compiler known to produce bad code
52compiler.blacklist  *llvm-gcc-4.2
53
54# ensurepip arg may be removed later, now conflicts with pip and setuptools
55# packages
56configure.args      --enable-framework=${frameworks_dir} \
57                    --enable-ipv6 \
58                    --enable-loadable-sqlite-extensions \
59                    --with-computed-gotos \
60                    --with-ensurepip=no
61
62configure.ccache    no
63
64use_parallel_build  yes
65
66post-patch {
67    reinplace "s|@@PREFIX@@|${prefix}|g" \
68      ${worksrcpath}/Lib/cgi.py \
69      ${worksrcpath}/Lib/ctypes/macholib/dyld.py
70
71    reinplace "s|/setup.py|/setup.py --no-user-cfg|" ${worksrcpath}/Makefile.pre.in
72
73    # replace /Applications with ${applications_dir}
74    reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" \
75      ${worksrcpath}/configure
76
77    # See http://trac.macports.org/changeset/37861
78    reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
79      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
80}
81
82build.target        all
83
84# test_cmd_line fails
85# see http://bugs.python.org/issue4388 and
86#     http://bugs.python.org/issue4474
87test.run            yes
88test.target         test
89
90destroot.target     frameworkinstall maninstall
91
92# ensure that correct compiler is used
93build.args-append   MAKE="${build.cmd} CC=${configure.cc}"
94destroot.args-append    MAKE="${destroot.cmd} CC=${configure.cc}"
95
96set pythonNoDot python[string map {. {}} $branch]
97select.entries      [list python python-$pythonNoDot $pythonNoDot] \
98                    [list python3 python3-$pythonNoDot $pythonNoDot]
99
100set confdir config-${branch}m
101
102notes "
103To make this the default Python or Python 3 (i.e., the version run by\
104the 'python' or 'python3' commands), run one or both of:
105
106    sudo port select --set python $pythonNoDot
107    sudo port select --set python3 $pythonNoDot
108
109##############################################################
110# IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
111#   py[string map {. {}} $branch]-readline
112# TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
113# REF: https://trac.macports.org/ticket/48807
114##############################################################
115"
116
117post-destroot {
118    set framewpath ${frameworks_dir}/Python.framework
119    set framewdir  ${framewpath}/Versions/${branch}
120
121    foreach dir { Headers Resources Python Versions/Current } {
122        file delete ${destroot}${framewpath}/${dir}
123    }
124
125    ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/
126
127    # Without this, LINKFORSHARED is set to
128    # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
129    # (this becomes Python.framework/Versions/3.2/Python) which doesn't
130    # quite work (see ticket #15099); instead specifically list the
131    # full path to the proper Python framework file (which becomes
132    # ${prefix}/Library/Frameworks/Python.framework/Versions/3.2/Python)
133    reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/$confdir/Makefile
134
135    # remove -arch flags from the config
136    reinplace -E {s|-arch [a-z0-9_]+||g} \
137      ${destroot}${framewdir}/lib/python${branch}/$confdir/Makefile
138    foreach unversioned {2to3 idle3 pydoc3 python3 python3-config pyvenv} {
139        delete ${destroot}${prefix}/bin/${unversioned}
140    }
141}
142
143platform darwin {
144    post-configure {
145        # See http://trac.macports.org/ticket/18376
146        system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
147    }
148}
149
150variant readline description {Use readline instead of libedit} {
151    patchfiles-delete       patch-libedit.diff
152    depends_lib-append      port:readline
153    depends_lib-delete      port:libedit
154}
155
156variant universal {
157    post-patch {
158        set universal_arch_flags {}
159        set arch_run_32bit {}
160        foreach arch ${universal_archs} {
161            lappend universal_arch_flags -arch ${arch}
162            if {${arch} eq "i386" || ${arch} eq "ppc"} {
163                lappend arch_run_32bit -${arch}
164            }
165        }
166        reinplace \
167          "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
168          ${worksrcpath}/configure
169        if { ${arch_run_32bit} != "" } {
170            reinplace \
171              "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
172              ${worksrcpath}/configure
173        }
174    }
175    if {${configure.sdkroot} != ""} {
176        configure.args-append   --enable-universalsdk=${configure.sdkroot}
177    } else {
178        configure.args-append   --enable-universalsdk=/
179    }
180    post-configure {
181        system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed"
182    }
183
184    post-destroot {
185        foreach unversioned {python3-32} {
186            delete ${destroot}${prefix}/bin/${unversioned}
187        }
188    }
189}
190
191livecheck.type      regex
192#livecheck.url       ${homepage}download/releases/
193livecheck.url       ${homepage}downloads/
194livecheck.regex     Python (${branch}(?:\\.\\d+)*)
Note: See TracBrowser for help on using the repository browser.