source: trunk/dports/lang/python26/Portfile

Last change on this file was 148368, checked in by eborisch@…, 19 months ago

python(26|27|34|35): Add a reference to libedit+python issues to notes and suggest installing pyNN-readline. See #48807.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.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 148368 2016-05-05 17:13:02Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6
7name                    python26
8# Remember to keep py26-tkinter and py26-gdbm's versions sync'd with this
9version                 2.6.9
10revision                4
11set major               [lindex [split $version .] 0]
12set branch              [join [lrange [split ${version} .] 0 1] .]
13categories              lang
14license                 PSF
15platforms               darwin
16maintainers             nomaintainer
17
18description             An interpreted, object-oriented programming language
19long_description        Python is an interpreted, interactive, object-oriented \
20                        programming language.
21
22homepage                http://www.python.org/
23master_sites            ${homepage}ftp/python/${version}/
24
25distname                Python-${version}
26use_xz                  yes
27
28checksums               md5    933a811f11e3db3d73ae492f6c3a7a76 \
29                        rmd160 42edf7c9f2f64b77ab173de30ea453257c2c06b3 \
30                        sha256 cae7bb995006ea5b703d9d28446f694894c441fe4bfb95d561c0ac908cd06e41
31
32# patch-Lib-distutils-dist.py.diff comes from
33# <http://bugs.python.org/issue1180>
34# Setting PYTHONHOME with patch-Mac-IDLE-Makefile.in.diff,
35# patch-Mac-Makefile.in.diff, and patch-Mac-PythonLauncher-Makefile.in.diff
36# is to work around http://bugs.python.org/issue5766
37patchfiles              patch-Makefile.pre.in.diff \
38                        patch-setup.py.diff \
39                        patch-Lib-cgi.py.diff \
40                        patch-Lib-distutils-dist.py.diff \
41                        patch-Mac-IDLE-Makefile.in.diff \
42                        patch-Mac-Makefile.in.diff \
43                        patch-Mac-PythonLauncher-Makefile.in.diff \
44                        patch-Mac-Tools-Doc-setup.py.diff \
45                        patch-setup.py-db46.diff \
46                        patch-Lib-ctypes-macholib-dyld.py.diff \
47                        patch-setup.py-disabled_modules.diff \
48                        patch-libedit.diff
49
50# http://bugs.python.org/issue21811
51patchfiles-append       yosemite-configure-fixes.patch \
52                        yosemite-python-fixes.patch
53
54depends_lib             port:gettext port:zlib path:lib/libssl.dylib:openssl \
55                        port:sqlite3 port:db46 port:ncurses \
56                        port:bzip2 port:libedit
57depends_run             port:python_select \
58                        port:python2_select
59
60configure.args          --enable-framework=${frameworks_dir} \
61                        --enable-ipv6
62configure.ccache        no
63
64# signed integer overflow is normally undefined as per the C spec, but python
65# needs it to be defined as twos-complement
66configure.cflags-append -fwrapv
67
68post-patch {
69   reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
70      ${worksrcpath}/Lib/ctypes/macholib/dyld.py
71   reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|g" \
72      ${worksrcpath}/Mac/Makefile.in ${worksrcpath}/Mac/IDLE/Makefile.in \
73      ${worksrcpath}/Mac/Tools/Doc/setup.py \
74      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
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   # http://trac.macports.org/ticket/21517
81   system -W ${worksrcpath} "ed - Modules/_localemodule.c < ${filespath}/_localemodule.c.ed"
82   system -W ${worksrcpath} "ed - Lib/locale.py < ${filespath}/locale.py.ed"
83
84   if {${os.platform} eq "darwin" && ${os.major} > 9} {
85      # http://trac.macports.org/ticket/21559
86      system -W ${worksrcpath} "ed - Modules/posixmodule.c < ${filespath}/posixmodule.c.ed"
87   }
88}
89
90build.target            all
91
92test.run                yes
93test.target             test
94
95destroot.target         frameworkinstall maninstall
96
97# ensure that correct compiler is used
98build.args-append       MAKE="${build.cmd} CC=${configure.cc}"
99destroot.args-append    MAKE="${destroot.cmd} CC=${configure.cc}"
100
101set pythonNoDot python[string map {. {}} $branch]
102select.entries          [list python python-$pythonNoDot $pythonNoDot] \
103                        [list python2 python2-$pythonNoDot $pythonNoDot]
104
105notes "
106To make this the default Python or Python 2 (i.e., the version run by\
107the 'python' or 'python2' commands), run one or both of:
108
109    sudo port select --set python $pythonNoDot
110    sudo port select --set python2 $pythonNoDot
111
112##############################################################
113# IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
114#   py[string map {. {}} $branch]-readline
115# TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
116# REF: https://trac.macports.org/ticket/48807
117##############################################################
118"
119
120post-destroot {
121   set framewpath ${frameworks_dir}/Python.framework
122   set framewdir  ${framewpath}/Versions/${branch}
123
124   foreach dir { Headers Resources Python Versions/Current } {
125      file delete ${destroot}${framewpath}/${dir}
126   }
127
128   ln -s ${framewdir}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
129   ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
130   ln -s ${framewdir}/bin/2to3 ${destroot}${prefix}/bin/2to3-${branch}
131
132   # Without this, LINKFORSHARED is set to
133   # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
134   # (this becomes Python.framework/Versions/2.6/Python) which doesn't
135   # quite work (see ticket #15099); instead specifically list the
136   # full path to the proper Python framework file (which becomes
137   # ${prefix}/Library/Frameworks/Python.framework/Versions/2.6/Python)
138   reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
139
140   foreach unversionedFile {idle pydoc python python-config pythonw smtpd.py} {
141      delete ${destroot}${prefix}/bin/${unversionedFile}
142   }
143   
144   # remove -arch flags from the config
145   reinplace -E {s|-arch [a-z0-9_]+||g} \
146      ${destroot}${framewdir}/lib/python${branch}/config/Makefile
147}
148
149platform darwin {
150   post-configure {
151      # See http://trac.macports.org/ticket/18376
152      system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
153   }
154   post-patch {
155                if {![file exists /usr/lib/libSystemStubs.a]} {
156                        reinplace s/-lSystemStubs//g ${worksrcpath}/configure
157                }
158   }
159}
160
161variant readline description {Use readline instead of libedit} {
162    patchfiles-delete       patch-libedit.diff
163    depends_lib-append      port:readline
164    depends_lib-delete      port:libedit
165}
166
167variant universal {
168   post-patch {
169      set universal_arch_flags {}
170      set arch_run_32bit {}
171      foreach arch ${universal_archs} {
172         lappend universal_arch_flags -arch ${arch}
173         if {${arch} eq "i386" || ${arch} eq "ppc"} {
174            lappend arch_run_32bit -${arch}
175         }
176      }
177      reinplace \
178         "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
179         ${worksrcpath}/configure
180      if {${os.major} >= 9} {
181         reinplace \
182            "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
183            ${worksrcpath}/configure
184      }
185   }
186   if {${configure.sdkroot} != ""} {
187      configure.args-append   --enable-universalsdk=${configure.sdkroot}
188   } else {
189      configure.args-append   --enable-universalsdk=/
190   }
191   post-configure {
192      system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed"
193   }
194}
195
196variant ucs4 description {Enable support for UCS4} {
197   configure.args-append   --enable-unicode=ucs4
198}
199
200livecheck.type          regex
201livecheck.url           ${homepage}download/releases/
202livecheck.regex         Python (${branch}(?:\\.\\d+)*)
Note: See TracBrowser for help on using the repository browser.