2010-12-09 11:07:12 +00:00
|
|
|
# -*- 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
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
PortSystem 1.0
|
|
|
|
|
PortGroup select 1.0
|
2019-08-23 20:38:59 +10:00
|
|
|
PortGroup clang_dependency 1.0
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
name python27
|
2010-12-29 19:10:13 +00:00
|
|
|
epoch 2
|
2012-01-14 00:55:49 +00:00
|
|
|
# Remember to keep py27-tkinter and py27-gdbm's versions sync'd with this
|
2020-04-21 13:18:02 -07:00
|
|
|
version 2.7.18
|
2022-05-10 22:32:47 +10:00
|
|
|
revision 10
|
2011-06-18 09:40:50 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
set major [lindex [split $version .] 0]
|
|
|
|
|
set branch [join [lrange [split ${version} .] 0 1] .]
|
|
|
|
|
categories lang
|
2011-07-13 18:41:10 +00:00
|
|
|
license PSF
|
2010-06-07 18:08:23 +00:00
|
|
|
|
2017-09-08 07:35:09 +10:00
|
|
|
maintainers {jmr @jmroot} openmaintainer
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
description An interpreted, object-oriented programming language
|
|
|
|
|
long_description Python is an interpreted, interactive, object-oriented \
|
|
|
|
|
programming language.
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2017-09-22 10:01:27 +10:00
|
|
|
homepage https://www.python.org/
|
2012-04-13 09:28:40 +00:00
|
|
|
master_sites ${homepage}ftp/python/${version}/
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
distname Python-${version}
|
2022-03-02 16:32:12 +11:00
|
|
|
if {$subport eq $name} {
|
2016-08-05 16:17:41 +00:00
|
|
|
use_xz yes
|
2022-03-02 16:32:12 +11:00
|
|
|
}
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2020-04-21 13:18:02 -07:00
|
|
|
checksums md5 fd6cc8ec0a78c44036f825e739f36e5a \
|
|
|
|
|
rmd160 40a514bb05c9e631454ea8466e28f5bb229428ad \
|
|
|
|
|
sha256 b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43 \
|
|
|
|
|
size 12854736
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
patchfiles patch-Makefile.pre.in.diff \
|
|
|
|
|
patch-setup.py.diff \
|
|
|
|
|
patch-Lib-cgi.py.diff \
|
2011-05-13 16:57:49 +00:00
|
|
|
patch-Lib-ctypes-macholib-dyld.py.diff \
|
2011-11-06 02:47:59 +00:00
|
|
|
patch-configure.diff \
|
2016-06-29 19:36:59 +00:00
|
|
|
patch-libedit.diff \
|
2019-04-02 01:41:00 +11:00
|
|
|
enable-loadable-sqlite-extensions.patch \
|
2020-06-29 23:42:33 +10:00
|
|
|
patch-_osx_support.py.diff \
|
2020-09-21 07:41:33 +10:00
|
|
|
darwin20.diff \
|
2021-03-04 14:54:08 +11:00
|
|
|
arm.patch \
|
2021-11-08 09:11:25 +11:00
|
|
|
implicit.patch \
|
2023-09-16 00:42:26 +10:00
|
|
|
openssl_ver.patch \
|
|
|
|
|
libedit-types.patch
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2022-01-07 19:34:47 +01:00
|
|
|
if {${os.platform} eq "darwin" && ${os.major} >= 21} {
|
|
|
|
|
patchfiles-append patch-getpath.diff
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-18 15:46:37 +01:00
|
|
|
if {${subport} eq ${name}} {
|
|
|
|
|
PortGroup openssl 1.0
|
|
|
|
|
|
2024-09-07 16:51:25 +10:00
|
|
|
depends_build path:bin/pkg-config:pkgconfig
|
2022-02-18 15:46:37 +01:00
|
|
|
depends_lib port:bzip2 \
|
2017-09-22 09:18:04 +10:00
|
|
|
port:db48 \
|
|
|
|
|
port:expat \
|
2021-12-26 18:08:36 +11:00
|
|
|
port:gettext-runtime \
|
2017-09-22 09:18:04 +10:00
|
|
|
port:libedit \
|
|
|
|
|
port:libffi \
|
|
|
|
|
port:ncurses \
|
2010-12-09 11:07:12 +00:00
|
|
|
port:sqlite3 \
|
2017-09-22 09:18:04 +10:00
|
|
|
port:zlib
|
2022-02-18 15:46:37 +01:00
|
|
|
depends_run port:python_select \
|
2015-05-25 20:01:23 +00:00
|
|
|
port:python2_select
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2022-02-18 15:46:37 +01:00
|
|
|
|
|
|
|
|
openssl.branch 1.1
|
|
|
|
|
}
|
2021-11-09 12:28:21 +11:00
|
|
|
|
2019-08-28 17:54:00 +10:00
|
|
|
# This port is used by clang-3.4 to bootstrap libcxx
|
|
|
|
|
subport ${name}-bootstrap {
|
2026-04-04 14:04:57 +11:00
|
|
|
if {[vercmp [macports_version] >= 2.12.99]} {
|
|
|
|
|
extract.add_deps no
|
|
|
|
|
}
|
2022-02-18 15:46:37 +01:00
|
|
|
depends_extract port:xz-bootstrap
|
|
|
|
|
depends_skip_archcheck-append \
|
|
|
|
|
xz-bootstrap
|
|
|
|
|
extract.suffix .tar.xz
|
|
|
|
|
extract.cmd ${prefix}/libexec/xz-bootstrap/bin/xz
|
|
|
|
|
|
|
|
|
|
prefix ${prefix}/libexec/${subport}
|
2020-04-22 12:35:36 +10:00
|
|
|
set frameworks_dir ${prefix}/Library/Frameworks
|
|
|
|
|
set applications_dir ${prefix}/Applications
|
2022-02-18 15:46:37 +01:00
|
|
|
|
|
|
|
|
patchfiles-delete patch-libedit.diff
|
|
|
|
|
|
|
|
|
|
# Avoid macports-clang dep (doesn't use C++ anyway)
|
2019-08-28 17:54:00 +10:00
|
|
|
configure.cxx_stdlib
|
|
|
|
|
compiler.whitelist clang llvm-gcc-4.2 gcc-4.2 apple-gcc-4.2
|
2022-02-18 15:46:37 +01:00
|
|
|
|
|
|
|
|
# sterilize MacPorts build environment; we want nothing picked up from MP prefix
|
|
|
|
|
compiler.cpath
|
|
|
|
|
compiler.library_path
|
|
|
|
|
|
|
|
|
|
configure.distcc no
|
|
|
|
|
|
|
|
|
|
# sterilize PATH
|
|
|
|
|
configure.env-append PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
|
|
|
|
build.env-append PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
2019-08-28 17:54:00 +10:00
|
|
|
}
|
|
|
|
|
# Also needed by later clangs.
|
|
|
|
|
if {${os.platform} eq "darwin" && ${os.major} < 11 && ${cxx_stdlib} eq "libc++"} {
|
|
|
|
|
clang_dependency.extra_versions 3.7
|
2019-08-16 02:15:34 +10:00
|
|
|
}
|
|
|
|
|
|
2020-05-12 00:43:07 -05:00
|
|
|
configure.args-append \
|
|
|
|
|
--enable-framework=${frameworks_dir} \
|
2022-12-11 17:45:42 -08:00
|
|
|
--enable-ipv6
|
2025-07-23 17:43:19 +10:00
|
|
|
if {${subport} eq ${name} || ${os.platform} eq "darwin"} {
|
|
|
|
|
# Non-darwin may not have a system libexpat or libffi, so we can't use them for the bootstrap port
|
2022-12-11 17:45:42 -08:00
|
|
|
configure.args-append \
|
2017-09-22 09:18:04 +10:00
|
|
|
--with-system-expat \
|
|
|
|
|
--with-system-ffi
|
2022-12-11 17:45:42 -08:00
|
|
|
}
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2022-02-18 15:46:37 +01:00
|
|
|
if {${subport} eq ${name}} {
|
|
|
|
|
configure.cppflags-append -I${prefix}/include/db48
|
|
|
|
|
configure.ldflags-append -L${prefix}/lib/db48
|
2022-03-02 16:35:52 +11:00
|
|
|
|
|
|
|
|
# pkg-config removes -I flags for paths in CPATH, which confuses python.
|
|
|
|
|
configure.env-append PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
|
2022-02-18 15:46:37 +01:00
|
|
|
}
|
2013-05-19 20:30:53 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
configure.ccache no
|
2010-02-13 18:54:59 +00:00
|
|
|
|
|
|
|
|
post-patch {
|
2020-04-22 12:35:36 +10:00
|
|
|
reinplace "s|@@PREFIX@@|${prefix}|g" \
|
2010-12-09 11:07:12 +00:00
|
|
|
${worksrcpath}/Lib/cgi.py \
|
|
|
|
|
${worksrcpath}/Lib/ctypes/macholib/dyld.py
|
2020-04-22 12:35:36 +10:00
|
|
|
reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" \
|
2011-05-13 16:57:49 +00:00
|
|
|
${worksrcpath}/configure
|
2010-02-13 18:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
2013-11-12 20:57:39 +00:00
|
|
|
post-configure {
|
2022-03-13 21:20:19 +11:00
|
|
|
set oldmtime [file mtime ${worksrcpath}/pyconfig.h]
|
2019-10-07 15:23:44 +11:00
|
|
|
reinplace "s;/* #undef PY_FORMAT_LONG_LONG */;#define PY_FORMAT_LONG_LONG \"ll\";" ${worksrcpath}/pyconfig.h
|
2022-03-13 21:20:19 +11:00
|
|
|
file mtime ${worksrcpath}/pyconfig.h $oldmtime
|
2013-11-12 20:57:39 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
build.target all
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
test.run yes
|
|
|
|
|
test.target test
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2010-12-09 11:07:12 +00:00
|
|
|
destroot.target frameworkinstall maninstall
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2019-10-07 15:23:44 +11:00
|
|
|
if {$subport eq $name} {
|
2015-05-25 20:01:23 +00:00
|
|
|
set pythonNoDot python[string map {. {}} $branch]
|
|
|
|
|
select.entries [list python python-$pythonNoDot $pythonNoDot] \
|
|
|
|
|
[list python2 python2-$pythonNoDot $pythonNoDot]
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2012-04-07 02:08:56 +00:00
|
|
|
notes "
|
2015-05-25 20:01:23 +00:00
|
|
|
To make this the default Python or Python 2 (i.e., the version run by\
|
|
|
|
|
the 'python' or 'python2' commands), run one or both of:
|
2012-04-07 02:08:56 +00:00
|
|
|
|
2015-05-25 20:01:23 +00:00
|
|
|
sudo port select --set python $pythonNoDot
|
|
|
|
|
sudo port select --set python2 $pythonNoDot
|
2012-04-07 02:08:56 +00:00
|
|
|
"
|
2019-10-07 15:23:44 +11:00
|
|
|
}
|
2011-05-13 16:57:49 +00:00
|
|
|
|
2018-05-02 10:10:58 +10:00
|
|
|
platform darwin {
|
2020-04-22 12:35:36 +10:00
|
|
|
set framewpath ${frameworks_dir}/Python.framework
|
2010-12-09 11:07:12 +00:00
|
|
|
set framewdir ${framewpath}/Versions/${branch}
|
2010-02-13 18:54:59 +00:00
|
|
|
|
2011-03-10 03:24:55 +00:00
|
|
|
post-patch {
|
2016-08-05 16:17:41 +00:00
|
|
|
if {![file exists /usr/lib/libSystemStubs.a]} {
|
|
|
|
|
reinplace s/-lSystemStubs//g ${worksrcpath}/configure
|
|
|
|
|
}
|
2011-03-10 03:24:55 +00:00
|
|
|
}
|
2018-05-02 10:10:58 +10:00
|
|
|
|
2020-04-22 12:38:44 +10:00
|
|
|
post-configure {
|
|
|
|
|
# poll() misbehaves on 10.8 and older
|
|
|
|
|
# See https://trac.macports.org/ticket/18376
|
|
|
|
|
if {${os.major} <= 12} {
|
2022-03-13 21:20:19 +11:00
|
|
|
set oldmtime [file mtime ${worksrcpath}/pyconfig.h]
|
2020-04-22 12:38:44 +10:00
|
|
|
system -W ${worksrcpath} "ed - pyconfig.h < ${filespath}/pyconfig.ed"
|
2022-03-13 21:20:19 +11:00
|
|
|
file mtime ${worksrcpath}/pyconfig.h $oldmtime
|
2020-04-22 12:38:44 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-02 10:10:58 +10:00
|
|
|
post-destroot {
|
|
|
|
|
foreach dir { Headers Resources Python Versions/Current } {
|
|
|
|
|
file delete ${destroot}${framewpath}/${dir}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-22 12:35:36 +10:00
|
|
|
ln -s ${framewdir}/share/man/man1/python${branch}.1 ${destroot}${prefix}/share/man/man1/
|
|
|
|
|
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
|
|
|
|
|
ln -s ${framewdir}/lib/pkgconfig/python-${branch}.pc ${destroot}${prefix}/lib/pkgconfig/
|
2018-05-02 10:10:58 +10:00
|
|
|
|
2022-05-10 22:32:47 +10:00
|
|
|
set libdir ${destroot}${framewdir}/lib/python${branch}
|
|
|
|
|
# change LINKFORSHARED to support dependents that incorrectly use it
|
|
|
|
|
system -W ${libdir} "awk -F : \
|
|
|
|
|
\"/'LINKFORSHARED'/ {printf \\\"%s: '-L${framewdir}/lib/python${branch}/config\
|
|
|
|
|
-lpython${branch} -ldl -framework CoreFoundation',\\n\\\", \\\$1; next} {print}\"\
|
|
|
|
|
_sysconfigdata.py > _sysconfigdata.py.new"
|
|
|
|
|
file rename -force ${libdir}/_sysconfigdata.py.new \
|
|
|
|
|
${libdir}/_sysconfigdata.py
|
|
|
|
|
|
|
|
|
|
# remove -arch flags from the config
|
|
|
|
|
reinplace -E {s|-arch [a-z0-9_]+||g} \
|
|
|
|
|
${libdir}/_sysconfigdata.py
|
|
|
|
|
|
|
|
|
|
# recompile the modified file
|
|
|
|
|
set python_for_build python.exe
|
|
|
|
|
# executable differs depending on filesystem case sensitivity
|
|
|
|
|
if {![file exists ${worksrcpath}/${python_for_build}]} {
|
|
|
|
|
set python_for_build python
|
|
|
|
|
}
|
|
|
|
|
system -W ${worksrcpath} "env DYLD_FRAMEWORK_PATH=. ./${python_for_build} -E -m compileall -d [shellescape ${framewdir}/lib/python${branch}] [shellescape ${libdir}/_sysconfigdata.py]"
|
|
|
|
|
system -W ${worksrcpath} "env DYLD_FRAMEWORK_PATH=. ./${python_for_build} -E -O -m compileall -d [shellescape ${framewdir}/lib/python${branch}] [shellescape ${libdir}/_sysconfigdata.py]"
|
|
|
|
|
|
2018-05-02 10:10:58 +10:00
|
|
|
# Without this, LINKFORSHARED is set to
|
|
|
|
|
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
|
|
|
|
|
# (this becomes Python.framework/Versions/2.7/Python) which doesn't
|
|
|
|
|
# quite work (see ticket #15099); instead we mirror the behavior of
|
|
|
|
|
# `python-config --ldflags` here.
|
|
|
|
|
reinplace {s|^\(LINKFORSHARED=\).*$|\1 -L$(LIBPL) -lpython$(VERSION) $(LIBS) $(SYSLIBS)|} \
|
2022-05-10 22:32:47 +10:00
|
|
|
${libdir}/config/Makefile
|
2018-05-02 10:10:58 +10:00
|
|
|
|
|
|
|
|
# remove -arch flags from the config
|
|
|
|
|
reinplace -E {s|-arch [a-z0-9_]+||g} \
|
2022-05-10 22:32:47 +10:00
|
|
|
${libdir}/config/Makefile
|
2018-05-02 10:10:58 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
post-destroot {
|
|
|
|
|
foreach unversionedFile {2to3 2to3-2 idle idle2 pydoc pydoc2 python python2 python-config python2-config pythonw pythonw2 smtpd.py smtpd2.py} {
|
2020-04-22 12:35:36 +10:00
|
|
|
delete ${destroot}${prefix}/bin/${unversionedFile}
|
2018-05-02 10:10:58 +10:00
|
|
|
}
|
2010-02-13 18:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
variant universal {
|
2013-05-19 20:30:53 +00:00
|
|
|
patchfiles-append patch-configure-universal.diff
|
2010-12-09 11:07:12 +00:00
|
|
|
post-patch {
|
|
|
|
|
reinplace \
|
2013-05-19 20:30:53 +00:00
|
|
|
"s|__UNIVERSAL_ARCHFLAGS__|${configure.universal_cflags}|" \
|
2010-02-13 18:54:59 +00:00
|
|
|
${worksrcpath}/configure
|
2010-12-09 11:07:12 +00:00
|
|
|
}
|
2022-03-02 16:35:52 +11:00
|
|
|
configure.args-append --enable-universalsdk=${configure.sysroot}
|
2010-02-13 18:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
2019-01-06 01:51:26 +11:00
|
|
|
variant ucs4 description {Enable support for UCS4 (breaks ABI)} {
|
2010-12-09 11:07:12 +00:00
|
|
|
configure.args-append --enable-unicode=ucs4
|
2019-01-06 01:51:26 +11:00
|
|
|
notes-append "The ucs4 variant changes Python's ABI, breaking binary\
|
|
|
|
|
compatibility with extension modules. It is strongly recommended to\
|
|
|
|
|
configure MacPorts to build all ports from source when using it. Adding\
|
|
|
|
|
or removing this variant on an existing installation will mean that all\
|
|
|
|
|
ports that install Python extension modules need to be reinstalled. This\
|
|
|
|
|
variant also breaks compatibility with native Mac frameworks used by\
|
|
|
|
|
modules such as PyObjC."
|
2010-02-13 18:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
2021-10-10 07:39:50 +11:00
|
|
|
variant optimizations description {enable expensive, stable optimizations (including PGO)} {
|
2018-07-05 19:27:24 -04:00
|
|
|
configure.args-append --enable-optimizations
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-10 09:03:24 +11:00
|
|
|
variant lto requires optimizations description {enable Link-Time Optimization} {
|
2021-10-10 07:39:50 +11:00
|
|
|
configure.args-append --with-lto
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
platform darwin {
|
|
|
|
|
if {$subport ne "${name}-bootstrap"} {
|
2021-10-10 08:43:21 +11:00
|
|
|
# Build failures on 10.9 and older
|
|
|
|
|
if {${os.major} > 13} {
|
2021-10-10 09:03:24 +11:00
|
|
|
default_variants +lto +optimizations
|
2021-10-10 08:43:21 +11:00
|
|
|
}
|
2021-10-10 07:39:50 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-13 18:54:59 +00:00
|
|
|
livecheck.type regex
|
2014-07-03 12:57:20 +00:00
|
|
|
livecheck.url ${homepage}downloads/
|
2014-02-20 08:57:53 +00:00
|
|
|
livecheck.regex Python (${branch}(?:\\.\\d+)*)
|