bug fix. Added PythonInstaller class.

This commit is contained in:
utahta
2010-11-13 21:24:37 +09:00
parent b357cc13ff
commit 97b101f33c
43 changed files with 4458 additions and 167 deletions
+1
View File
@@ -35,6 +35,7 @@ Install some Pythons::
pythonbrew install Python-2.5.5
pythonbrew install --configure="CC=gcc_4.1" Python-2.6.6
pythonbrew install --no-setuptools Python-2.6.6
pythonbrew install http://www.python.org/ftp/python/2.7/Python-2.7.tgz
Switch python in the $PATH::
+2 -145
View File
@@ -1,13 +1,6 @@
import os
import sys
import re
import shutil
from pythonbrew.basecommand import Command
from pythonbrew.util import unlink, splitext, Subprocess, Package, makedirs,\
rm_r
from pythonbrew.define import ROOT, PATH_PYTHONS, PATH_DISTS, PATH_BUILD, PATH_LOG, DISTRIBUTE_SETUP_DLSITE
from pythonbrew.log import logger
from pythonbrew.downloader import get_python_package_url, Downloader
from pythonbrew.installer import PythonInstaller
class InstallCommand(Command):
name = "install"
@@ -37,148 +30,12 @@ class InstallCommand(Command):
default=False,
help="Skip installation of setuptools."
)
self._logfile = "%s/build.log" % PATH_LOG
def run_command(self, options, args):
if args:
# Install Python
self._install_python(args[0], options)
PythonInstaller(args[0], options).install()
else:
logger.error("Package not found.")
def _install_python(self, dist, options):
pkg = Package(dist)
distname = self._download_package(pkg)
pkgname = pkg.name
version = pkg.version
install_dir = "%s/%s" % (PATH_PYTHONS, pkgname)
configure = "--prefix=%s %s" % (install_dir, options.configure)
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("")
try:
s = Subprocess(log=self._logfile, shell=True, cwd=PATH_BUILD, print_cmd=False)
logger.info("Extracting %s" % distname)
s.check_call(self._get_uncompress_command(distname))
logger.info("Installing %s into %s" % (pkgname, install_dir))
s.chdir("%s/%s" % (PATH_BUILD, pkgname))
s.check_call("./configure %s" % (configure))
if options.force:
s.check_call("make")
else:
s.check_call("make")
s.check_call("make test")
if version == "1.5.2" or version == "1.6.1":
makedirs(install_dir)
s.check_call("make install")
except:
rm_r(install_dir)
logger.error("""Failed to install %(pkgname)s. See %(ROOT)s/build.log to see why.
pythonbrew install --force %(version)s""" % {"pkgname":pkgname, "ROOT":ROOT, "version":version})
sys.exit(1)
# install setuptools
self._install_setuptools(pkgname, options.no_setuptools)
logger.info("""
Installed %(pkgname)s successfully. Run the following command to switch to %(pkgname)s.
pythonbrew switch %(version)s""" % {"pkgname":pkgname, "version":version})
def _download_package(self, pkg):
pkgname = pkg.name
version = pkg.version
if os.path.isdir("%s/%s" % (PATH_PYTHONS, pkgname)):
logger.error("You are already installed `%s`." % pkgname)
sys.exit(1)
download_url = get_python_package_url(version)
if not download_url:
logger.error("Unknown package: `%s`" % pkgname)
sys.exit(1)
distname = os.path.basename(download_url)
download_path = "%s/%s" % (PATH_DISTS, distname)
if os.path.isfile(download_path):
logger.info("Use the previously fetched %s" % (download_path))
else:
try:
dl = Downloader()
dl.download(
distname,
download_url,
download_path
)
except:
unlink(download_path)
logger.info("\nInterrupt to abort. `%s`" % (download_url))
sys.exit(1)
# iffy
if os.path.getsize(download_path) < 1000000:
logger.error("Failed to download. `%s`" % (download_url))
unlink(download_path)
sys.exit(1)
return distname
def _get_uncompress_command(self, basename):
distpath = "%s/%s" % (PATH_DISTS, basename)
if os.path.isfile(distpath):
ext = splitext(basename)[1]
if ext == ".tar.gz" or ext == ".tgz":
return "tar zxf %s" % (distpath)
elif ext == ".tar.bz2":
return "tar jxf %s" % (distpath)
elif ext == ".tar":
return "tar xf %s" % (distpath)
elif ext == ".zip":
return "unzip %s" % (distpath)
elif os.path.isdir(distpath):
return "mv %s %s/%s" % (distpath, PATH_BUILD, basename)
else:
logger.error("File not found. `%s`" % (basename))
return ""
def _install_setuptools(self, pkgname, no_setuptools):
if no_setuptools:
logger.info("Skip installation setuptools.")
return
if re.match("^Python-3.*", pkgname):
is_python3 = True
else:
is_python3 = False
download_url = DISTRIBUTE_SETUP_DLSITE
basename = os.path.basename(download_url)
dl = Downloader()
dl.download(basename, download_url, "%s/%s" % (PATH_DISTS, basename))
install_dir = "%s/%s" % (PATH_PYTHONS, pkgname)
if is_python3:
if os.path.isfile("%s/bin/python3" % (install_dir)):
pyexec = "%s/bin/python3" % (install_dir)
elif os.path.isfile("%s/bin/python3.0" % (install_dir)):
pyexec = "%s/bin/python3.0" % (install_dir)
else:
logger.error("Python3 binary not found. `%s`" % (install_dir))
return
else:
pyexec = "%s/bin/python" % (install_dir)
try:
s = Subprocess(log=self._logfile, shell=True, cwd=PATH_DISTS, print_cmd=False)
logger.info("Installing distribute into %s" % install_dir)
s.check_call("%s %s" % (pyexec, basename))
if os.path.isfile("%s/bin/easy_install" % (install_dir)) and not is_python3:
logger.info("Installing pip into %s" % install_dir)
s.check_call("%s/bin/easy_install pip" % (install_dir), cwd=None)
except:
logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
logger.info("Skip install setuptools.")
InstallCommand()
+1 -1
View File
@@ -18,7 +18,7 @@ class UpdateCommand(Command):
version = args[0]
# check for latest version
if version == VERSION:
if version <= VERSION:
logger.info("You are already running the installed latest version of pythonbrew.")
sys.exit()
+7 -2
View File
@@ -18,6 +18,9 @@ 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
# file path
PATH_BIN_PYTHONBREW = "%s/pythonbrew" % PATH_BIN
@@ -28,7 +31,8 @@ DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py"
# download pythonbrew url
PYTHONBREW_UPDATE_URL = {
"head": "http://github.com/utahta/pythonbrew/tarball/master"
"head": "http://github.com/utahta/pythonbrew/tarball/master",
"0.5": "https://github.com/utahta/pythonbrew/tarball/0.5",
}
PYTHONBREW_DIRNAME = "utahta-pythonbrew"
@@ -46,11 +50,12 @@ _PYTHON_PACKAGE_VERSIONS = [
"2.6", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6",
"2.7",
"3.0", "3.0.1",
"3.1", "3.1.1", "3.1.2",
"3.1", "3.1.1", "3.1.2",
]
for version in _PYTHON_PACKAGE_VERSIONS:
PYTHON_PACKAGE_URL[version] = "http://www.python.org/ftp/python/%s/Python-%s.tgz" % (version, version)
del _PYTHON_PACKAGE_VERSIONS
PYTHON_PACKAGE_URL["3.2a1"] = "http://www.python.org/ftp/python/3.2/Python-3.2a1.tgz"
PYTHON_PACKAGE_URL["3.2a2"] = "http://www.python.org/ftp/python/3.2/Python-3.2a2.tgz"
PYTHON_PACKAGE_URL["3.2a3"] = "http://www.python.org/ftp/python/3.2/Python-3.2a3.tgz"
+14
View File
@@ -1,7 +1,21 @@
import sys
import urllib
import urllib2
from pythonbrew.util import size_format
from pythonbrew.define import PYTHON_PACKAGE_URL, PYTHONBREW_UPDATE_URL
from pythonbrew.log import logger
def get_response_from_url(url):
try:
resp = urllib2.urlopen(url)
except urllib2.HTTPError, e:
logger.error("HTTP error %s while getting %s" % (e.code))
raise
except IOError, e:
# Typically an FTP error
logger.error("Error %s while getting %s" % (e))
raise
return resp
class Downloader(object):
def __init__(self):
+152 -6
View File
@@ -2,11 +2,16 @@ import os
import sys
import glob
import shutil
from pythonbrew.util import makedirs, symlink
import re
from pythonbrew.util import makedirs, symlink, Package, is_url, splitext, Link,\
unlink, is_gzip, is_html, untar_file, Subprocess, rm_r
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
PATH_BIN_PYBREW, ROOT, PATH_LOG, DISTRIBUTE_SETUP_DLSITE, PATH_PATCHES
from pythonbrew.downloader import get_python_package_url, Downloader,\
get_response_from_url
from pythonbrew.log import logger
def install_pythonbrew():
makedirs(PATH_PYTHONS)
@@ -18,14 +23,18 @@ 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):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW)
for path in glob.glob("%s/commands/*.py" % INSTALLER_ROOT):
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_COMMANDS)
fp = open("%s/pythonbrew.py" % PATH_SCRIPTS, "w")
# for path in glob.glob("%s/patches" % INSTALLER_ROOT):
# shutil.copytree(path, PATH_PATCHES)
fp = open("%s/pythonbrew_main.py" % PATH_SCRIPTS, "w")
fp.write("""import pythonbrew
if __name__ == "__main__":
pythonbrew.main()
@@ -34,7 +43,7 @@ if __name__ == "__main__":
fp = open(PATH_BIN_PYTHONBREW, "w")
fp.write("""#!/usr/bin/env bash
%s %s/pythonbrew.py "$@"
%s %s/pythonbrew_main.py "$@"
""" % (sys.executable, PATH_SCRIPTS))
fp.close()
os.chmod(PATH_BIN_PYTHONBREW, 0755)
@@ -42,5 +51,142 @@ if __name__ == "__main__":
os.system("echo 'export PATH=%s/bin:%s/current/bin:${PATH}' > %s/bashrc" % (ROOT, PATH_PYTHONS, PATH_ETC))
os.system("echo 'setenv PATH %s/bin:%s/current/bin:$PATH' > %s/cshrc" % (ROOT, PATH_PYTHONS, PATH_ETC))
class PythonInstaller(object):
def __init__(self, arg, options):
if is_url(arg):
self.download_url = arg
filename = Link(self.download_url).filename
pkg = Package(splitext(filename)[0])
else:
pkg = Package(arg)
self.download_url = get_python_package_url(pkg.version)
if not self.download_url:
logger.error("Unknown package: `%s`" % pkg.name)
sys.exit(1)
filename = Link(self.download_url).filename
self.pkg = pkg
self.install_dir = "%s/%s" % (PATH_PYTHONS, pkg.name)
self.build_dir = "%s/%s" % (PATH_BUILD, pkg.name)
self.download_file = "%s/%s" % (PATH_DISTS, filename)
resp = get_response_from_url(self.download_url)
self.content_type = resp.info()['content-type']
self.options = options
self.logfile = "%s/build.log" % PATH_LOG
def install(self):
if os.path.isdir(self.install_dir):
logger.info("You are already installed `%s`" % self.pkg.name)
sys.exit()
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()
logger.info("Installing %s into %s" % (self.pkg.name, self.install_dir))
try:
self.configure()
self.make()
self.make_install()
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)
sys.exit(1)
self.install_setuptools()
logger.info("Installed %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
% {"pkgname":self.pkg.name})
logger.info("")
logger.info(" pythonbrew switch %s" % self.pkg.version)
def download(self):
content_type = self.content_type
if is_html(content_type):
logger.error("Invalid content-type: `%s`" % content_type)
sys.exit(1)
if os.path.isfile(self.download_file):
logger.info("Use the previously fetched %s" % (self.download_file))
return
msg = Link(self.download_url).show_msg
try:
dl = Downloader()
dl.download(
msg,
self.download_url,
self.download_file
)
except:
unlink(self.download_file)
logger.info("\nInterrupt to abort. `%s`" % (self.download_url))
sys.exit(1)
def unpack(self):
logger.info("Extracting %s" % os.path.basename(self.download_file))
if is_gzip(self.content_type, self.download_file):
untar_file(self.download_file, self.build_dir)
else:
logger.error("Cannot determine archive format of %s" % self.download_file)
def configure(self):
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))
def make(self):
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
if self.options.force:
s.check_call("make")
else:
s.check_call("make")
s.check_call("make test")
def make_install(self):
version = self.pkg.version
if version == "1.5.2" or version == "1.6.1":
makedirs(self.install_dir)
s = Subprocess(log=self.logfile, shell=True, cwd=self.build_dir, print_cmd=False)
s.check_call("make install")
def install_setuptools(self):
options = self.options
pkgname = self.pkg.name
if options.no_setuptools:
logger.info("Skip installation setuptools.")
return
if re.match("^Python-3.*", pkgname):
is_python3 = True
else:
is_python3 = False
download_url = DISTRIBUTE_SETUP_DLSITE
filename = Link(download_url).filename
dl = Downloader()
dl.download(filename, download_url, "%s/%s" % (PATH_DISTS, filename))
install_dir = "%s/%s" % (PATH_PYTHONS, pkgname)
if is_python3:
if os.path.isfile("%s/bin/python3" % (install_dir)):
pyexec = "%s/bin/python3" % (install_dir)
elif os.path.isfile("%s/bin/python3.0" % (install_dir)):
pyexec = "%s/bin/python3.0" % (install_dir)
else:
logger.error("Python3 binary not found. `%s`" % (install_dir))
return
else:
pyexec = "%s/bin/python" % (install_dir)
try:
s = Subprocess(log=self.logfile, shell=True, cwd=PATH_DISTS, print_cmd=False)
logger.info("Installing distribute into %s" % install_dir)
s.check_call("%s %s" % (pyexec, filename))
if os.path.isfile("%s/bin/easy_install" % (install_dir)) and not is_python3:
logger.info("Installing pip into %s" % install_dir)
s.check_call("%s/bin/easy_install pip" % (install_dir), cwd=None)
except:
logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
logger.info("Skip install setuptools.")
+10 -10
View File
@@ -1,6 +1,14 @@
import sys
import logging
class LoggerInfo(object):
def log(self, level, msg, *arg, **keys):
sys.stdout.write("%s\n" % msg)
class LoggerError(object):
def log(self, level, msg, *arg, **keys):
sys.stderr.write("ERROR: %s\n" % msg)
class Logger(object):
DEBUG = logging.DEBUG
@@ -9,18 +17,10 @@ class Logger(object):
def __init__(self):
self._consumers = []
consumer = logging.getLogger('info')
consumer.setLevel(Logger.INFO)
hdlr = logging.StreamHandler(sys.stdout)
hdlr.setFormatter(logging.Formatter("%(message)s"))
consumer.addHandler(hdlr)
consumer = LoggerInfo()
self.add_consumer(Logger.INFO, consumer)
consumer = logging.getLogger('error')
consumer.setLevel(Logger.ERROR)
hdlr = logging.StreamHandler(sys.stderr)
hdlr.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
consumer.addHandler(hdlr)
consumer = LoggerError()
self.add_consumer(Logger.ERROR, consumer)
def debug(self, msg, *args, **keys):
@@ -0,0 +1,11 @@
K 25
svn:wc:ra_dav:version-url
V 62
/repository/macports/!svn/ver/69520/trunk/dports/lang/python25
END
Portfile
K 25
svn:wc:ra_dav:version-url
V 71
/repository/macports/!svn/ver/69520/trunk/dports/lang/python25/Portfile
END
@@ -0,0 +1,65 @@
10
dir
73426
http://svn.macports.org/repository/macports/trunk/dports/lang/python25
http://svn.macports.org/repository/macports
2010-07-08T20:19:52.476265Z
69520
jmr@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
files
dir
Portfile
file
2010-11-13T11:26:29.000000Z
ca4390c343e6a0ff2dff18fd4e3cc961
2010-07-08T20:19:52.476265Z
69520
jmr@macports.org
has-props
7650
@@ -0,0 +1,9 @@
K 13
svn:eol-style
V 6
native
K 12
svn:keywords
V 2
Id
END
@@ -0,0 +1,194 @@
# $Id$
PortSystem 1.0
PortGroup select 1.0
name python25
version 2.5.5
revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers jwa 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 http://ftp.python.org/ftp/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 1d00e2fb19418e486c30b850df625aa3 \
sha1 dcf1abd94a1ab4155dcd3668cca42c5bfc81159f \
rmd160 4754238d415142466778560d989582464385654c
# patch-Lib-distutils-dist.py.diff comes from
# <http://bugs.python.org/issue1180>
patchfiles 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
depends_lib port:gettext port:zlib port:openssl port:tk \
port:sqlite3 port:db46 port:bzip2 \
port:gdbm port:readline port:ncurses
configure.args --enable-shared \
--enable-framework=${frameworks_dir} \
--mandir=${prefix}/share/man \
--enable-ipv6 \
--with-cxx=${configure.cxx}
configure.cppflags-append -I${prefix}/include/ncurses
post-patch {
reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
${worksrcpath}/setup.py
reinplace "s|/Applications/MacPython|${applications_dir}/MacPython|g" \
${worksrcpath}/Mac/Makefile.in \
${worksrcpath}/Mac/IDLE/Makefile.in \
${worksrcpath}/Mac/Tools/Doc/setup.py \
${worksrcpath}/Mac/PythonLauncher/Makefile.in \
${worksrcpath}/Mac/BuildScript/build-installer.py
reinplace "s|xargs -0 rm -r|xargs -0 rm -rf|g" \
${worksrcpath}/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 ${prefix}/share ${destroot}${framewdir}/share
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}
}
# Fix incorrectly-pointed libpython2.5.a symlink, see
# http://trac.macports.org/ticket/19906
set python_staticlink ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
file delete ${python_staticlink}
ln -s ${framewdir}/Python ${python_staticlink}
}
}
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 {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 8 {
patchfiles-append patch-FSIORefNum.diff
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D_DARWIN_C_SOURCE
patchfiles-append patch-pyconfig.h.in.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/
}
}
configure.universal_archs i386 ppc
variant universal {
if {${configure.sdkroot} == ""} {
configure.args-append --enable-universalsdk=/
} else {
configure.args-append --enable-universalsdk=${configure.sdkroot}
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
+194
View File
@@ -0,0 +1,194 @@
# $Id: Portfile 69520 2010-07-08 20:19:52Z jmr@macports.org $
PortSystem 1.0
PortGroup select 1.0
name python25
version 2.5.5
revision 1
set branch [join [lrange [split ${version} .] 0 1] .]
categories lang
platforms darwin
maintainers jwa 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 http://ftp.python.org/ftp/python/${version}/
distname Python-${version}
use_bzip2 yes
checksums md5 1d00e2fb19418e486c30b850df625aa3 \
sha1 dcf1abd94a1ab4155dcd3668cca42c5bfc81159f \
rmd160 4754238d415142466778560d989582464385654c
# patch-Lib-distutils-dist.py.diff comes from
# <http://bugs.python.org/issue1180>
patchfiles 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
depends_lib port:gettext port:zlib port:openssl port:tk \
port:sqlite3 port:db46 port:bzip2 \
port:gdbm port:readline port:ncurses
configure.args --enable-shared \
--enable-framework=${frameworks_dir} \
--mandir=${prefix}/share/man \
--enable-ipv6 \
--with-cxx=${configure.cxx}
configure.cppflags-append -I${prefix}/include/ncurses
post-patch {
reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
${worksrcpath}/setup.py
reinplace "s|/Applications/MacPython|${applications_dir}/MacPython|g" \
${worksrcpath}/Mac/Makefile.in \
${worksrcpath}/Mac/IDLE/Makefile.in \
${worksrcpath}/Mac/Tools/Doc/setup.py \
${worksrcpath}/Mac/PythonLauncher/Makefile.in \
${worksrcpath}/Mac/BuildScript/build-installer.py
reinplace "s|xargs -0 rm -r|xargs -0 rm -rf|g" \
${worksrcpath}/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 ${prefix}/share ${destroot}${framewdir}/share
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}
}
# Fix incorrectly-pointed libpython2.5.a symlink, see
# http://trac.macports.org/ticket/19906
set python_staticlink ${destroot}${prefix}/lib/python${branch}/config/libpython${branch}.a
file delete ${python_staticlink}
ln -s ${framewdir}/Python ${python_staticlink}
}
}
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 {
post-configure {
# See http://trac.macports.org/ticket/18376
system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
}
}
platform darwin 8 {
patchfiles-append patch-FSIORefNum.diff
}
platform darwin 9 {
configure.cppflags-append -D__DARWIN_UNIX03
}
platform darwin 10 {
configure.cppflags-append -D_DARWIN_C_SOURCE
patchfiles-append patch-pyconfig.h.in.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/
}
}
configure.universal_archs i386 ppc
variant universal {
if {${configure.sdkroot} == ""} {
configure.args-append --enable-universalsdk=/
} else {
configure.args-append --enable-universalsdk=${configure.sdkroot}
}
}
livecheck.type regex
livecheck.url ${homepage}download/releases/
livecheck.regex Python (${branch}.\[0-9\]+)
@@ -0,0 +1,89 @@
K 25
svn:wc:ra_dav:version-url
V 68
/repository/macports/!svn/ver/60380/trunk/dports/lang/python25/files
END
patch-Misc-setuid-prog.c.diff
K 25
svn:wc:ra_dav:version-url
V 98
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-Misc-setuid-prog.c.diff
END
patch-FSIORefNum.diff
K 25
svn:wc:ra_dav:version-url
V 90
/repository/macports/!svn/ver/57516/trunk/dports/lang/python25/files/patch-FSIORefNum.diff
END
patch-Lib-cgi.py.diff
K 25
svn:wc:ra_dav:version-url
V 90
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-Lib-cgi.py.diff
END
patch-configure-arch_only.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/52864/trunk/dports/lang/python25/files/patch-configure-arch_only.diff
END
patch-Modules-posixmodule.c.diff
K 25
svn:wc:ra_dav:version-url
V 101
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-Modules-posixmodule.c.diff
END
patch-Lib-distutils-dist.py.diff
K 25
svn:wc:ra_dav:version-url
V 101
/repository/macports/!svn/ver/42997/trunk/dports/lang/python25/files/patch-Lib-distutils-dist.py.diff
END
patch-configure.diff
K 25
svn:wc:ra_dav:version-url
V 89
/repository/macports/!svn/ver/34379/trunk/dports/lang/python25/files/patch-configure.diff
END
pyconfig.ed
K 25
svn:wc:ra_dav:version-url
V 80
/repository/macports/!svn/ver/60380/trunk/dports/lang/python25/files/pyconfig.ed
END
python25
K 25
svn:wc:ra_dav:version-url
V 77
/repository/macports/!svn/ver/50424/trunk/dports/lang/python25/files/python25
END
patch-configure-badcflags.diff
K 25
svn:wc:ra_dav:version-url
V 99
/repository/macports/!svn/ver/40837/trunk/dports/lang/python25/files/patch-configure-badcflags.diff
END
patch-Makefile.pre.in.diff
K 25
svn:wc:ra_dav:version-url
V 95
/repository/macports/!svn/ver/43000/trunk/dports/lang/python25/files/patch-Makefile.pre.in.diff
END
patch-setup.py.diff
K 25
svn:wc:ra_dav:version-url
V 88
/repository/macports/!svn/ver/57388/trunk/dports/lang/python25/files/patch-setup.py.diff
END
patch-64bit.diff
K 25
svn:wc:ra_dav:version-url
V 85
/repository/macports/!svn/ver/57388/trunk/dports/lang/python25/files/patch-64bit.diff
END
patch-pyconfig.h.in.diff
K 25
svn:wc:ra_dav:version-url
V 93
/repository/macports/!svn/ver/55669/trunk/dports/lang/python25/files/patch-pyconfig.h.in.diff
END
@@ -0,0 +1,504 @@
10
dir
73426
http://svn.macports.org/repository/macports/trunk/dports/lang/python25/files
http://svn.macports.org/repository/macports
2009-11-10T14:40:06.347802Z
60380
jmr@macports.org
d073be05-634f-4543-b044-5fe20cf6d1d6
patch-Misc-setuid-prog.c.diff
file
2010-11-13T11:26:29.000000Z
2bc1e6606dde7390fd8240b131bdf4ec
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
410
patch-FSIORefNum.diff
file
2010-11-13T11:26:29.000000Z
8084ec041a99e7cb661772f009df15a7
2009-09-12T06:14:57.000179Z
57516
jmr@macports.org
399
patch-Lib-cgi.py.diff
file
2010-11-13T11:26:29.000000Z
82a8c9d18f4280a8bbb8a6cbf5868a8a
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
808
patch-configure-arch_only.diff
file
2010-11-13T11:26:29.000000Z
14c3bb850c180ab737a46d59bc82d6a0
2009-06-24T22:01:14.810769Z
52864
landonf@macports.org
941
patch-Modules-posixmodule.c.diff
file
2010-11-13T11:26:29.000000Z
10bf449d661c9721211c94b5c3acd7fb
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
571
patch-Lib-distutils-dist.py.diff
file
2010-11-13T11:26:29.000000Z
92eea653ba7debcbfd848b3e95fa664e
2008-12-03T05:16:31.085444Z
42997
blb@macports.org
2050
patch-configure.diff
file
2010-11-13T11:26:29.000000Z
758a0b524c7089e1367b9304628b7f33
2008-02-22T23:26:05.539782Z
34379
mww@macports.org
956
pyconfig.ed
file
2010-11-13T11:26:29.000000Z
674a4842ff1491cf7669c37d9b0b95bc
2009-11-10T14:40:06.347802Z
60380
jmr@macports.org
49
python25
file
2010-11-13T11:26:29.000000Z
00706fcdb40c3ab1242bd33ffcaecf00
2009-04-30T21:04:30.747761Z
50424
jmr@macports.org
340
patch-configure-badcflags.diff
file
2010-11-13T11:26:29.000000Z
0270e74fe78847844dbd13831777d22c
2008-10-16T01:47:43.712585Z
40837
toby@macports.org
460
patch-Makefile.pre.in.diff
file
2010-11-13T11:26:29.000000Z
715099f836a2265992b3b1842f05d2a2
2008-12-03T06:04:11.934031Z
43000
blb@macports.org
1449
patch-setup.py.diff
file
2010-11-13T11:26:29.000000Z
36831c5d2729aee54fe424ba32776ace
2009-09-10T13:23:37.201201Z
57388
jmr@macports.org
3814
patch-64bit.diff
file
2010-11-13T11:26:29.000000Z
5f7cfee7ab539a15e7997224f51e8b97
2009-09-10T13:23:37.201201Z
57388
jmr@macports.org
37004
patch-pyconfig.h.in.diff
file
2010-11-13T11:26:29.000000Z
df5999ec974fbe1a2716a63c882b4639
2009-08-16T18:17:13.357907Z
55669
landonf@macports.org
396
@@ -0,0 +1,11 @@
--- Mac/Modules/file/_Filemodule.c.orig 2009-09-12 15:55:59.000000000 +1000
+++ Mac/Modules/file/_Filemodule.c 2009-09-12 16:12:07.000000000 +1000
@@ -7,6 +7,8 @@
#include "pymactoolbox.h"
+typedef SInt16 FSIORefNum;
+
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \
@@ -0,0 +1,18 @@
--- Lib/cgi.py.orig 2006-08-10 19:41:07.000000000 +0200
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
+#! __PREFIX__/bin/python2.5
-# 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,51 @@
--- Lib/distutils/dist.py.orig 2005-03-23 11:54:36.000000000 -0700
+++ Lib/distutils/dist.py 2008-07-25 21:27:15.000000000 -0600
@@ -57,6 +57,7 @@
('quiet', 'q', "run quietly (turns verbosity off)"),
('dry-run', 'n', "don't actually do anything"),
('help', 'h', "show detailed help message"),
+ ('no-user-cfg', None,'ignore pydistutils.cfg in your home directory'),
]
# 'common_usage' is a short (2-3 line) string describing the common
@@ -264,6 +265,12 @@
else:
sys.stderr.write(msg + "\n")
+ # no-user-cfg is handled before other command line args
+ # because other args override the config files, and this
+ # one is needed before we can load the config files.
+ # If attrs['script_args'] wasn't passed, assume false.
+ self.want_user_cfg = '--no-user-cfg' not in (self.script_args or [])
+
self.finalize_options()
# __init__ ()
@@ -324,6 +331,9 @@
Distutils __inst__.py file lives), a file in the user's home
directory named .pydistutils.cfg on Unix and pydistutils.cfg
on Windows/Mac, and setup.cfg in the current directory.
+
+ The file in the user's home directory can be disabled with the
+ --no-user-cfg option.
"""
files = []
check_environ()
@@ -343,7 +353,7 @@
user_filename = "pydistutils.cfg"
# And look for the user config file
- if os.environ.has_key('HOME'):
+ if self.want_user_cfg and os.environ.has_key('HOME'):
user_file = os.path.join(os.environ.get('HOME'), user_filename)
if os.path.isfile(user_file):
files.append(user_file)
@@ -353,6 +363,8 @@
if os.path.isfile(local_file):
files.append(local_file)
+ if DEBUG:
+ print "using config files: %s" % ', '.join(files)
return files
# find_config_files ()
@@ -0,0 +1,31 @@
--- Makefile.pre.in.orig 2007-12-05 13:43:57.000000000 -0700
+++ Makefile.pre.in 2008-07-25 21:41:02.000000000 -0600
@@ -348,8 +348,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
case $$MAKEFLAGS in \
- *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q --no-user-cfg build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg build;; \
esac
# Build static library
@@ -894,7 +904,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall:
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
@@ -968,7 +978,7 @@
# This installs a few of the useful scripts in Tools/scripts
scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \
- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
+ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py --no-user-cfg install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--root=/$(DESTDIR)
@@ -0,0 +1,16 @@
--- Misc/setuid-prog.c.orig Sat Dec 11 14:29:22 2004
+++ Misc/setuid-prog.c Sat Dec 11 14:30:13 2004
@@ -70,6 +70,12 @@
#define environ _environ
#endif
+#if defined(__APPLE__)
+#include <sys/time.h>
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif
+
/* don't change def_IFS */
char def_IFS[] = "IFS= \t\n";
/* you may want to change def_PATH, but you should really change it in */
@@ -0,0 +1,21 @@
--- Modules/posixmodule.c.orig Sat Dec 11 14:27:52 2004
+++ Modules/posixmodule.c Sat Dec 11 14:28:17 2004
@@ -339,7 +339,7 @@
#endif
/* Return a dictionary corresponding to the POSIX environment table */
-#ifdef WITH_NEXT_FRAMEWORK
+#ifdef __APPLE__
/* On Darwin/MacOSX a shared library or framework has no access to
** environ directly, we must obtain it with _NSGetEnviron().
*/
@@ -357,7 +357,7 @@
d = PyDict_New();
if (d == NULL)
return NULL;
-#ifdef WITH_NEXT_FRAMEWORK
+#ifdef __APPLE__
if (environ == NULL)
environ = *_NSGetEnviron();
#endif
@@ -0,0 +1,20 @@
--- configure.orig 2009-06-24 13:57:38.000000000 -0700
+++ configure 2009-06-24 13:58:38.000000000 -0700
@@ -11362,7 +11362,7 @@
if test "${enable_universalsdk}"; then
:
else
- 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)';;
@@ -11374,7 +11374,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `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,11 @@
--- configure.orig 2008-10-15 18:00:59.000000000 -0700
+++ configure 2008-10-15 18:02:47.000000000 -0700
@@ -4538,7 +4538,7 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ BASECFLAGS="$BASECFLAGS -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
@@ -0,0 +1,28 @@
--- configure.in.orig 2007-09-28 21:07:32.000000000 +0200
+++ configure.in 2007-09-28 21:08:12.000000000 +0200
@@ -669,6 +669,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
--- configure.orig 2007-09-28 21:07:26.000000000 +0200
+++ configure 2007-09-28 21:07:33.000000000 +0200
@@ -3445,6 +3445,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
@@ -0,0 +1,13 @@
--- pyconfig.h.in.orig 2009-08-16 10:22:50.000000000 -0700
+++ pyconfig.h.in 2009-08-16 10:23:24.000000000 -0700
@@ -4,6 +4,10 @@
#ifndef Py_PYCONFIG_H
#define Py_PYCONFIG_H
+// Required on Darwin 10+
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
support for AIX C++ shared extension modules. */
@@ -0,0 +1,80 @@
--- setup.py.orig 2008-10-16 12:58:19.000000000 -0600
+++ setup.py 2009-06-07 20:55:17.000000000 -0600
@@ -609,7 +609,7 @@
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 5)
+ max_db_ver = (4, 6)
# NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
# we leave that version disabled by default as it has proven to be
# quite a buggy library release on many platforms.
@@ -636,6 +636,7 @@
db_inc_paths.append('/usr/local/include/db4%d' % x)
db_inc_paths.append('/pkg/db-4.%d/include' % x)
db_inc_paths.append('/opt/db-4.%d/include' % x)
+ db_inc_paths.append('__PREFIX__/include/db4%d' % x)
# 3.x minor number specific paths
for x in (3,):
db_inc_paths.append('/usr/include/db3%d' % x)
@@ -711,6 +712,7 @@
# check lib directories parallel to the location of the header
db_dirs_to_check = [
+ os.path.join('__PREFIX__', 'lib', 'db46'),
os.path.join(db_incdir, '..', 'lib64'),
os.path.join(db_incdir, '..', 'lib'),
os.path.join(db_incdir, '..', '..', 'lib64'),
@@ -1212,13 +1214,7 @@
def detect_tkinter(self, inc_dirs, lib_dirs):
# The _tkinter module.
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
platform = self.get_platform()
- if (platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
--- setup.py.orig 2009-09-10 19:41:32.000000000 +1000
+++ setup.py 2009-09-10 19:48:30.000000000 +1000
@@ -1197,7 +1197,7 @@
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ #include_dirs.append('/usr/X11R6/include')
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1262,17 +1262,17 @@
if platform == 'sunos5':
include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
+ #elif os.path.exists('/usr/X11R6/include'):
+ # include_dirs.append('/usr/X11R6/include')
+ # added_lib_dirs.append('/usr/X11R6/lib64')
+ # added_lib_dirs.append('/usr/X11R6/lib')
+ #elif os.path.exists('/usr/X11R5/include'):
+ # include_dirs.append('/usr/X11R5/include')
+ # added_lib_dirs.append('/usr/X11R5/lib')
+ #else:
# Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ # include_dirs.append('/usr/X11/include')
+ # added_lib_dirs.append('/usr/X11/lib')
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -0,0 +1,2 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -0,0 +1,12 @@
bin/python2.5
bin/pythonw2.5
bin/python2.5-config
bin/idle2.5
bin/pydoc2.5
bin/smtpd2.5.py
-
share/man/man1/python2.5.1.gz
${frameworks_dir}/Python.framework/Versions/2.5
${frameworks_dir}/Python.framework/Versions/2.5/Headers
${frameworks_dir}/Python.framework/Versions/2.5/Resources
${frameworks_dir}/Python.framework/Versions/2.5/Python
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
--- Mac/Modules/file/_Filemodule.c.orig 2009-09-12 15:55:59.000000000 +1000
+++ Mac/Modules/file/_Filemodule.c 2009-09-12 16:12:07.000000000 +1000
@@ -7,6 +7,8 @@
#include "pymactoolbox.h"
+typedef SInt16 FSIORefNum;
+
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
PyErr_SetString(PyExc_NotImplementedError, \
@@ -0,0 +1,18 @@
--- Lib/cgi.py.orig 2006-08-10 19:41:07.000000000 +0200
+++ Lib/cgi.py 2007-08-21 15:36:54.000000000 +0200
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
+#! __PREFIX__/bin/python2.5
-# 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,51 @@
--- Lib/distutils/dist.py.orig 2005-03-23 11:54:36.000000000 -0700
+++ Lib/distutils/dist.py 2008-07-25 21:27:15.000000000 -0600
@@ -57,6 +57,7 @@
('quiet', 'q', "run quietly (turns verbosity off)"),
('dry-run', 'n', "don't actually do anything"),
('help', 'h', "show detailed help message"),
+ ('no-user-cfg', None,'ignore pydistutils.cfg in your home directory'),
]
# 'common_usage' is a short (2-3 line) string describing the common
@@ -264,6 +265,12 @@
else:
sys.stderr.write(msg + "\n")
+ # no-user-cfg is handled before other command line args
+ # because other args override the config files, and this
+ # one is needed before we can load the config files.
+ # If attrs['script_args'] wasn't passed, assume false.
+ self.want_user_cfg = '--no-user-cfg' not in (self.script_args or [])
+
self.finalize_options()
# __init__ ()
@@ -324,6 +331,9 @@
Distutils __inst__.py file lives), a file in the user's home
directory named .pydistutils.cfg on Unix and pydistutils.cfg
on Windows/Mac, and setup.cfg in the current directory.
+
+ The file in the user's home directory can be disabled with the
+ --no-user-cfg option.
"""
files = []
check_environ()
@@ -343,7 +353,7 @@
user_filename = "pydistutils.cfg"
# And look for the user config file
- if os.environ.has_key('HOME'):
+ if self.want_user_cfg and os.environ.has_key('HOME'):
user_file = os.path.join(os.environ.get('HOME'), user_filename)
if os.path.isfile(user_file):
files.append(user_file)
@@ -353,6 +363,8 @@
if os.path.isfile(local_file):
files.append(local_file)
+ if DEBUG:
+ print "using config files: %s" % ', '.join(files)
return files
# find_config_files ()
@@ -0,0 +1,31 @@
--- Makefile.pre.in.orig 2007-12-05 13:43:57.000000000 -0700
+++ Makefile.pre.in 2008-07-25 21:41:02.000000000 -0600
@@ -348,8 +348,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
case $$MAKEFLAGS in \
- *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q --no-user-cfg build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg build;; \
esac
# Build static library
@@ -894,7 +904,7 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall:
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py --no-user-cfg install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
@@ -968,7 +978,7 @@
# This installs a few of the useful scripts in Tools/scripts
scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \
- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
+ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py --no-user-cfg install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--root=/$(DESTDIR)
@@ -0,0 +1,16 @@
--- Misc/setuid-prog.c.orig Sat Dec 11 14:29:22 2004
+++ Misc/setuid-prog.c Sat Dec 11 14:30:13 2004
@@ -70,6 +70,12 @@
#define environ _environ
#endif
+#if defined(__APPLE__)
+#include <sys/time.h>
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif
+
/* don't change def_IFS */
char def_IFS[] = "IFS= \t\n";
/* you may want to change def_PATH, but you should really change it in */
@@ -0,0 +1,21 @@
--- Modules/posixmodule.c.orig Sat Dec 11 14:27:52 2004
+++ Modules/posixmodule.c Sat Dec 11 14:28:17 2004
@@ -339,7 +339,7 @@
#endif
/* Return a dictionary corresponding to the POSIX environment table */
-#ifdef WITH_NEXT_FRAMEWORK
+#ifdef __APPLE__
/* On Darwin/MacOSX a shared library or framework has no access to
** environ directly, we must obtain it with _NSGetEnviron().
*/
@@ -357,7 +357,7 @@
d = PyDict_New();
if (d == NULL)
return NULL;
-#ifdef WITH_NEXT_FRAMEWORK
+#ifdef __APPLE__
if (environ == NULL)
environ = *_NSGetEnviron();
#endif
@@ -0,0 +1,20 @@
--- configure.orig 2009-06-24 13:57:38.000000000 -0700
+++ configure 2009-06-24 13:58:38.000000000 -0700
@@ -11362,7 +11362,7 @@
if test "${enable_universalsdk}"; then
:
else
- 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)';;
@@ -11374,7 +11374,7 @@
else
LIBTOOL_CRUFT=""
fi
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `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,11 @@
--- configure.orig 2008-10-15 18:00:59.000000000 -0700
+++ configure 2008-10-15 18:02:47.000000000 -0700
@@ -4538,7 +4538,7 @@
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
- BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
+ BASECFLAGS="$BASECFLAGS -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
@@ -0,0 +1,28 @@
--- configure.in.orig 2007-09-28 21:07:32.000000000 +0200
+++ configure.in 2007-09-28 21:08:12.000000000 +0200
@@ -669,6 +669,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
--- configure.orig 2007-09-28 21:07:26.000000000 +0200
+++ configure 2007-09-28 21:07:33.000000000 +0200
@@ -3445,6 +3445,11 @@
BLDLIBRARY='-L. -lpython$(VERSION)'
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
+ Darwin*)
+ LDLIBRARY='libpython$(VERSION).dylib'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=DYLD_LIBRARY_PATH="`pwd`:${DYLD_LIBRARY_PATH}"
+ ;;
esac
else # shared is disabled
case $ac_sys_system in
@@ -0,0 +1,13 @@
--- pyconfig.h.in.orig 2009-08-16 10:22:50.000000000 -0700
+++ pyconfig.h.in 2009-08-16 10:23:24.000000000 -0700
@@ -4,6 +4,10 @@
#ifndef Py_PYCONFIG_H
#define Py_PYCONFIG_H
+// Required on Darwin 10+
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE
+#endif
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want
support for AIX C++ shared extension modules. */
@@ -0,0 +1,80 @@
--- setup.py.orig 2008-10-16 12:58:19.000000000 -0600
+++ setup.py 2009-06-07 20:55:17.000000000 -0600
@@ -609,7 +609,7 @@
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 5)
+ max_db_ver = (4, 6)
# NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
# we leave that version disabled by default as it has proven to be
# quite a buggy library release on many platforms.
@@ -636,6 +636,7 @@
db_inc_paths.append('/usr/local/include/db4%d' % x)
db_inc_paths.append('/pkg/db-4.%d/include' % x)
db_inc_paths.append('/opt/db-4.%d/include' % x)
+ db_inc_paths.append('__PREFIX__/include/db4%d' % x)
# 3.x minor number specific paths
for x in (3,):
db_inc_paths.append('/usr/include/db3%d' % x)
@@ -711,6 +712,7 @@
# check lib directories parallel to the location of the header
db_dirs_to_check = [
+ os.path.join('__PREFIX__', 'lib', 'db46'),
os.path.join(db_incdir, '..', 'lib64'),
os.path.join(db_incdir, '..', 'lib'),
os.path.join(db_incdir, '..', '..', 'lib64'),
@@ -1212,13 +1214,7 @@
def detect_tkinter(self, inc_dirs, lib_dirs):
# The _tkinter module.
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
platform = self.get_platform()
- if (platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
--- setup.py.orig 2009-09-10 19:41:32.000000000 +1000
+++ setup.py 2009-09-10 19:48:30.000000000 +1000
@@ -1197,7 +1197,7 @@
# For 8.4a2, the X11 headers are not included. Rather than include a
# complicated search, this is a hard-coded path. It could bail out
# if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
+ #include_dirs.append('/usr/X11R6/include')
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1262,17 +1262,17 @@
if platform == 'sunos5':
include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
+ #elif os.path.exists('/usr/X11R6/include'):
+ # include_dirs.append('/usr/X11R6/include')
+ # added_lib_dirs.append('/usr/X11R6/lib64')
+ # added_lib_dirs.append('/usr/X11R6/lib')
+ #elif os.path.exists('/usr/X11R5/include'):
+ # include_dirs.append('/usr/X11R5/include')
+ # added_lib_dirs.append('/usr/X11R5/lib')
+ #else:
# Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
+ # include_dirs.append('/usr/X11/include')
+ # added_lib_dirs.append('/usr/X11/lib')
# If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin':
@@ -0,0 +1,2 @@
g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
w
@@ -0,0 +1,12 @@
bin/python2.5
bin/pythonw2.5
bin/python2.5-config
bin/idle2.5
bin/pydoc2.5
bin/smtpd2.5.py
-
share/man/man1/python2.5.1.gz
${frameworks_dir}/Python.framework/Versions/2.5
${frameworks_dir}/Python.framework/Versions/2.5/Headers
${frameworks_dir}/Python.framework/Versions/2.5/Resources
${frameworks_dir}/Python.framework/Versions/2.5/Python
+109 -3
View File
@@ -1,13 +1,13 @@
import os
import sys
import errno
import shutil
import urllib
import subprocess
import re
import posixpath
from pythonbrew.define import PATH_BIN, PATH_PYTHONS
from pythonbrew.exceptions import BuildingException
from pythonbrew.log import logger
import tarfile
def size_format(b):
kb = 1000
@@ -39,6 +39,18 @@ def is_archive_file(name):
return True
return False
def is_html(content_type):
if content_type and content_type.startswith('text/html'):
return True
return False
def is_gzip(content_type, filename):
if (content_type == 'application/x-gzip'
or tarfile.is_tarfile(filename)
or splitext(filename)[1].lower() in ('.tar', '.tar.gz', '.tar.bz2', '.tgz', '.tbz')):
return True
return False
def makedirs(path):
try:
os.makedirs(path)
@@ -73,7 +85,82 @@ def off():
continue
unlink("%s/%s" % (root, f))
unlink("%s/current" % PATH_PYTHONS)
def split_leading_dir(path):
path = str(path)
path = path.lstrip('/').lstrip('\\')
if '/' in path and (('\\' in path and path.find('/') < path.find('\\'))
or '\\' not in path):
return path.split('/', 1)
elif '\\' in path:
return path.split('\\', 1)
else:
return path, ''
def has_leading_dir(paths):
"""Returns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive)"""
common_prefix = None
for path in paths:
prefix, rest = split_leading_dir(path)
if not prefix:
return False
elif common_prefix is None:
common_prefix = prefix
elif prefix != common_prefix:
return False
return True
def untar_file(filename, location):
if not os.path.exists(location):
makedirs(location)
if filename.lower().endswith('.gz') or filename.lower().endswith('.tgz'):
mode = 'r:gz'
elif filename.lower().endswith('.bz2') or filename.lower().endswith('.tbz'):
mode = 'r:bz2'
elif filename.lower().endswith('.tar'):
mode = 'r'
else:
logger.error('Cannot determine compression type for file %s' % filename)
mode = 'r:*'
tar = tarfile.open(filename, mode)
try:
# note: python<=2.5 doesnt seem to know about pax headers, filter them
leading = has_leading_dir([
member.name for member in tar.getmembers()
if member.name != 'pax_global_header'
])
for member in tar.getmembers():
fn = member.name
if fn == 'pax_global_header':
continue
if leading:
fn = split_leading_dir(fn)[1]
path = os.path.join(location, fn)
if member.isdir():
if not os.path.exists(path):
os.makedirs(path)
else:
try:
fp = tar.extractfile(member)
except (KeyError, AttributeError), e:
# Some corrupt tar files seem to produce this
# (specifically bad symlinks)
logger.error('In the tar file %s the member %s is invalid: %s'
% (filename, member.name, e))
continue
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
destfp = open(path, 'wb')
try:
shutil.copyfileobj(fp, destfp)
finally:
destfp.close()
os.chmod(path, member.mode)
fp.close()
finally:
tar.close()
class Subprocess(object):
def __init__(self, log=None, shell=False, cwd=None, print_cmd=True):
self._log = log
@@ -108,4 +195,23 @@ class Package(object):
else:
self.name = "Python-%s" % name
self.version = name
class Link(object):
def __init__(self, url):
self._url = url
@property
def filename(self):
url = self._url
url = url.split('#', 1)[0]
url = url.split('?', 1)[0]
url = url.rstrip('/')
name = posixpath.basename(url)
assert name, ('URL %r produced no filename' % url)
return name
@property
def show_msg(self):
return posixpath.basename(self._url.split('#', 1)[0].split('?', 1)[0])