source: trunk/dports/lang/python27/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
RevLine 
[74256]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
[64712]2# $Id: Portfile 153800 2016-10-11 19:38:22Z ryandesign@macports.org $
[63720]3
[74256]4PortSystem          1.0
5PortGroup           select 1.0
[63720]6
[74256]7name                python27
[74691]8epoch               2
[88868]9# Remember to keep py27-tkinter and py27-gdbm's versions sync'd with this
[149626]10version             2.7.12
[153800]11revision            2
[79563]12
[74256]13set major           [lindex [split $version .] 0]
14set branch          [join [lrange [split ${version} .] 0 1] .]
15categories          lang
[80499]16license             PSF
[74256]17platforms           darwin
[68602]18
[74256]19maintainers         jwa openmaintainer
[63720]20
[74256]21description         An interpreted, object-oriented programming language
22long_description    Python is an interpreted, interactive, object-oriented \
23                    programming language.
[63720]24
[74256]25homepage            http://www.python.org/
[91931]26master_sites        ${homepage}ftp/python/${version}/
[63720]27
[74256]28distname            Python-${version}
[151019]29use_xz              yes
[63720]30
[149626]31checksums           rmd160  c330f6ac08ed67f307de0e726a288bab16c832d5 \
32                    sha256  d7837121dd5652a05fef807c361909d255d173280c4e1a4ded94d73d80a1f978
[63720]33
[74256]34patchfiles          patch-Makefile.pre.in.diff \
35                    patch-setup.py.diff \
[88868]36                    patch-setup.py-disabled_modules.diff \
[74256]37                    patch-Lib-cgi.py.diff \
[78591]38                    patch-Lib-ctypes-macholib-dyld.py.diff \
[86868]39                    patch-configure.diff \
[149730]40                    patch-libedit.diff \
[126840]41                    patch-Include-pyport.h.diff \
[152947]42                    omit-local-site-packages.patch \
[153800]43                    improve-QuickTime.h-check.patch \
44                    enable-loadable-sqlite-extensions.patch
[63720]45
[74256]46depends_lib         port:gettext \
47                    port:zlib \
[139229]48                    path:lib/libssl.dylib:openssl \
[74256]49                    port:sqlite3 \
[126081]50                    port:db48 \
[74256]51                    port:ncurses \
52                    port:bzip2 \
[149730]53                    port:libedit
[136743]54depends_run         port:python_select \
55                    port:python2_select
[63720]56
[113224]57# disable-ipv6 for now, getaddrinfo-function missing
[74256]58configure.args      --enable-framework=${frameworks_dir} \
59                    --enable-ipv6
[63720]60
[126081]61configure.cppflags-append -I${prefix}/include/db48
62configure.ldflags-append -L${prefix}/lib/db48
[106224]63
[74256]64configure.ccache    no
[63720]65
[87442]66# signed integer overflow is normally undefined as per the C spec, but python
67# needs it to be defined as twos-complement
68configure.cflags-append -fwrapv
69
[63720]70post-patch {
[74256]71    reinplace "s|@@PREFIX@@|${prefix}|g" \
72        ${worksrcpath}/Lib/cgi.py \
73        ${worksrcpath}/Lib/ctypes/macholib/dyld.py
[78591]74    reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" \
75        ${worksrcpath}/configure
[63720]76
[106224]77    # See https://trac.macports.org/changeset/37861
[74256]78    reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
79        ${worksrcpath}/Mac/PythonLauncher/Makefile.in
[63720]80}
81
[113224]82post-configure {
83    reinplace "s;/* #undef PY_FORMAT_LONG_LONG */;#define PY_FORMAT_LONG_LONG \"ll\";" pyconfig.h
84}
85
[74256]86build.target        all
[63720]87
[74256]88test.run            yes
89test.target         test
[63720]90
[74256]91destroot.target     frameworkinstall maninstall
[63720]92
93# ensure that correct compiler is used
[74256]94build.args-append   MAKE="${build.cmd} CC=${configure.cc}"
95destroot.args-append MAKE="${destroot.cmd} CC=${configure.cc}"
[63720]96
[136743]97set pythonNoDot python[string map {. {}} $branch]
98select.entries      [list python python-$pythonNoDot $pythonNoDot] \
99                    [list python2 python2-$pythonNoDot $pythonNoDot]
[63720]100
[91638]101notes "
[136743]102To make this the default Python or Python 2 (i.e., the version run by\
103the 'python' or 'python2' commands), run one or both of:
[78591]104
[136743]105    sudo port select --set python $pythonNoDot
106    sudo port select --set python2 $pythonNoDot
[148368]107
108##############################################################
109# IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
110#   py[string map {. {}} $branch]-readline
111# TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
112# REF: https://trac.macports.org/ticket/48807
113##############################################################
[91638]114"
115
[63720]116post-destroot {
[74256]117    set framewpath ${frameworks_dir}/Python.framework
118    set framewdir  ${framewpath}/Versions/${branch}
[63720]119
[74256]120    foreach dir { Headers Resources Python Versions/Current } {
121        file delete ${destroot}${framewpath}/${dir}
122    }
[63720]123
[78352]124    ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/
[74256]125    ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
[63720]126
[106224]127    foreach unversionedFile {2to3 2to3-2 idle idle2 pydoc pydoc2 python python2 python-config python2-config pythonw pythonw2 smtpd.py smtpd2.py} {
[74256]128        delete ${destroot}${prefix}/bin/${unversionedFile}
129    }
[68551]130
[74256]131    # remove -arch flags from the config
[78352]132    reinplace -E {s|-arch [a-z0-9_]+||g} \
[108762]133        ${destroot}${framewdir}/lib/python${branch}/config/Makefile \
134        ${destroot}${framewdir}/lib/python${branch}/_sysconfigdata.py
[63720]135}
136
137platform darwin {
[76830]138    post-patch {
[151019]139        if {![file exists /usr/lib/libSystemStubs.a]} {
140            reinplace s/-lSystemStubs//g ${worksrcpath}/configure
141        }
[76830]142    }
[63720]143}
144
[140531]145variant readline description {Use readline instead of libedit} {
[149730]146    patchfiles-delete       patch-libedit.diff
147    depends_lib-append      port:readline
[140531]148    depends_lib-delete      port:libedit
149}
150
[63720]151variant universal {
[108762]152    # This patch will need updating when 2.7.6 is released, as ARCH_RUN_32BIT
153    # will once again be used for something. See ticket #39270.
[106224]154    patchfiles-append patch-configure-universal.diff
[74256]155    post-patch {
156        reinplace \
[106224]157            "s|__UNIVERSAL_ARCHFLAGS__|${configure.universal_cflags}|" \
[63720]158            ${worksrcpath}/configure
[74256]159    }
160    if {${configure.sdkroot} != ""} {
161        configure.args-append   --enable-universalsdk=${configure.sdkroot}
162    } else {
163        configure.args-append   --enable-universalsdk=/
164    }
[63720]165}
166
167variant ucs4 description {Enable support for UCS4} {
[74256]168    configure.args-append   --enable-unicode=ucs4
[63720]169}
170
171livecheck.type          regex
[121648]172#livecheck.url           ${homepage}download/releases/
173livecheck.url           ${homepage}downloads/
[117237]174livecheck.regex         Python (${branch}(?:\\.\\d+)*)
Note: See TracBrowser for help on using the repository browser.