# $Id: Portfile 50424 2009-04-30 21:04:30Z jmr@macports.org $ PortSystem 1.0 PortGroup select 1.0 name python25 version 2.5.4 revision 3 set branch [join [lrange [split ${version} .] 0 1] .] categories lang platforms darwin maintainers mww description An interpreted, object-oriented programming language long_description Python is an interpreted, interactive, object-oriented \ programming language. homepage http://www.python.org/ master_sites http://ftp.python.org/ftp/python/${version}/ distname Python-${version} use_bzip2 yes checksums md5 394a5f56a5ce811fb0f023197ec0833e \ sha1 0f2e819d6381f72f26c734e00a6780b3933ea404 \ rmd160 3a76c83464c3b1c38a60351ab054e33ac7195663 # patch-Lib-distutils-dist.py.diff comes from # patchfiles patch-Makefile.pre.in.diff \ patch-setup.py.diff \ patch-Lib-cgi.py.diff \ patch-Lib-distutils-dist.py.diff depends_lib port:gettext configure.args --enable-shared \ --enable-framework=${frameworks_dir} \ --mandir=${prefix}/share/man \ --without-readline \ --disable-tk \ --enable-ipv6 use_parallel_build no post-patch { reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py reinplace "s|/Applications/MacPython|${applications_dir}/MacPython|g" \ Mac/Makefile.in Mac/IDLE/Makefile.in \ Mac/Tools/Doc/setup.py Mac/PythonLauncher/Makefile.in \ Mac/BuildScript/build-installer.py reinplace "s|xargs -0 rm -r|xargs -0 rm -rf|g" \ Mac/PythonLauncher/Makefile.in } build.target all # TODO: From python24, do we still need this? # Workaround for case-sensitive file systems post-build { if { ![file exists ${worksrcpath}/python.exe] } { ln -s python ${worksrcpath}/python.exe } } test.run yes test.target test destroot.target frameworkinstall maninstall # ensure that correct compiler is used build.args-append MAKE="${build.cmd} CC=${configure.cc}" destroot.args-append MAKE="${destroot.cmd} CC=${configure.cc}" select.group python select.file ${filespath}/python[string map {. {}} ${branch}] platform macosx { post-destroot { set framewpath ${frameworks_dir}/Python.framework set framewdir ${framewpath}/Versions/${branch} # Without this, LINKFORSHARED is set to # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) # (this becomes Python.framework/Versions/2.5/Python) which doesn't # quite work (see ticket #15099); instead specifically list the # full path to the proper Python framework file (which becomes # ${prefix}/Library/Frameworks/Python.framework/Versions/2.5/Python) reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile foreach dir { lib include } { file rename ${destroot}${framewdir}/${dir}/python${branch} ${destroot}${prefix}/${dir} ln -s ${prefix}/${dir}/python${branch} ${destroot}${framewdir}/${dir}/python${branch} } ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1 # delete symlinks without version suffix, use python_select instead to choose version foreach bin { python pythonw idle pydoc smtpd.py python-config } { file delete ${destroot}${prefix}/bin/${bin} } foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py python${branch}-config] { file rename -force ${destroot}${framewdir}/bin/${bin} ${destroot}${prefix}/bin ln -s ${prefix}/bin/${bin} ${destroot}${framewdir}/bin/${bin} } foreach dir { Headers Resources Python Versions/Current } { file delete ${destroot}${framewpath}/${dir} } } } post-activate { ui_msg "\nTo fully complete your installation and make python $branch the default, please run \n\tsudo port install python_select \ \n\tsudo python_select $name\n" } platform darwin 7 { # there is no SystemStubs on 10.3 post-patch { reinplace "s|-lSystemStubs||g" \ configure configure.in } post-configure { reinplace "s|-lSystemStubs||g" \ Makefile.pre.in Makefile.pre Makefile } # To avoid GCC incompatibility issue. See http://nxg.me.uk/note/2004/restFP/ (by ebgssth@gmail.com, ticket #13322) configure.ldflags-append "-lcc_dynamic" } platform darwin 8 { # TODO: would configure.compiler be more appropriate? configure.args-append --with-cxx=/usr/bin/g++-4.0 } platform darwin 9 { configure.cppflags-append -D__DARWIN_UNIX03 } platform darwin 10 { configure.args-append --disable-toolbox-glue configure.cppflags-append -D_DARWIN_C_SOURCE patchfiles-append patch-configure-badcflags.diff } platform puredarwin { patchfiles-append patch-Modules-posixmodule.c.diff configure.args-delete --enable-framework=${frameworks_dir} configure.args-append --disable-toolbox-glue --disable-framework destroot.target install maninstall post-build { # thin dynamic library to have the same arch as static lib, even after -lSystemStubs system "lipo ${worksrcpath}/libpython${branch}.dylib -output ${worksrcpath}/libpython${branch}.dylib -thin `lipo -info ${worksrcpath}/libpython${branch}.a | tail -n 1 | sed -e 's/.*architecture: \\(.*\\)/\\1/'`" } post-destroot { # delete symlinks without version suffix, use python_select instead to choose version foreach bin { python pythonw idle pydoc smtpd.py python-config } { file delete ${destroot}${prefix}/bin/${bin} } file rename ${destroot}${prefix}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1 # install select file for python_select xinstall -m 755 -d ${destroot}${prefix}/etc/select/python xinstall -m 644 ${filespath}/python[string map {. {}} ${branch}] ${destroot}${prefix}/etc/select/python/ } } variant universal { configure.args-append --enable-universalsdk=${universal_sysroot} } livecheck.check regex livecheck.url ${homepage}download/releases/ livecheck.regex Python (${branch}.\[0-9\]+)