update 0.6

This commit is contained in:
utahta
2010-11-14 03:27:13 +09:00
parent 97b101f33c
commit c7aeaa9fcd
44 changed files with 2688 additions and 33 deletions
+12 -1
View File
@@ -1,3 +1,7 @@
* 0.6
- Compiling Python-2.5.5 and Python-2.4.6 on MacOSX SnowLeopard
- Bug fix
* 0.5
- This version is incompatible with the 0.4 or less.
- Split the file.
@@ -7,4 +11,11 @@
- Removed `init`.
- Added syntax that `pythonbrew command <VERSION>`
- Change default PYTHONBREW_ROOT path as $HOME/.pythonbrew
* 0.4
* 0.3
* 0.2
- Bug fix
* 0.1
- First release
+1 -1
View File
@@ -17,7 +17,7 @@ The recommended way to download and install pythonbrew is to run these statement
chmod +x pythonbrew-install
./pythonbrew-install
After that, pythonbrew installs itself to ~/.pythonbrew/bin, and you should follow the instruction on screen to setup your .bashrc or .cshrc to put it in your PATH.
After that, pythonbrew installs itself to ~/.pythonbrew, and you should follow the instruction on screen to setup your .bashrc or .cshrc to put it in your PATH.
If you need to install pythonbrew into somewhere else, you can do that by setting a PYTHONBREW_ROOT environment variable.::
+17 -16
View File
@@ -1,30 +1,31 @@
import os
VERSION = "0.5"
VERSION = "0.6"
if os.environ.has_key("PYTHONBREW_ROOT"):
ROOT = os.environ["PYTHONBREW_ROOT"]
else:
ROOT = "%s/.pythonbrew" % os.environ["HOME"]
ROOT = os.path.join(os.environ["HOME"],".pythonbrew")
INSTALLER_ROOT = os.path.dirname(os.path.abspath(__file__))
PATH_PYTHONS = "%s/pythons" % ROOT
PATH_BUILD = "%s/build" % ROOT
PATH_DISTS = "%s/dists" % ROOT
PATH_ETC = "%s/etc" % ROOT
PATH_BIN = "%s/bin" % ROOT
PATH_LOG = "%s/log" % ROOT
PATH_SCRIPTS = "%s/scripts" % ROOT
PATH_SCRIPTS_PYTHONBREW = "%s/pythonbrew" % PATH_SCRIPTS
PATH_SCRIPTS_PYTHONBREW_COMMANDS = "%s/commands" % PATH_SCRIPTS_PYTHONBREW
PATH_PATCHES = "%s/patches" % ROOT
PATH_PATCHES_MACOSX = "%s/macosx" % PATH_PATCHES
PATH_PATCHES_MACOSX_PYTHON25 = "%s/python25" % PATH_PATCHES_MACOSX
PATH_PYTHONS = os.path.join(ROOT,"pythons")
PATH_BUILD = os.path.join(ROOT,"build")
PATH_DISTS = os.path.join(ROOT,"dists")
PATH_ETC = os.path.join(ROOT,"etc")
PATH_BIN = os.path.join(ROOT,"bin")
PATH_LOG = os.path.join(ROOT,"log")
PATH_SCRIPTS = os.path.join(ROOT,"scripts")
PATH_SCRIPTS_PYTHONBREW = os.path.join(PATH_SCRIPTS,"pythonbrew")
PATH_SCRIPTS_PYTHONBREW_COMMANDS = os.path.join(PATH_SCRIPTS_PYTHONBREW,"commands")
PATH_PATCHES = os.path.join(ROOT,"patches")
PATH_PATCHES_MACOSX = os.path.join(PATH_PATCHES,"macosx")
PATH_PATCHES_MACOSX_PYTHON25 = os.path.join(PATH_PATCHES_MACOSX,"python25")
PATH_PATCHES_MACOSX_PYTHON24 = os.path.join(PATH_PATCHES_MACOSX,"python24")
# file path
PATH_BIN_PYTHONBREW = "%s/pythonbrew" % PATH_BIN
PATH_BIN_PYBREW = "%s/pybrew" % PATH_BIN # pybrew is symlink as pythonbrew
PATH_BIN_PYTHONBREW = os.path.join(PATH_BIN,"pythonbrew")
PATH_BIN_PYBREW = os.path.join(PATH_BIN,"pybrew") # pybrew is symlink as pythonbrew
# download setuptools url
DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py"
+63 -14
View File
@@ -4,11 +4,13 @@ import glob
import shutil
import re
from pythonbrew.util import makedirs, symlink, Package, is_url, splitext, Link,\
unlink, is_gzip, is_html, untar_file, Subprocess, rm_r
unlink, is_gzip, is_html, untar_file, Subprocess, rm_r,\
is_macosx_snowleopard, is_python25, is_python24, is_python26
from pythonbrew.define import PATH_BUILD, PATH_BIN, PATH_DISTS, PATH_PYTHONS,\
PATH_ETC, PATH_SCRIPTS, PATH_SCRIPTS_PYTHONBREW,\
PATH_SCRIPTS_PYTHONBREW_COMMANDS, INSTALLER_ROOT, PATH_BIN_PYTHONBREW,\
PATH_BIN_PYBREW, ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE, PATH_PATCHES
PATH_BIN_PYBREW, ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE, PATH_PATCHES,\
PATH_PATCHES_MACOSX_PYTHON25, PATH_PATCHES_MACOSX_PYTHON24
from pythonbrew.downloader import get_python_package_url, Downloader,\
get_response_from_url
from pythonbrew.log import logger
@@ -23,16 +25,15 @@ def install_pythonbrew():
makedirs(PATH_SCRIPTS)
makedirs(PATH_SCRIPTS_PYTHONBREW)
makedirs(PATH_SCRIPTS_PYTHONBREW_COMMANDS)
makedirs(PATH_PATCHES)
for path in glob.glob("%s/*.py" % INSTALLER_ROOT):
for path in glob.glob(os.path.join(INSTALLER_ROOT,"*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW)
for path in glob.glob("%s/commands/*.py" % INSTALLER_ROOT):
for path in glob.glob(os.path.join(INSTALLER_ROOT,"commands","*.py")):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_COMMANDS)
# for path in glob.glob("%s/patches" % INSTALLER_ROOT):
# shutil.copytree(path, PATH_PATCHES)
rm_r(PATH_PATCHES)
shutil.copytree(os.path.join(INSTALLER_ROOT,"patches"), PATH_PATCHES)
fp = open("%s/pythonbrew_main.py" % PATH_SCRIPTS, "w")
fp.write("""import pythonbrew
@@ -78,12 +79,14 @@ class PythonInstaller(object):
if os.path.isdir(self.install_dir):
logger.info("You are already installed `%s`" % self.pkg.name)
sys.exit()
self.ensure()
self.download()
logger.info("")
logger.info("This could take a while. You can run the following command on another shell to track the status:")
logger.info(" tail -f %s" % self.logfile)
logger.info("")
self.unpack()
self.patch()
logger.info("Installing %s into %s" % (self.pkg.name, self.install_dir))
try:
self.configure()
@@ -92,7 +95,7 @@ class PythonInstaller(object):
except:
rm_r(self.install_dir)
logger.error("Failed to install %s. See %s to see why." % (self.pkg.name, self.logfile))
logger.error(" pythonbrew install --force %s" % self.pkg.version)
logger.info(" pythonbrew install --force %s" % self.pkg.version)
sys.exit(1)
self.install_setuptools()
logger.info("Installed %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
@@ -100,6 +103,13 @@ class PythonInstaller(object):
logger.info("")
logger.info(" pythonbrew switch %s" % self.pkg.version)
def ensure(self):
if is_macosx_snowleopard():
version = self.pkg.version
if version < '2.6' and (version != '2.4.6' and version != '2.5.5'):
logger.info("`%s` is not supported on MacOSX Snow Leopard" % self.pkg.name)
sys.exit()
def download(self):
content_type = self.content_type
if is_html(content_type):
@@ -128,9 +138,49 @@ class PythonInstaller(object):
else:
logger.error("Cannot determine archive format of %s" % self.download_file)
def patch(self):
version = self.pkg.version
try:
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
patches = []
if is_macosx_snowleopard():
if is_python24(version):
patch_dir = os.path.join(PATH_PATCHES_MACOSX_PYTHON24,'files')
patches = ['patch-configure', 'patch-Makefile.pre.in',
'patch-Lib-cgi.py', 'patch-Lib-site.py',
'patch-setup.py', 'patch-Include-pyport.h',
'patch-Mac-OSX-Makefile.in', 'patch-Mac-OSX-IDLE-Makefile.in',
'patch-Mac-OSX-PythonLauncher-Makefile.in', 'patch-configure-badcflags.diff',
'patch-configure-arch_only.diff', 'patch-macosmodule.diff',
'patch-mactoolboxglue.diff', 'patch-pymactoolbox.diff']
elif is_python25(version):
patch_dir = os.path.join(PATH_PATCHES_MACOSX_PYTHON25,'files')
patches = ['patch-Makefile.pre.in.diff', 'patch-Lib-cgi.py.diff',
'patch-Lib-distutils-dist.py.diff', 'patch-setup.py.diff',
'patch-configure-badcflags.diff', 'patch-configure-arch_only.diff',
'patch-64bit.diff', 'patch-pyconfig.h.in.diff',
'patch-Modules-posixmodule.c.diff']
if patches:
logger.info("Patching %s" % self.pkg.name)
for patch in patches:
s.check_call("patch -p0 < %s" % os.path.join(patch_dir, patch))
except:
logger.error("Failed to patch `%s`" % self.build_dir)
sys.exit(1)
def configure(self):
configure_option = ""
if is_macosx_snowleopard():
version = self.pkg.version
if is_python24(version):
configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6 CPPFLAGS="-D__DARWIN_UNIX03"'
elif is_python25(version):
configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6 CPPFLAGS="-D_DARWIN_C_SOURCE"'
elif is_python26(version):
configure_option = '--with-universal-archs="intel" MACOSX_DEPLOYMENT_TARGET=10.6'
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
s.check_call("./configure --prefix=%s %s" % (self.install_dir, self.options.configure))
s.check_call("./configure --prefix=%s %s %s" % (self.install_dir, self.options.configure, configure_option))
def make(self):
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
@@ -159,11 +209,12 @@ class PythonInstaller(object):
is_python3 = False
download_url = DISTRIBUTE_SETUP_DLSITE
filename = Link(download_url).filename
download_file = os.path.join(PATH_DISTS, filename)
dl = Downloader()
dl.download(filename, download_url, "%s/%s" % (PATH_DISTS, filename))
dl.download(filename, download_url, download_file)
install_dir = "%s/%s" % (PATH_PYTHONS, pkgname)
install_dir = os.path.join(PATH_PYTHONS, pkgname)
if is_python3:
if os.path.isfile("%s/bin/python3" % (install_dir)):
pyexec = "%s/bin/python3" % (install_dir)
@@ -173,7 +224,7 @@ class PythonInstaller(object):
logger.error("Python3 binary not found. `%s`" % (install_dir))
return
else:
pyexec = "%s/bin/python" % (install_dir)
pyexec = os.path.join(install_dir,"bin","python")
try:
s = Subprocess(log=self.logfile, shell=True, cwd=PATH_DISTS, print_cmd=False)
@@ -188,5 +239,3 @@ class PythonInstaller(object):
@@ -0,0 +1,11 @@
K 25
svn:wc:ra_dav:version-url
V 62
/repository/macports/!svn/ver/70279/trunk/dports/lang/python24
END
Portfile
K 25
svn:wc:ra_dav:version-url
V 71
/repository/macports/!svn/ver/70279/trunk/dports/lang/python24/Portfile
END
@@ -0,0 +1,65 @@
10
dir
73430
http://svn.macports.org/repository/macports/trunk/dports/lang/python24
http://svn.macports.org/repository/macports
2010-08-04T15:01:11.022285Z
70279
macsforever2000@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
files
dir
Portfile
file
2010-11-13T14:51:11.000000Z
780457d62169f841a63f0da05f70d918
2010-08-04T15:01:11.022285Z
70279
macsforever2000@macports.org
has-props
8580
@@ -0,0 +1,9 @@
K 13
svn:eol-style
V 6
native
K 12
svn:keywords
V 2
Id
END
@@ -0,0 +1,203 @@
# $Id$
PortSystem 1.0
PortGroup select 1.0
name python24
version 2.4.6
revision 7
set major [lindex [split $version .] 0]
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers fourdigits.nl:roel openmaintainer
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 ${homepage}/ftp/python/${version}/ \
ftp://ftp.python.org/pub/python/${version}/ \
ftp://ftp.fastorama.com/mirrors/ftp.python.org/pub/python/${version}/ \
ftp://ftp.python.jp/pub/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 76083277f6c7e4d78992f36d7ad9018d \
sha1 cb1972a554a458f6a26d3e047b359251865d7c96 \
rmd160 0687989193dec2ac108142759281be7ddcf7f31e
patchfiles patch-configure \
patch-Makefile.pre.in \
patch-Lib-cgi.py \
patch-Lib-site.py \
patch-setup.py \
patch-Include-pyport.h \
patch-Mac-OSX-Makefile.in \
patch-Mac-OSX-IDLE-Makefile.in \
patch-Mac-OSX-PythonLauncher-Makefile.in \
patch-configure-badcflags.diff \
patch-configure-arch_only.diff
depends_lib port:gettext port:openssl
configure.args --with-cxx=${configure.cxx} \
--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 \
${worksrcpath}/Lib/site.py ${worksrcpath}/setup.py
reinplace "s|__FRAMEWORKS_DIR__|${frameworks_dir}|g" \
${worksrcpath}/Mac/OSX/Makefile.in
reinplace "s|__APPLICATIONS_DIR__|${applications_dir}|g" \
${worksrcpath}/Mac/OSX/IDLE/Makefile.in \
${worksrcpath}/Mac/OSX/Makefile.in \
${worksrcpath}/Mac/OSX/PythonLauncher/Makefile.in
}
build.target all
# 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
select.group python
select.file ${filespath}/python[string map {. {}} ${branch}]
platform macosx {
if {(![variant_isset universal] && ![string match *64* $build_arch]) || ([variant_isset universal] && ![string match *64* $universal_archs])} {
post-destroot {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
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}
}
# Since the lib/python${branch} dir was just moved above and
# libpython2.4.a in lib/python${branch}/config is relative, we need
# to repoint it here
file delete ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
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 } {
file delete ${destroot}${prefix}/bin/${bin}
}
foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py] {
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}
}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/2.4/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.4/Python)
reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${prefix}/lib/python${branch}/config/Makefile
}
} else {
# 64-bit, can't build mac-specific stuff
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue
destroot.target install maninstall
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/
}
}
}
notes "To fully complete your installation and make python $branch the default, please run:
\tsudo port install python_select
\tsudo python_select $name"
platform darwin {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D__DARWIN_UNIX03
post-configure {
reinplace "s|#define _POSIX_C_SOURCE 200112L|#undef _POSIX_C_SOURCE|g" ${worksrcpath}/pyconfig.h
reinplace "s|#define _XOPEN_SOURCE 600|#undef _XOPEN_SOURCE|g" ${worksrcpath}/pyconfig.h
patchfiles-append patch-macosmodule.diff \
patch-mactoolboxglue.diff \
patch-pymactoolbox.diff
}
}
platform puredarwin {
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue --disable-framework
destroot.target install maninstall
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 {
if {${configure.sdkroot} != ""} {
configure.args-append --enable-universalsdk=${configure.sdkroot}
} else {
configure.args-append --enable-universalsdk=/
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
+203
View File
@@ -0,0 +1,203 @@
# $Id: Portfile 70279 2010-08-04 15:01:11Z macsforever2000@macports.org $
PortSystem 1.0
PortGroup select 1.0
name python24
version 2.4.6
revision 7
set major [lindex [split $version .] 0]
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers fourdigits.nl:roel openmaintainer
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 ${homepage}/ftp/python/${version}/ \
ftp://ftp.python.org/pub/python/${version}/ \
ftp://ftp.fastorama.com/mirrors/ftp.python.org/pub/python/${version}/ \
ftp://ftp.python.jp/pub/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 76083277f6c7e4d78992f36d7ad9018d \
sha1 cb1972a554a458f6a26d3e047b359251865d7c96 \
rmd160 0687989193dec2ac108142759281be7ddcf7f31e
patchfiles patch-configure \
patch-Makefile.pre.in \
patch-Lib-cgi.py \
patch-Lib-site.py \
patch-setup.py \
patch-Include-pyport.h \
patch-Mac-OSX-Makefile.in \
patch-Mac-OSX-IDLE-Makefile.in \
patch-Mac-OSX-PythonLauncher-Makefile.in \
patch-configure-badcflags.diff \
patch-configure-arch_only.diff
depends_lib port:gettext port:openssl
configure.args --with-cxx=${configure.cxx} \
--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 \
${worksrcpath}/Lib/site.py ${worksrcpath}/setup.py
reinplace "s|__FRAMEWORKS_DIR__|${frameworks_dir}|g" \
${worksrcpath}/Mac/OSX/Makefile.in
reinplace "s|__APPLICATIONS_DIR__|${applications_dir}|g" \
${worksrcpath}/Mac/OSX/IDLE/Makefile.in \
${worksrcpath}/Mac/OSX/Makefile.in \
${worksrcpath}/Mac/OSX/PythonLauncher/Makefile.in
}
build.target all
# 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
select.group python
select.file ${filespath}/python[string map {. {}} ${branch}]
platform macosx {
if {(![variant_isset universal] && ![string match *64* $build_arch]) || ([variant_isset universal] && ![string match *64* $universal_archs])} {
post-destroot {
set framewpath ${frameworks_dir}/Python.framework
set framewdir ${framewpath}/Versions/${branch}
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}
}
# Since the lib/python${branch} dir was just moved above and
# libpython2.4.a in lib/python${branch}/config is relative, we need
# to repoint it here
file delete ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
ln -s ${framewdir}/Python ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
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 } {
file delete ${destroot}${prefix}/bin/${bin}
}
foreach bin [list python${branch} pythonw${branch} idle${branch} pydoc${branch} smtpd${branch}.py] {
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}
}
# Without this, LINKFORSHARED is set to
# ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
# (this becomes Python.framework/Versions/2.4/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.4/Python)
reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${prefix}/lib/python${branch}/config/Makefile
}
} else {
# 64-bit, can't build mac-specific stuff
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue
destroot.target install maninstall
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/
}
}
}
notes "To fully complete your installation and make python $branch the default, please run:
\tsudo port install python_select
\tsudo python_select $name"
platform darwin {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D__DARWIN_UNIX03
post-configure {
reinplace "s|#define _POSIX_C_SOURCE 200112L|#undef _POSIX_C_SOURCE|g" ${worksrcpath}/pyconfig.h
reinplace "s|#define _XOPEN_SOURCE 600|#undef _XOPEN_SOURCE|g" ${worksrcpath}/pyconfig.h
patchfiles-append patch-macosmodule.diff \
patch-mactoolboxglue.diff \
patch-pymactoolbox.diff
}
}
platform puredarwin {
configure.args-delete --enable-framework=${frameworks_dir}
configure.args-append --disable-toolbox-glue --disable-framework
destroot.target install maninstall
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 {
if {${configure.sdkroot} != ""} {
configure.args-append --enable-universalsdk=${configure.sdkroot}
} else {
configure.args-append --enable-universalsdk=/
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
@@ -0,0 +1,101 @@
K 25
svn:wc:ra_dav:version-url
V 68
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files
END
patch-setup.py
K 25
svn:wc:ra_dav:version-url
V 83
/repository/macports/!svn/ver/42379/trunk/dports/lang/python24/files/patch-setup.py
END
patch-pymactoolbox.diff
K 25
svn:wc:ra_dav:version-url
V 92
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files/patch-pymactoolbox.diff
END
patch-Mac-OSX-Makefile.in
K 25
svn:wc:ra_dav:version-url
V 94
/repository/macports/!svn/ver/41218/trunk/dports/lang/python24/files/patch-Mac-OSX-Makefile.in
END
patch-Mac-OSX-PythonLauncher-Makefile.in
K 25
svn:wc:ra_dav:version-url
V 109
/repository/macports/!svn/ver/41218/trunk/dports/lang/python24/files/patch-Mac-OSX-PythonLauncher-Makefile.in
END
python24
K 25
svn:wc:ra_dav:version-url
V 77
/repository/macports/!svn/ver/50424/trunk/dports/lang/python24/files/python24
END
patch-mactoolboxglue.diff
K 25
svn:wc:ra_dav:version-url
V 94
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files/patch-mactoolboxglue.diff
END
patch-configure-badcflags.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/56585/trunk/dports/lang/python24/files/patch-configure-badcflags.diff
END
patch-Lib-cgi.py
K 25
svn:wc:ra_dav:version-url
V 85
/repository/macports/!svn/ver/28753/trunk/dports/lang/python24/files/patch-Lib-cgi.py
END
patch-Lib-site.py
K 25
svn:wc:ra_dav:version-url
V 86
/repository/macports/!svn/ver/21487/trunk/dports/lang/python24/files/patch-Lib-site.py
END
patch-Mac-OSX-IDLE-Makefile.in
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/41218/trunk/dports/lang/python24/files/patch-Mac-OSX-IDLE-Makefile.in
END
patch-configure-arch_only.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/56585/trunk/dports/lang/python24/files/patch-configure-arch_only.diff
END
patch-Include-pyport.h
K 25
svn:wc:ra_dav:version-url
V 91
/repository/macports/!svn/ver/23777/trunk/dports/lang/python24/files/patch-Include-pyport.h
END
patch-Makefile.pre.in
K 25
svn:wc:ra_dav:version-url
V 90
/repository/macports/!svn/ver/44176/trunk/dports/lang/python24/files/patch-Makefile.pre.in
END
pyconfig.ed
K 25
svn:wc:ra_dav:version-url
V 80
/repository/macports/!svn/ver/48185/trunk/dports/lang/python24/files/pyconfig.ed
END
patch-macosmodule.diff
K 25
svn:wc:ra_dav:version-url
V 91
/repository/macports/!svn/ver/70266/trunk/dports/lang/python24/files/patch-macosmodule.diff
END
patch-configure
K 25
svn:wc:ra_dav:version-url
V 84
/repository/macports/!svn/ver/44176/trunk/dports/lang/python24/files/patch-configure
END
@@ -0,0 +1,572 @@
10
dir
73430
http://svn.macports.org/repository/macports/trunk/dports/lang/python24/files
http://svn.macports.org/repository/macports
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
patch-setup.py
file
2010-11-13T14:51:11.000000Z
5f490b115ab19796bd3af9de6901dd49
2008-11-20T06:13:14.102247Z
42379
blb@macports.org
2219
patch-pymactoolbox.diff
file
2010-11-13T14:51:11.000000Z
789b1776bda064daf576ee30ae56c0d0
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
585
patch-Mac-OSX-Makefile.in
file
2010-11-13T14:51:11.000000Z
62e937496bf0fba58b1413b3b7080950
2008-10-28T06:31:42.726319Z
41218
blb@macports.org
721
patch-Mac-OSX-PythonLauncher-Makefile.in
file
2010-11-13T14:51:11.000000Z
d21904e251b9114c93eaaa23608102e6
2008-10-28T06:31:42.726319Z
41218
blb@macports.org
769
python24
file
2010-11-13T14:51:11.000000Z
aa43cb032d8199431e9f3371fb0d3754
2009-04-30T21:04:30.747761Z
50424
jmr@macports.org
321
patch-mactoolboxglue.diff
file
2010-11-13T14:51:11.000000Z
9101df4cf01c5c8b9eb0192757a01d64
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
733
patch-configure-badcflags.diff
file
2010-11-13T14:51:11.000000Z
0edd3830be4a95c9ef6ace14cac35a36
2009-08-30T16:27:48.203663Z
56585
jmr@macports.org
629
patch-Lib-cgi.py
file
2010-11-13T14:51:11.000000Z
16a1503a53b90c650e5a18ddd3c099ba
2007-09-08T10:37:52.838883Z
28753
afb@macports.org
808
patch-Lib-site.py
file
2010-11-13T14:51:11.000000Z
b3e92b93bc323584d2d50876c9d7d228
2007-01-26T02:45:46.302708Z
21487
eridius@macports.org
550
patch-Mac-OSX-IDLE-Makefile.in
file
2010-11-13T14:51:11.000000Z
75cb1fde28f15bf2219160562fc62592
2008-10-28T06:31:42.726319Z
41218
blb@macports.org
346
patch-configure-arch_only.diff
file
2010-11-13T14:51:11.000000Z
9dbe4e25743af454086d069ca875738b
2009-08-30T16:27:48.203663Z
56585
jmr@macports.org
1019
patch-Include-pyport.h
file
2010-11-13T14:51:11.000000Z
e69c63be534f546dcd3f7d50f6c52bce
2007-04-09T19:13:26.590067Z
23777
mgrimes@macports.org
1331
patch-Makefile.pre.in
file
2010-11-13T14:51:11.000000Z
30784b41f25f887041698ccffa050643
2008-12-23T04:46:09.409745Z
44176
blb@macports.org
345
pyconfig.ed
file
2010-11-13T14:51:11.000000Z
674a4842ff1491cf7669c37d9b0b95bc
2009-03-16T07:42:14.908329Z
48185
blb@macports.org
49
patch-macosmodule.diff
file
2010-11-13T14:51:11.000000Z
8df02cb3c18543f8637eae8cacd51c4a
2010-08-04T04:14:16.151846Z
70266
macsforever2000@macports.org
10267
patch-configure
file
2010-11-13T14:51:11.000000Z
44225e6715e9b9e0ed742c56ecba7d86
2008-12-23T04:46:09.409745Z
44176
blb@macports.org
1131
@@ -0,0 +1,34 @@
--- Include/pyport.h.orig 2007-03-12 23:26:06.000000000 -0700
+++ Include/pyport.h 2007-03-12 23:29:35.000000000 -0700
@@ -152,11 +152,23 @@ typedef PY_LONG_LONG Py_intptr_t;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
#include <sys/types.h>
#endif
+
+#if (defined __APPLE__) && (!defined _POSIX_C_SOURCE)
+#define TEMPORARILY_DEFINING__POSIX_C_SOURCE /* so we can #undef it later */
+#define _POSIX_C_SOURCE /* avoid deprecated struct ostat in sys/stat.h */
+#endif
+
#include <sys/stat.h>
#elif defined(HAVE_STAT_H)
#include <stat.h>
#endif
+/* Mac OS X: undefine _POSIX_C_SOURCE if it wasn't defined before */
+#ifdef TEMPORARILY_DEFINING__POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#undef TEMPORARILY_DEFINING__POSIX_C_SOURCE
+#endif
+
#if defined(PYCC_VACPP)
/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
@@ -393,6 +405,7 @@ extern char * _getpty(int *, int, mode_t
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
functions, even though they are included in libutil. */
#include <termios.h>
+struct winsize;
extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
extern int forkpty(int *, char *, struct termios *, struct winsize *);
#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
@@ -0,0 +1,18 @@
--- Lib/cgi.py.orig 2006-08-11 09:14:38.000000000 +0200
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
+#! __PREFIX__/bin/python2.4
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
-# intentionally NOT "/usr/bin/env python". On many systems
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
-# scripts, and /usr/local/bin is the default directory where Python is
-# installed, so /usr/bin/env would be unable to find python. Granted,
-# binary installations by Linux vendors often install Python in
-# /usr/bin. So let those vendors patch cgi.py to match their choice
-# of installation.
+# NOTE: /usr/local/bin/python patched for MacPorts installation
"""Support module for CGI (Common Gateway Interface) scripts.
@@ -0,0 +1,10 @@
--- Lib/site.py Tue Jul 20 04:28:28 2004
+++ Lib/site.py.new Mon Apr 4 10:47:12 2005
@@ -186,6 +186,7 @@
else:
sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
if sys.platform == 'darwin':
+ sitedirs.append( os.path.join('__PREFIX__', 'lib', 'python2.4', 'site-packages') )
# for framework builds *only* we add the standard Apple
# locations. Currently only per-user, but /Library and
# /Network/Library could be added too
@@ -0,0 +1,11 @@
--- Mac/OSX/IDLE/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/IDLE/Makefile.in 2007-04-27 13:27:07.000000000 -0700
@@ -21,7 +21,7 @@
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
+PYTHONAPPSDIR=__APPLICATIONS_DIR__/MacPython $(VERSION)
all: IDLE.app
@@ -0,0 +1,20 @@
--- Mac/OSX/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/Makefile.in 2007-04-27 11:07:02.000000000 -0700
@@ -5,7 +5,7 @@
VERSION=@VERSION@
builddir = ../..
srcdir = @srcdir@
-prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
+prefix=__FRAMEWORKS_DIR__/Python.framework/Versions/$(VERSION)
LIBDEST=$(prefix)/lib/python$(VERSION)
BUILDPYTHON=$(builddir)/python.exe
RUNSHARED= @RUNSHARED@
@@ -16,7 +16,7 @@
# These are normally glimpsed from the previous set
bindir=@exec_prefix@/bin
-PYTHONAPPSPATH=/Applications/MacPython $(VERSION)
+PYTHONAPPSPATH=__APPLICATIONS_DIR__/MacPython $(VERSION)
PYTHONAPPSDIR=$(PYTHONAPPSPATH)
APPINSTALLDIR=$(prefix)/Resources/Python.app
@@ -0,0 +1,20 @@
--- Mac/OSX/PythonLauncher/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/PythonLauncher/Makefile.in 2007-04-27 13:33:26.000000000 -0700
@@ -20,7 +20,7 @@
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
+PYTHONAPPSDIR=__APPLICATIONS_DIR__/MacPython $(VERSION)
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
all: PythonLauncher.app
@@ -56,7 +56,7 @@
--resource=$(srcdir)/factorySettings.plist \
--plist=$(srcdir)/Info.plist \
build
- find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r
+ find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r || :
FileSettings.o: $(srcdir)/FileSettings.m
@@ -0,0 +1,11 @@
--- Makefile.pre.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Makefile.pre.in 2007-04-20 18:06:11.000000000 -0700
@@ -56,7 +56,7 @@
OPT= @OPT@
BASECFLAGS= @BASECFLAGS@
CFLAGS= $(BASECFLAGS) $(OPT)
-CPPFLAGS= -I. -I$(srcdir)/Include
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir)/Include
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
SGI_ABI= @SGI_ABI@
@@ -0,0 +1,20 @@
--- configure.orig 2009-08-31 01:54:27.000000000 +1000
+++ configure 2009-08-31 01:55:24.000000000 +1000
@@ -10321,7 +10321,7 @@
Darwin/[01234567].*)
LIBTOOL_CRUFT="-framework System -lcc_dynamic"
if test -z "${enable_universalsdk}"; then
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10333,7 +10333,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only '`/usr/bin/arch`
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -0,0 +1,14 @@
--- configure.orig 2009-08-31 01:29:04.000000000 +1000
+++ configure 2009-08-31 01:30:05.000000000 +1000
@@ -3909,9 +3909,9 @@
Darwin*)
if [[ `/usr/bin/arch` = 'ppc' ]]
then
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+ BASECFLAGS="$BASECFLAGS -mno-fused-madd -fno-common"
else
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+ BASECFLAGS="$BASECFLAGS -fno-common"
fi
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
@@ -0,0 +1,25 @@
--- configure.orig 2007-04-05 21:32:57.000000000 -0700
+++ configure 2007-04-05 21:32:59.000000000 -0700
@@ -3907,7 +3907,12 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ if [[ `/usr/bin/arch` = 'ppc' ]]
+ then
+ BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+ else
+ BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+ fi
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
@@ -10328,7 +10333,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only ppc'
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only '`/usr/bin/arch`
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -0,0 +1,427 @@
--- Mac/Modules/macosmodule.c 2004-11-05 08:02:59.000000000 +0100
+++ Mac/Modules/macosmodule.c 2009-09-05 02:07:14.000000000 +0200
@@ -40,7 +40,7 @@
typedef struct {
PyObject_HEAD
- short fRefNum;
+ FSIORefNum fRefNum;
int isclosed;
} rfobject;
@@ -54,7 +54,7 @@
do_close(rfobject *self)
{
if (self->isclosed ) return;
- (void)FSClose(self->fRefNum);
+ (void)FSCloseFork(self->fRefNum);
self->isclosed = 1;
}
@@ -68,6 +68,7 @@
long n;
PyObject *v;
OSErr err;
+ ByteCount n2;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
@@ -81,13 +82,13 @@
if (v == NULL)
return NULL;
- err = FSRead(self->fRefNum, &n, PyString_AsString(v));
+ err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
if (err && err != eofErr) {
PyMac_Error(err);
Py_DECREF(v);
return NULL;
}
- _PyString_Resize(&v, n);
+ _PyString_Resize(&v, n2);
return v;
}
@@ -109,7 +110,7 @@
}
if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
return NULL;
- err = FSWrite(self->fRefNum, &size, buffer);
+ err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
if (err) {
PyMac_Error(err);
return NULL;
@@ -126,47 +127,36 @@
static PyObject *
rf_seek(rfobject *self, PyObject *args)
{
- long amount, pos;
+ long amount;
int whence = SEEK_SET;
- long eof;
+ int mode;
OSErr err;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
return NULL;
}
- if (!PyArg_ParseTuple(args, "l|i", &amount, &whence))
+ if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) {
return NULL;
-
- if ((err = GetEOF(self->fRefNum, &eof)))
- goto ioerr;
+ }
switch (whence) {
case SEEK_CUR:
- if ((err = GetFPos(self->fRefNum, &pos)))
- goto ioerr;
+ mode = fsFromMark;
break;
case SEEK_END:
- pos = eof;
+ mode = fsFromLEOF;
break;
case SEEK_SET:
- pos = 0;
+ mode = fsFromStart;
break;
default:
PyErr_BadArgument();
return NULL;
}
-
- pos += amount;
-
- /* Don't bother implementing seek past EOF */
- if (pos > eof || pos < 0) {
- PyErr_BadArgument();
- return NULL;
- }
-
- if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
-ioerr:
+
+ err = FSSetForkPosition(self->fRefNum, mode, amount);
+ if (err != noErr) {
PyMac_Error(err);
return NULL;
}
@@ -182,7 +172,7 @@
static PyObject *
rf_tell(rfobject *self, PyObject *args)
{
- long where;
+ long long where;
OSErr err;
if (self->isclosed) {
@@ -191,11 +181,13 @@
}
if (!PyArg_ParseTuple(args, ""))
return NULL;
- if ((err = GetFPos(self->fRefNum, &where)) ) {
+
+ err = FSGetForkPosition(self->fRefNum, &where);
+ if (err != noErr) {
PyMac_Error(err);
return NULL;
}
- return PyInt_FromLong(where);
+ return PyLong_FromLongLong(where);
}
static char rf_close__doc__[] =
@@ -281,6 +273,7 @@
Rftype__doc__ /* Documentation string */
};
+
/* End of code for Resource fork objects */
/* -------------------------------------------------------- */
@@ -292,17 +285,61 @@
static PyObject *
MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
{
- FSSpec fss;
- FInfo info;
PyObject *creator, *type, *res;
OSErr err;
-
- if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+ FSRef ref;
+ FSCatalogInfo cataloginfo;
+ FileInfo* finfo;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) {
+#ifndef __LP64__
+ /* This function is documented to take an FSSpec as well,
+ * which only works in 32-bit mode.
+ */
+ PyErr_Clear();
+ FSSpec fss;
+ FInfo info;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+ return NULL;
+
+ if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
+ return PyErr_Mac(MacOS_Error, err);
+ }
+ creator = PyString_FromStringAndSize(
+ (char *)&info.fdCreator, 4);
+ type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+ res = Py_BuildValue("OO", creator, type);
+ Py_DECREF(creator);
+ Py_DECREF(type);
+ return res;
+#else /* __LP64__ */
+ return NULL;
+#endif /* __LP64__ */
+ }
+
+ err = FSGetCatalogInfo(&ref,
+ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
+ NULL, NULL, NULL);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, err);
return NULL;
- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
- creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4);
- type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+ }
+
+ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+ /* Directory: doesn't have type/creator info.
+ *
+ * The specific error code is for backward compatibility with
+ * earlier versions.
+ */
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+
+ }
+ finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
+ type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);
+
res = Py_BuildValue("OO", creator, type);
Py_DECREF(creator);
Py_DECREF(type);
@@ -314,20 +351,66 @@
static PyObject *
MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
{
- FSSpec fss;
ResType creator, type;
- FInfo info;
+ FSRef ref;
+ FileInfo* finfo;
OSErr err;
-
+ FSCatalogInfo cataloginfo;
+
if (!PyArg_ParseTuple(args, "O&O&O&",
+ PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) {
+#ifndef __LP64__
+ /* Try to handle FSSpec arguments, for backward compatibility */
+ FSSpec fss;
+ FInfo info;
+
+ if (!PyArg_ParseTuple(args, "O&O&O&",
PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
+ return NULL;
+
+ if ((err = FSpGetFInfo(&fss, &info)) != noErr)
+ return PyErr_Mac(MacOS_Error, err);
+
+ info.fdCreator = creator;
+ info.fdType = type;
+
+ if ((err = FSpSetFInfo(&fss, &info)) != noErr)
+ return PyErr_Mac(MacOS_Error, err);
+ Py_INCREF(Py_None);
+ return Py_None;
+#else /* __LP64__ */
return NULL;
- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
- info.fdCreator = creator;
- info.fdType = type;
- if ((err = FSpSetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
+#endif /* __LP64__ */
+ }
+
+ err = FSGetCatalogInfo(&ref,
+ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
+ NULL, NULL, NULL);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, err);
+ return NULL;
+ }
+
+ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+ /* Directory: doesn't have type/creator info.
+ *
+ * The specific error code is for backward compatibility with
+ * earlier versions.
+ */
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+
+ }
+ finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ finfo->fileCreator = creator;
+ finfo->fileType = type;
+
+ err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+ }
+
Py_INCREF(Py_None);
return Py_None;
}
@@ -375,6 +458,7 @@
/* And try again... */
h = GetResource('Estr', err);
}
+ Py_DECREF(m);
}
}
/*
@@ -398,6 +482,9 @@
return Py_BuildValue("s", buf);
}
+
+#ifndef __LP64__
+
static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
static PyObject *
@@ -416,7 +503,7 @@
return NULL;
olddialog = curdialog;
curdialog = NULL;
-
+
if ( resid != -1 ) {
curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
if ( curdialog ) {
@@ -451,11 +538,13 @@
if (!PyArg_ParseTuple(args, "O&|O", PyMac_GetStr255, message, &object))
return NULL;
+
DebugStr(message);
Py_INCREF(Py_None);
return Py_None;
}
+
static char SysBeep_doc[] = "BEEEEEP!!!";
static PyObject *
@@ -470,6 +559,8 @@
return Py_None;
}
+#endif /* __LP64__ */
+
static char WMAvailable_doc[] =
"True if this process can interact with the display."
"Will foreground the application on the first call as a side-effect."
@@ -529,51 +620,37 @@
{
OSErr err;
char *mode = "r";
- FSSpec fss;
- SignedByte permission = 1;
+ FSRef ref;
+ SInt8 permission = fsRdPerm;
rfobject *fp;
+ HFSUniStr255 name;
- if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode))
+ if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
return NULL;
while (*mode) {
switch (*mode++) {
case '*': break;
- case 'r': permission = 1; break;
- case 'w': permission = 2; break;
+ case 'r': permission = fsRdPerm; break;
+ case 'w': permission = fsWrPerm; break;
case 'b': break;
default:
PyErr_BadArgument();
return NULL;
}
}
+
+ err = FSGetResourceForkName(&name);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
if ( (fp = newrfobject()) == NULL )
return NULL;
-
- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
+
- if ( err == fnfErr ) {
- /* In stead of doing complicated things here to get creator/type
- ** correct we let the standard i/o library handle it
- */
- FILE *tfp;
- char pathname[PATHNAMELEN];
-
- if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) {
- PyMac_Error(err);
- Py_DECREF(fp);
- return NULL;
- }
-
- if ( (tfp = fopen(pathname, "w")) == NULL ) {
- PyMac_Error(fnfErr); /* What else... */
- Py_DECREF(fp);
- return NULL;
- }
- fclose(tfp);
- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
- }
- if ( err ) {
+ err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
+ if (err != noErr) {
Py_DECREF(fp);
PyMac_Error(err);
return NULL;
@@ -583,15 +660,18 @@
}
+
static PyMethodDef MacOS_Methods[] = {
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
{"GetErrorString", MacOS_GetErrorString, 1, geterr_doc},
{"openrf", MacOS_openrf, 1, openrf_doc},
+#ifndef __LP64__
{"splash", MacOS_splash, 1, splash_doc},
{"DebugStr", MacOS_DebugStr, 1, DebugStr_doc},
- {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
+#endif /* __LP64__ */
+ {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
{NULL, NULL} /* Sentinel */
};
@@ -0,0 +1,20 @@
--- Python/mactoolboxglue.c 2006-10-08 19:41:25.000000000 +0200
+++ Python/mactoolboxglue.c 2009-09-05 01:25:57.000000000 +0200
@@ -414,7 +414,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
-
+/*
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -427,7 +427,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
-
+*/
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")
GLUE_NEW(Handle, OptResObj_New, "Carbon.Res")
@@ -0,0 +1,18 @@
--- Include/pymactoolbox.h 2004-11-05 08:02:59.000000000 +0100
+++ Include/pymactoolbox.h 2009-09-05 01:26:30.000000000 +0200
@@ -134,6 +134,7 @@
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
/* Qt exports */
+/*
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +147,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+*/
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -0,0 +1,46 @@
--- setup.py.orig 2006-10-08 11:41:25.000000000 -0600
+++ setup.py 2008-11-19 22:13:50.000000000 -0700
@@ -15,7 +15,7 @@
from distutils.command.install_lib import install_lib
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ["readline"]
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -246,11 +246,11 @@
# Add paths to popular package managers on OS X/darwin
if sys.platform == "darwin":
# Fink installs into /sw by default
- add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
- add_dir_to_list(self.compiler.include_dirs, '/sw/include')
+ #add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
+ #add_dir_to_list(self.compiler.include_dirs, '/sw/include')
# DarwinPorts installs into /opt/local by default
- #add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
- #add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')
+ add_dir_to_list(self.compiler.library_dirs, '__PREFIX__/lib')
+ add_dir_to_list(self.compiler.include_dirs, '__PREFIX__/include')
if os.path.normpath(sys.prefix) != '/usr':
add_dir_to_list(self.compiler.library_dirs,
@@ -357,7 +357,7 @@
exts.append( Extension('unicodedata', ['unicodedata.c']) )
# access to ISO C locale support
data = open('pyconfig.h').read()
- m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data)
+ m = re.search(r"#\s*define\s+(HAVE_LIBINTL_H|WITH_LIBINTL)\s+1\s*", data)
if m is not None:
locale_libs = ['intl']
else:
@@ -954,7 +954,8 @@
self.extensions.extend(exts)
# Call the method for detecting whether _tkinter can be compiled
- self.detect_tkinter(inc_dirs, lib_dirs)
+ if ("--disable-tk" not in sysconfig.get_config_var("CONFIG_ARGS")):
+ self.detect_tkinter(inc_dirs, lib_dirs)
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
# The _tkinter module, using frameworks. Since frameworks are quite
@@ -0,0 +1,2 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -0,0 +1,12 @@
bin/python2.4
bin/pythonw2.4
-
bin/idle2.4
bin/pydoc2.4
bin/smtpd2.4.py
-
share/man/man1/python2.4.1.gz
${frameworks_dir}/Python.framework/Versions/2.4
${frameworks_dir}/Python.framework/Versions/2.4/Headers
${frameworks_dir}/Python.framework/Versions/2.4/Resources
${frameworks_dir}/Python.framework/Versions/2.4/Python
@@ -0,0 +1,34 @@
--- Include/pyport.h.orig 2007-03-12 23:26:06.000000000 -0700
+++ Include/pyport.h 2007-03-12 23:29:35.000000000 -0700
@@ -152,11 +152,23 @@ typedef PY_LONG_LONG Py_intptr_t;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
#include <sys/types.h>
#endif
+
+#if (defined __APPLE__) && (!defined _POSIX_C_SOURCE)
+#define TEMPORARILY_DEFINING__POSIX_C_SOURCE /* so we can #undef it later */
+#define _POSIX_C_SOURCE /* avoid deprecated struct ostat in sys/stat.h */
+#endif
+
#include <sys/stat.h>
#elif defined(HAVE_STAT_H)
#include <stat.h>
#endif
+/* Mac OS X: undefine _POSIX_C_SOURCE if it wasn't defined before */
+#ifdef TEMPORARILY_DEFINING__POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#undef TEMPORARILY_DEFINING__POSIX_C_SOURCE
+#endif
+
#if defined(PYCC_VACPP)
/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
@@ -393,6 +405,7 @@ extern char * _getpty(int *, int, mode_t
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
functions, even though they are included in libutil. */
#include <termios.h>
+struct winsize;
extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
extern int forkpty(int *, char *, struct termios *, struct winsize *);
#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
@@ -0,0 +1,18 @@
--- Lib/cgi.py.orig 2006-08-11 09:14:38.000000000 +0200
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
+#! __PREFIX__/bin/python2.4
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
-# intentionally NOT "/usr/bin/env python". On many systems
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
-# scripts, and /usr/local/bin is the default directory where Python is
-# installed, so /usr/bin/env would be unable to find python. Granted,
-# binary installations by Linux vendors often install Python in
-# /usr/bin. So let those vendors patch cgi.py to match their choice
-# of installation.
+# NOTE: /usr/local/bin/python patched for MacPorts installation
"""Support module for CGI (Common Gateway Interface) scripts.
@@ -0,0 +1,10 @@
--- Lib/site.py Tue Jul 20 04:28:28 2004
+++ Lib/site.py.new Mon Apr 4 10:47:12 2005
@@ -186,6 +186,7 @@
else:
sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
if sys.platform == 'darwin':
+ sitedirs.append( os.path.join('__PREFIX__', 'lib', 'python2.4', 'site-packages') )
# for framework builds *only* we add the standard Apple
# locations. Currently only per-user, but /Library and
# /Network/Library could be added too
@@ -0,0 +1,11 @@
--- Mac/OSX/IDLE/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/IDLE/Makefile.in 2007-04-27 13:27:07.000000000 -0700
@@ -21,7 +21,7 @@
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
+PYTHONAPPSDIR=__APPLICATIONS_DIR__/MacPython $(VERSION)
all: IDLE.app
@@ -0,0 +1,20 @@
--- Mac/OSX/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/Makefile.in 2007-04-27 11:07:02.000000000 -0700
@@ -5,7 +5,7 @@
VERSION=@VERSION@
builddir = ../..
srcdir = @srcdir@
-prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
+prefix=__FRAMEWORKS_DIR__/Python.framework/Versions/$(VERSION)
LIBDEST=$(prefix)/lib/python$(VERSION)
BUILDPYTHON=$(builddir)/python.exe
RUNSHARED= @RUNSHARED@
@@ -16,7 +16,7 @@
# These are normally glimpsed from the previous set
bindir=@exec_prefix@/bin
-PYTHONAPPSPATH=/Applications/MacPython $(VERSION)
+PYTHONAPPSPATH=__APPLICATIONS_DIR__/MacPython $(VERSION)
PYTHONAPPSDIR=$(PYTHONAPPSPATH)
APPINSTALLDIR=$(prefix)/Resources/Python.app
@@ -0,0 +1,20 @@
--- Mac/OSX/PythonLauncher/Makefile.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Mac/OSX/PythonLauncher/Makefile.in 2007-04-27 13:33:26.000000000 -0700
@@ -20,7 +20,7 @@
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
-PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
+PYTHONAPPSDIR=__APPLICATIONS_DIR__/MacPython $(VERSION)
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
all: PythonLauncher.app
@@ -56,7 +56,7 @@
--resource=$(srcdir)/factorySettings.plist \
--plist=$(srcdir)/Info.plist \
build
- find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r
+ find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r || :
FileSettings.o: $(srcdir)/FileSettings.m
@@ -0,0 +1,11 @@
--- Makefile.pre.in.orig 2006-10-08 10:41:25.000000000 -0700
+++ Makefile.pre.in 2007-04-20 18:06:11.000000000 -0700
@@ -56,7 +56,7 @@
OPT= @OPT@
BASECFLAGS= @BASECFLAGS@
CFLAGS= $(BASECFLAGS) $(OPT)
-CPPFLAGS= -I. -I$(srcdir)/Include
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir)/Include
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
SGI_ABI= @SGI_ABI@
@@ -0,0 +1,25 @@
--- configure.orig 2007-04-05 21:32:57.000000000 -0700
+++ configure 2007-04-05 21:32:59.000000000 -0700
@@ -3907,7 +3907,12 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ if [[ `/usr/bin/arch` = 'ppc' ]]
+ then
+ BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+ else
+ BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+ fi
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
@@ -10328,7 +10333,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only ppc'
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only '`/usr/bin/arch`
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -0,0 +1,20 @@
--- configure.orig 2009-08-31 01:54:27.000000000 +1000
+++ configure 2009-08-31 01:55:24.000000000 +1000
@@ -10321,7 +10321,7 @@
Darwin/[01234567].*)
LIBTOOL_CRUFT="-framework System -lcc_dynamic"
if test -z "${enable_universalsdk}"; then
- LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+ LIBTOOL_CRUFT="${LIBTOOL_CRUFT}"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -10333,7 +10333,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only '`/usr/bin/arch`
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
esac
@@ -0,0 +1,14 @@
--- configure.orig 2009-08-31 01:29:04.000000000 +1000
+++ configure 2009-08-31 01:30:05.000000000 +1000
@@ -3909,9 +3909,9 @@
Darwin*)
if [[ `/usr/bin/arch` = 'ppc' ]]
then
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common"
+ BASECFLAGS="$BASECFLAGS -mno-fused-madd -fno-common"
else
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -fno-common"
+ BASECFLAGS="$BASECFLAGS -fno-common"
fi
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
@@ -0,0 +1,427 @@
--- Mac/Modules/macosmodule.c 2004-11-05 08:02:59.000000000 +0100
+++ Mac/Modules/macosmodule.c 2009-09-05 02:07:14.000000000 +0200
@@ -40,7 +40,7 @@
typedef struct {
PyObject_HEAD
- short fRefNum;
+ FSIORefNum fRefNum;
int isclosed;
} rfobject;
@@ -54,7 +54,7 @@
do_close(rfobject *self)
{
if (self->isclosed ) return;
- (void)FSClose(self->fRefNum);
+ (void)FSCloseFork(self->fRefNum);
self->isclosed = 1;
}
@@ -68,6 +68,7 @@
long n;
PyObject *v;
OSErr err;
+ ByteCount n2;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
@@ -81,13 +82,13 @@
if (v == NULL)
return NULL;
- err = FSRead(self->fRefNum, &n, PyString_AsString(v));
+ err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
if (err && err != eofErr) {
PyMac_Error(err);
Py_DECREF(v);
return NULL;
}
- _PyString_Resize(&v, n);
+ _PyString_Resize(&v, n2);
return v;
}
@@ -109,7 +110,7 @@
}
if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
return NULL;
- err = FSWrite(self->fRefNum, &size, buffer);
+ err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
if (err) {
PyMac_Error(err);
return NULL;
@@ -126,47 +127,36 @@
static PyObject *
rf_seek(rfobject *self, PyObject *args)
{
- long amount, pos;
+ long amount;
int whence = SEEK_SET;
- long eof;
+ int mode;
OSErr err;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
return NULL;
}
- if (!PyArg_ParseTuple(args, "l|i", &amount, &whence))
+ if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) {
return NULL;
-
- if ((err = GetEOF(self->fRefNum, &eof)))
- goto ioerr;
+ }
switch (whence) {
case SEEK_CUR:
- if ((err = GetFPos(self->fRefNum, &pos)))
- goto ioerr;
+ mode = fsFromMark;
break;
case SEEK_END:
- pos = eof;
+ mode = fsFromLEOF;
break;
case SEEK_SET:
- pos = 0;
+ mode = fsFromStart;
break;
default:
PyErr_BadArgument();
return NULL;
}
-
- pos += amount;
-
- /* Don't bother implementing seek past EOF */
- if (pos > eof || pos < 0) {
- PyErr_BadArgument();
- return NULL;
- }
-
- if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
-ioerr:
+
+ err = FSSetForkPosition(self->fRefNum, mode, amount);
+ if (err != noErr) {
PyMac_Error(err);
return NULL;
}
@@ -182,7 +172,7 @@
static PyObject *
rf_tell(rfobject *self, PyObject *args)
{
- long where;
+ long long where;
OSErr err;
if (self->isclosed) {
@@ -191,11 +181,13 @@
}
if (!PyArg_ParseTuple(args, ""))
return NULL;
- if ((err = GetFPos(self->fRefNum, &where)) ) {
+
+ err = FSGetForkPosition(self->fRefNum, &where);
+ if (err != noErr) {
PyMac_Error(err);
return NULL;
}
- return PyInt_FromLong(where);
+ return PyLong_FromLongLong(where);
}
static char rf_close__doc__[] =
@@ -281,6 +273,7 @@
Rftype__doc__ /* Documentation string */
};
+
/* End of code for Resource fork objects */
/* -------------------------------------------------------- */
@@ -292,17 +285,61 @@
static PyObject *
MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
{
- FSSpec fss;
- FInfo info;
PyObject *creator, *type, *res;
OSErr err;
-
- if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+ FSRef ref;
+ FSCatalogInfo cataloginfo;
+ FileInfo* finfo;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) {
+#ifndef __LP64__
+ /* This function is documented to take an FSSpec as well,
+ * which only works in 32-bit mode.
+ */
+ PyErr_Clear();
+ FSSpec fss;
+ FInfo info;
+
+ if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
+ return NULL;
+
+ if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
+ return PyErr_Mac(MacOS_Error, err);
+ }
+ creator = PyString_FromStringAndSize(
+ (char *)&info.fdCreator, 4);
+ type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+ res = Py_BuildValue("OO", creator, type);
+ Py_DECREF(creator);
+ Py_DECREF(type);
+ return res;
+#else /* __LP64__ */
+ return NULL;
+#endif /* __LP64__ */
+ }
+
+ err = FSGetCatalogInfo(&ref,
+ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
+ NULL, NULL, NULL);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, err);
return NULL;
- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
- creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4);
- type = PyString_FromStringAndSize((char *)&info.fdType, 4);
+ }
+
+ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+ /* Directory: doesn't have type/creator info.
+ *
+ * The specific error code is for backward compatibility with
+ * earlier versions.
+ */
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+
+ }
+ finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
+ type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);
+
res = Py_BuildValue("OO", creator, type);
Py_DECREF(creator);
Py_DECREF(type);
@@ -314,20 +351,66 @@
static PyObject *
MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
{
- FSSpec fss;
ResType creator, type;
- FInfo info;
+ FSRef ref;
+ FileInfo* finfo;
OSErr err;
-
+ FSCatalogInfo cataloginfo;
+
if (!PyArg_ParseTuple(args, "O&O&O&",
+ PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) {
+#ifndef __LP64__
+ /* Try to handle FSSpec arguments, for backward compatibility */
+ FSSpec fss;
+ FInfo info;
+
+ if (!PyArg_ParseTuple(args, "O&O&O&",
PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
+ return NULL;
+
+ if ((err = FSpGetFInfo(&fss, &info)) != noErr)
+ return PyErr_Mac(MacOS_Error, err);
+
+ info.fdCreator = creator;
+ info.fdType = type;
+
+ if ((err = FSpSetFInfo(&fss, &info)) != noErr)
+ return PyErr_Mac(MacOS_Error, err);
+ Py_INCREF(Py_None);
+ return Py_None;
+#else /* __LP64__ */
return NULL;
- if ((err = FSpGetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
- info.fdCreator = creator;
- info.fdType = type;
- if ((err = FSpSetFInfo(&fss, &info)) != noErr)
- return PyErr_Mac(MacOS_Error, err);
+#endif /* __LP64__ */
+ }
+
+ err = FSGetCatalogInfo(&ref,
+ kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
+ NULL, NULL, NULL);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, err);
+ return NULL;
+ }
+
+ if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
+ /* Directory: doesn't have type/creator info.
+ *
+ * The specific error code is for backward compatibility with
+ * earlier versions.
+ */
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+
+ }
+ finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ finfo->fileCreator = creator;
+ finfo->fileType = type;
+
+ err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo);
+ if (err != noErr) {
+ PyErr_Mac(MacOS_Error, fnfErr);
+ return NULL;
+ }
+
Py_INCREF(Py_None);
return Py_None;
}
@@ -375,6 +458,7 @@
/* And try again... */
h = GetResource('Estr', err);
}
+ Py_DECREF(m);
}
}
/*
@@ -398,6 +482,9 @@
return Py_BuildValue("s", buf);
}
+
+#ifndef __LP64__
+
static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
static PyObject *
@@ -416,7 +503,7 @@
return NULL;
olddialog = curdialog;
curdialog = NULL;
-
+
if ( resid != -1 ) {
curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
if ( curdialog ) {
@@ -451,11 +538,13 @@
if (!PyArg_ParseTuple(args, "O&|O", PyMac_GetStr255, message, &object))
return NULL;
+
DebugStr(message);
Py_INCREF(Py_None);
return Py_None;
}
+
static char SysBeep_doc[] = "BEEEEEP!!!";
static PyObject *
@@ -470,6 +559,8 @@
return Py_None;
}
+#endif /* __LP64__ */
+
static char WMAvailable_doc[] =
"True if this process can interact with the display."
"Will foreground the application on the first call as a side-effect."
@@ -529,51 +620,37 @@
{
OSErr err;
char *mode = "r";
- FSSpec fss;
- SignedByte permission = 1;
+ FSRef ref;
+ SInt8 permission = fsRdPerm;
rfobject *fp;
+ HFSUniStr255 name;
- if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode))
+ if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
return NULL;
while (*mode) {
switch (*mode++) {
case '*': break;
- case 'r': permission = 1; break;
- case 'w': permission = 2; break;
+ case 'r': permission = fsRdPerm; break;
+ case 'w': permission = fsWrPerm; break;
case 'b': break;
default:
PyErr_BadArgument();
return NULL;
}
}
+
+ err = FSGetResourceForkName(&name);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return NULL;
+ }
if ( (fp = newrfobject()) == NULL )
return NULL;
-
- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
+
- if ( err == fnfErr ) {
- /* In stead of doing complicated things here to get creator/type
- ** correct we let the standard i/o library handle it
- */
- FILE *tfp;
- char pathname[PATHNAMELEN];
-
- if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) {
- PyMac_Error(err);
- Py_DECREF(fp);
- return NULL;
- }
-
- if ( (tfp = fopen(pathname, "w")) == NULL ) {
- PyMac_Error(fnfErr); /* What else... */
- Py_DECREF(fp);
- return NULL;
- }
- fclose(tfp);
- err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
- }
- if ( err ) {
+ err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
+ if (err != noErr) {
Py_DECREF(fp);
PyMac_Error(err);
return NULL;
@@ -583,15 +660,18 @@
}
+
static PyMethodDef MacOS_Methods[] = {
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
{"GetErrorString", MacOS_GetErrorString, 1, geterr_doc},
{"openrf", MacOS_openrf, 1, openrf_doc},
+#ifndef __LP64__
{"splash", MacOS_splash, 1, splash_doc},
{"DebugStr", MacOS_DebugStr, 1, DebugStr_doc},
- {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
+#endif /* __LP64__ */
+ {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
{NULL, NULL} /* Sentinel */
};
@@ -0,0 +1,20 @@
--- Python/mactoolboxglue.c 2006-10-08 19:41:25.000000000 +0200
+++ Python/mactoolboxglue.c 2009-09-05 01:25:57.000000000 +0200
@@ -414,7 +414,7 @@
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
-
+/*
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@@ -427,7 +427,7 @@
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
-
+*/
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")
GLUE_NEW(Handle, OptResObj_New, "Carbon.Res")
@@ -0,0 +1,18 @@
--- Include/pymactoolbox.h 2004-11-05 08:02:59.000000000 +0100
+++ Include/pymactoolbox.h 2009-09-05 01:26:30.000000000 +0200
@@ -134,6 +134,7 @@
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
/* Qt exports */
+/*
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@@ -146,6 +147,7 @@
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
+*/
/* Res exports */
extern PyObject *ResObj_New(Handle);
@@ -0,0 +1,46 @@
--- setup.py.orig 2006-10-08 11:41:25.000000000 -0600
+++ setup.py 2008-11-19 22:13:50.000000000 -0700
@@ -15,7 +15,7 @@
from distutils.command.install_lib import install_lib
# This global variable is used to hold the list of modules to be disabled.
-disabled_module_list = []
+disabled_module_list = ["readline"]
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -246,11 +246,11 @@
# Add paths to popular package managers on OS X/darwin
if sys.platform == "darwin":
# Fink installs into /sw by default
- add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
- add_dir_to_list(self.compiler.include_dirs, '/sw/include')
+ #add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
+ #add_dir_to_list(self.compiler.include_dirs, '/sw/include')
# DarwinPorts installs into /opt/local by default
- #add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
- #add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')
+ add_dir_to_list(self.compiler.library_dirs, '__PREFIX__/lib')
+ add_dir_to_list(self.compiler.include_dirs, '__PREFIX__/include')
if os.path.normpath(sys.prefix) != '/usr':
add_dir_to_list(self.compiler.library_dirs,
@@ -357,7 +357,7 @@
exts.append( Extension('unicodedata', ['unicodedata.c']) )
# access to ISO C locale support
data = open('pyconfig.h').read()
- m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data)
+ m = re.search(r"#\s*define\s+(HAVE_LIBINTL_H|WITH_LIBINTL)\s+1\s*", data)
if m is not None:
locale_libs = ['intl']
else:
@@ -954,7 +954,8 @@
self.extensions.extend(exts)
# Call the method for detecting whether _tkinter can be compiled
- self.detect_tkinter(inc_dirs, lib_dirs)
+ if ("--disable-tk" not in sysconfig.get_config_var("CONFIG_ARGS")):
+ self.detect_tkinter(inc_dirs, lib_dirs)
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
# The _tkinter module, using frameworks. Since frameworks are quite
@@ -0,0 +1,2 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -0,0 +1,12 @@
bin/python2.4
bin/pythonw2.4
-
bin/idle2.4
bin/pydoc2.4
bin/smtpd2.4.py
-
share/man/man1/python2.4.1.gz
${frameworks_dir}/Python.framework/Versions/2.4
${frameworks_dir}/Python.framework/Versions/2.4/Headers
${frameworks_dir}/Python.framework/Versions/2.4/Resources
${frameworks_dir}/Python.framework/Versions/2.4/Python
+15 -1
View File
@@ -8,6 +8,7 @@ from pythonbrew.define import PATH_BIN, PATH_PYTHONS
from pythonbrew.exceptions import BuildingException
from pythonbrew.log import logger
import tarfile
import platform
def size_format(b):
kb = 1000
@@ -50,7 +51,20 @@ def is_gzip(content_type, filename):
or splitext(filename)[1].lower() in ('.tar', '.tar.gz', '.tar.bz2', '.tgz', '.tbz')):
return True
return False
def is_macosx_snowleopard():
mac_ver = platform.mac_ver()[0]
return mac_ver >= '10.6' and mac_ver < '10.7'
def is_python24(version):
return version >= '2.4' and version < '2.5'
def is_python25(version):
return version >= '2.5' and version < '2.6'
def is_python26(version):
return version >= '2.6' and version < '2.7'
def makedirs(path):
try:
os.makedirs(path)