source: trunk/dports/lang/python31/Portfile

Last change on this file was 150873, checked in by ionic@…, 14 months ago

python31: backport patch from #44288. Part of #51939.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.2 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 150873 2016-08-01 06:43:57Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6
7name                    python31
8epoch                   1
9# Remember to keep py31-tkinter and py31-gdbm's versions sync'd with this
10version                 3.1.5
11revision                5
12set major               [lindex [split $version .] 0]
13set branch              [join [lrange [split ${version} .] 0 1] .]
14categories              lang
15license                 PSF
16platforms               darwin
17maintainers             nomaintainer
18
19description             An interpreted, object-oriented programming language
20long_description        Python is an interpreted, interactive, object-oriented \
21                        programming language.
22
23homepage                http://www.python.org/
24master_sites            ${homepage}ftp/python/${version}/
25
26distname                Python-${version}
27use_xz                  yes
28
29checksums               md5    20dd2b7f801dc97db948dd168df4dd52 \
30                        rmd160 021362658310f9ea5f6825bf0919f160304f4833 \
31                        sha256 035c4370354d901924ce0fd8df65c5452839f590ec1b9c17fae2ada3e5f3b4d7
32
33patchfiles              patch-setup.py.diff \
34                        patch-Lib-cgi.py.diff \
35                        patch-Lib-distutils-dist.py.diff \
36                        patch-setup.py-disabled_modules.diff \
37                        patch-libedit.diff \
38                        patch-Lib-site.py-omit_local_site_packages.diff \
39                        patch-Include-pyport.h.diff
40
41# http://bugs.python.org/issue21811
42patchfiles-append       patch-configure_configure.ac-yosemite_configure_fixes.diff \
43                        patch-Lib-distutils-util.py_Mac-BuildScript-build-installer.py-yosemite_python_fixes.diff
44
45depends_lib             port:zlib path:lib/libssl.dylib:openssl \
46                        port:sqlite3 port:ncurses \
47                        port:bzip2 port:libedit port:gettext
48depends_run             port:python_select
49
50configure.args          --enable-framework=${frameworks_dir} \
51                        --enable-ipv6 \
52                        --with-computed-gotos
53configure.ccache        no
54
55use_parallel_build      yes
56
57post-patch {
58   reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Lib/cgi.py
59
60   reinplace "s|/setup.py|/setup.py --no-user-cfg|" ${worksrcpath}/Makefile.pre.in
61
62   # replace /Applications/ with ${applications_dir}/
63   reinplace "s|\\(\[^a-zA-Z0-9\]\\)/Applications/|\\1${applications_dir}/|" \
64      ${worksrcpath}/Mac/Makefile.in \
65      ${worksrcpath}/Mac/Tools/Doc/setup.py \
66      ${worksrcpath}/Mac/PythonLauncher/Makefile.in \
67      ${worksrcpath}/Mac/BuildScript/build-installer.py
68
69   reinplace "s|#!/Library/Frameworks|#!${frameworks_dir}|" \
70      ${worksrcpath}/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE
71
72   # See http://trac.macports.org/changeset/37861
73   reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
74      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
75}
76
77build.target            all
78
79# test_cmd_line fails
80# see http://bugs.python.org/issue4388 and
81#     http://bugs.python.org/issue4474
82test.run                yes
83test.target             test
84
85destroot.target         frameworkinstall maninstall
86
87# ensure that correct compiler is used
88build.args-append       MAKE="${build.cmd} CC=${configure.cc}"
89destroot.args-append    MAKE="${destroot.cmd} CC=${configure.cc}"
90
91select.group            python
92select.file             ${filespath}/python[string map {. {}} ${branch}]
93
94notes "
95To make python ${branch} the default (i.e. the version you get when you run\
96'python'), please run:
97
98sudo port select --set ${select.group} [file tail ${select.file}]
99"
100
101post-destroot {
102   set framewpath ${frameworks_dir}/Python.framework
103   set framewdir  ${framewpath}/Versions/${branch}
104
105   foreach dir { Headers Resources Python Versions/Current } {
106      file delete ${destroot}${framewpath}/${dir}
107   }
108
109   ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/
110
111   # Without this, LINKFORSHARED is set to
112   # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
113   # (this becomes Python.framework/Versions/3.1/Python) which doesn't
114   # quite work (see ticket #15099); instead specifically list the
115   # full path to the proper Python framework file (which becomes
116   # ${prefix}/Library/Frameworks/Python.framework/Versions/3.1/Python)
117   reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
118
119   # remove -arch flags from the config
120   reinplace -E {s|-arch [a-z0-9_]+||g} \
121      ${destroot}${framewdir}/lib/python${branch}/config/Makefile
122}
123
124platform darwin {
125   post-configure {
126      # See http://trac.macports.org/ticket/18376
127      system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
128   }
129   post-patch {
130                if {![file exists /usr/lib/libSystemStubs.a]} {
131                        reinplace s/-lSystemStubs//g ${worksrcpath}/configure
132                }
133   }
134}
135
136variant universal {
137   post-patch {
138      set universal_arch_flags {}
139      set arch_run_32bit {}
140      foreach arch ${universal_archs} {
141         lappend universal_arch_flags -arch ${arch}
142         if {${arch} eq "i386" || ${arch} eq "ppc"} {
143            lappend arch_run_32bit -${arch}
144         }
145      }
146      reinplace \
147         "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
148         ${worksrcpath}/configure
149      if { ${arch_run_32bit} != "" } {
150         reinplace \
151            "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
152            ${worksrcpath}/configure
153      }
154   }
155   if {${configure.sdkroot} != ""} {
156      configure.args-append   --enable-universalsdk=${configure.sdkroot}
157   } else {
158      configure.args-append   --enable-universalsdk=/
159   }
160   post-configure {
161      system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.h-universal.ed"
162   }
163}
164
165variant ucs4 description {Use 4-byte Unicode characters} {
166   configure.args-append   --with-wide-unicode
167}
168
169livecheck.type          regex
170livecheck.url           ${homepage}download/releases/
171livecheck.regex         Python (${branch}(?:\\.\\d+)*)
Note: See TracBrowser for help on using the repository browser.