source: trunk/dports/lang/python33/Portfile

Last change on this file was 153800, checked in by larryv@…, 12 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.0 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                python33
8
9# Remember to keep py33-tkinter and py33-gdbm's versions sync'd with this
10version             3.3.6
11revision            7
12
13epoch               20141012
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/
27#master_sites        ${homepage}ftp/python/${version}/
28master_sites        ${homepage}ftp/python/${version}/
29
30distname            Python-${version}
31
32use_xz              yes
33
34checksums           rmd160  e45909eedf3648408ef8b34775ab24654181d9bd \
35                    sha256  5226e4bf7a530c3ff2bcde0c94e0e09e59a8bcde0114fe0268bc925bdabb5d3f
36
37patchfiles          patch-setup.py.diff \
38                    patch-Lib-cgi.py.diff \
39                    patch-Lib-distutils-dist.py.diff \
40                    patch-configure.diff \
41                    patch-setup.py-disabled_modules.diff \
42                    patch-libedit.diff \
43                    omit-local-site-packages.patch
44
45# http://bugs.python.org/issue21811
46patchfiles-append   yosemite-configure-fixes.patch \
47                    yosemite-python-fixes.patch
48
49depends_lib         port:zlib path:lib/libssl.dylib:openssl \
50                    port:sqlite3 port:ncurses \
51                    port:bzip2 port:libedit port:gettext \
52                    port:xz
53depends_run         port:python_select \
54                    port:python3_select
55
56# blacklist llvm-gcc-4.2 compiler known to produce bad code
57compiler.blacklist  *llvm-gcc-4.2
58
59configure.args      --enable-framework=${frameworks_dir} \
60                    --enable-ipv6 \
61                    --enable-loadable-sqlite-extensions \
62                    --with-computed-gotos
63configure.ccache    no
64
65use_parallel_build  yes
66
67post-patch {
68    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Lib/cgi.py
69
70    reinplace "s|/setup.py|/setup.py --no-user-cfg|" ${worksrcpath}/Makefile.pre.in
71
72    # replace /Applications with ${applications_dir}
73    reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" \
74      ${worksrcpath}/configure
75
76    # See http://trac.macports.org/changeset/37861
77    reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
78      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
79}
80
81build.target        all
82
83# test_cmd_line fails
84# see http://bugs.python.org/issue4388 and
85#     http://bugs.python.org/issue4474
86test.run            yes
87test.target         test
88
89destroot.target     frameworkinstall maninstall
90
91# ensure that correct compiler is used
92build.args-append   MAKE="${build.cmd} CC=${configure.cc}"
93destroot.args-append    MAKE="${destroot.cmd} CC=${configure.cc}"
94
95set pythonNoDot python[string map {. {}} $branch]
96select.entries      [list python python-$pythonNoDot $pythonNoDot] \
97                    [list python3 python3-$pythonNoDot $pythonNoDot]
98
99set confdir config-${branch}m
100
101notes "
102To make this the default Python or Python 3 (i.e., the version run by\
103the 'python' or 'python3' commands), run one or both of:
104
105    sudo port select --set python $pythonNoDot
106    sudo port select --set python3 $pythonNoDot
107"
108
109post-destroot {
110    set framewpath ${frameworks_dir}/Python.framework
111    set framewdir  ${framewpath}/Versions/${branch}
112
113    foreach dir { Headers Resources Python Versions/Current } {
114        file delete ${destroot}${framewpath}/${dir}
115    }
116
117    ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/
118
119    # Without this, LINKFORSHARED is set to
120    # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
121    # (this becomes Python.framework/Versions/3.2/Python) which doesn't
122    # quite work (see ticket #15099); instead specifically list the
123    # full path to the proper Python framework file (which becomes
124    # ${prefix}/Library/Frameworks/Python.framework/Versions/3.2/Python)
125    reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/$confdir/Makefile
126
127    # remove -arch flags from the config
128    reinplace -E {s|-arch [a-z0-9_]+||g} \
129      ${destroot}${framewdir}/lib/python${branch}/$confdir/Makefile
130}
131
132platform darwin {
133    post-configure {
134        # See http://trac.macports.org/ticket/18376
135        system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
136    }
137}
138
139variant universal {
140    post-patch {
141        set universal_arch_flags {}
142        set arch_run_32bit {}
143        foreach arch ${universal_archs} {
144            lappend universal_arch_flags -arch ${arch}
145            if {${arch} eq "i386" || ${arch} eq "ppc"} {
146                lappend arch_run_32bit -${arch}
147            }
148        }
149        reinplace \
150          "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
151         ${worksrcpath}/configure
152        if { ${arch_run_32bit} != "" } {
153            reinplace \
154              "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
155            ${worksrcpath}/configure
156        }
157    }
158    if {${configure.sdkroot} != ""} {
159        configure.args-append   --enable-universalsdk=${configure.sdkroot}
160    } else {
161        configure.args-append   --enable-universalsdk=/
162    }
163    post-configure {
164        system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed"
165    }
166
167    post-destroot {
168        foreach unversioned {python3-32} {
169            delete ${destroot}${prefix}/bin/${unversioned}
170        }
171    }
172}
173
174livecheck.type      regex
175#livecheck.url       ${homepage}download/releases/
176livecheck.url       ${homepage}downloads/
177livecheck.regex     Python (${branch}(?:\\.\\d+)*)
Note: See TracBrowser for help on using the repository browser.