source: trunk/dports/lang/python32/Portfile @ 126840

Last change on this file since 126840 was 126840, checked in by larryv@…, 5 years ago

python{27,3*}: Ignore local site-packages (#34763)

Beginning with 2.7, framework builds of CPython automatically add the
local site-packages directory (e.g., /Library/Python/2.7) to sys.path
(http://bugs.python.org/issue4865). Python 3.1 also adds user-local
site-packages (~/Library/Python/3.1). These behaviors conflict with
MacPorts' general policy of isolationism towards the host system.

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