mirror of
https://github.com/kennethreitz-archive/python-build.git
synced 2026-06-05 23:30:18 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c7aeaa9fcd | |||
| 97b101f33c | |||
| b357cc13ff | |||
| 3f455e161b |
@@ -0,0 +1,21 @@
|
|||||||
|
* 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.
|
||||||
|
- Added pythonbrew-install script.
|
||||||
|
- Added pybrew script. This is a symbolic pythonbrew.
|
||||||
|
- Rename `search` to `list`.
|
||||||
|
- 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
|
||||||
+18
-31
@@ -13,48 +13,43 @@ Following python version is required to use pythonbrew:
|
|||||||
|
|
||||||
The recommended way to download and install pythonbrew is to run these statements in your shell.::
|
The recommended way to download and install pythonbrew is to run these statements in your shell.::
|
||||||
|
|
||||||
curl -LO http://github.com/utahta/pythonbrew/raw/master/pythonbrew
|
curl -LO http://github.com/utahta/pythonbrew/raw/master/pythonbrew-install
|
||||||
chmod +x pythonbrew
|
chmod +x pythonbrew-install
|
||||||
./pythonbrew install
|
./pythonbrew-install
|
||||||
|
|
||||||
After that, pythonbrew installs itself to ~/python/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.::
|
If you need to install pythonbrew into somewhere else, you can do that by setting a PYTHONBREW_ROOT environment variable.::
|
||||||
|
|
||||||
export PYTHONBREW_ROOT=/path/to/pythonbrew
|
export PYTHONBREW_ROOT=/path/to/pythonbrew
|
||||||
./pythonbrew install
|
./pythonbrew-install
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
pythonbrew command [options]
|
pythonbrew command [options]
|
||||||
|
|
||||||
Initialize::
|
|
||||||
|
|
||||||
pythonbrew init
|
|
||||||
|
|
||||||
Install some Pythons::
|
Install some Pythons::
|
||||||
|
|
||||||
pythonbrew install Python-3.1.2
|
pythonbrew install 2.6.6
|
||||||
pythonbrew install Python-2.6.6
|
pythonbrew install Python-2.5.5
|
||||||
pythonbrew install --configure="CC=gcc_4.1" Python-2.6.6
|
pythonbrew install --configure="CC=gcc_4.1" Python-2.6.6
|
||||||
pythonbrew install --no-setuptools Python-2.6.6
|
pythonbrew install --no-setuptools Python-2.6.6
|
||||||
pythonbrew install http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
|
pythonbrew install http://www.python.org/ftp/python/2.7/Python-2.7.tgz
|
||||||
pythonbrew install /path/to/Python-2.6.6.tgz
|
|
||||||
|
|
||||||
Switch python in the $PATH::
|
Switch python in the $PATH::
|
||||||
|
|
||||||
pythonbrew switch Python-2.6.6
|
pythonbrew switch 2.6.6
|
||||||
pythonbrew switch /path/to/python
|
pythonbrew switch Python-2.5.5
|
||||||
|
|
||||||
Search python packages::
|
List the available install versions of Python::
|
||||||
|
|
||||||
pythonbrew search Python-2.6
|
pythonbrew list 2.6
|
||||||
pythonbrew search Python-3
|
pythonbrew list 3.0
|
||||||
|
|
||||||
Uninstall some Pythons::
|
Uninstall some Pythons::
|
||||||
|
|
||||||
pythonbrew uninstall Python-2.6.6
|
pythonbrew uninstall 2.6.6
|
||||||
|
|
||||||
Remove stale source folders and archives::
|
Remove stale source folders and archives::
|
||||||
|
|
||||||
@@ -75,12 +70,7 @@ Show version::
|
|||||||
COMMANDS
|
COMMANDS
|
||||||
========
|
========
|
||||||
|
|
||||||
init
|
install <version>
|
||||||
Run this once to setup the pythonbrew directory ready for installing.
|
|
||||||
|
|
||||||
pythons into. Run it again if you decide to change PYTHONBREW_ROOT.
|
|
||||||
|
|
||||||
install Python-<version>
|
|
||||||
Build and install the given version of Python.
|
Build and install the given version of Python.
|
||||||
|
|
||||||
Setuptools and pip is automatically installed.
|
Setuptools and pip is automatically installed.
|
||||||
@@ -90,14 +80,11 @@ install Python-<version>
|
|||||||
installed
|
installed
|
||||||
List the installed versions of python.
|
List the installed versions of python.
|
||||||
|
|
||||||
switch Python-<version>
|
switch <version>
|
||||||
Switch to the given version.
|
Switch to the given version.
|
||||||
|
|
||||||
switch /path/to/python
|
list <version>
|
||||||
Switch to the given version of python.
|
List the available install version of python.
|
||||||
|
|
||||||
search Python-<version>
|
|
||||||
Search Python packages.
|
|
||||||
|
|
||||||
uninstall Python-<version>
|
uninstall Python-<version>
|
||||||
Uninstall the given version of python.
|
Uninstall the given version of python.
|
||||||
|
|||||||
-696
@@ -1,696 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# vim:fileencoding=utf-8
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import urllib
|
|
||||||
import errno
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import filecmp
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
from HTMLParser import HTMLParser
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
VERSION = "0.4"
|
|
||||||
if os.environ.has_key("PYTHONBREW_ROOT"):
|
|
||||||
ROOT = os.environ["PYTHONBREW_ROOT"]
|
|
||||||
else:
|
|
||||||
ROOT = "%s/python/pythonbrew" % os.environ["HOME"]
|
|
||||||
PYTHONDLSITE = "http://www.python.org/ftp/python/%s/%s"
|
|
||||||
DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py"
|
|
||||||
PYTHONBREW_DLSITE = "http://github.com/utahta/pythonbrew/raw/master/pythonbrew"
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
parser = OptionParser(usage="%prog COMMAND [OPTIONS]",
|
|
||||||
version=VERSION,
|
|
||||||
add_help_option=False)
|
|
||||||
parser.add_option(
|
|
||||||
'-h', '--help',
|
|
||||||
dest='help',
|
|
||||||
action='store_true',
|
|
||||||
help='Show help')
|
|
||||||
parser.disable_interspersed_args()
|
|
||||||
|
|
||||||
command_dict = {}
|
|
||||||
def add_command(command):
|
|
||||||
command_dict[command.name] = command
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# exception
|
|
||||||
#----------------------------------------------------
|
|
||||||
class BuildingException(Exception):
|
|
||||||
"""General exception during building"""
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# util
|
|
||||||
#----------------------------------------------------
|
|
||||||
def size_format(b):
|
|
||||||
kb = 1000
|
|
||||||
mb = kb*kb
|
|
||||||
b = float(b)
|
|
||||||
if b >= mb:
|
|
||||||
return "%.1fMb" % (b/mb)
|
|
||||||
if b >= kb:
|
|
||||||
return "%.1fKb" % (b/kb)
|
|
||||||
return "%.0fbytes" % (b)
|
|
||||||
|
|
||||||
def is_url(name):
|
|
||||||
if ':' not in name:
|
|
||||||
return False
|
|
||||||
scheme = name.split(':', 1)[0].lower()
|
|
||||||
return scheme in ['http', 'https', 'file', 'ftp']
|
|
||||||
|
|
||||||
def splitext(name):
|
|
||||||
base, ext = os.path.splitext(name)
|
|
||||||
if base.lower().endswith('.tar'):
|
|
||||||
ext = base[-4:] + ext
|
|
||||||
base = base[:-4]
|
|
||||||
return base, ext
|
|
||||||
|
|
||||||
def is_archive_file(name):
|
|
||||||
ext = splitext(name)[1].lower()
|
|
||||||
archives = ('.zip', '.tar.gz', '.tar.bz2', '.tgz', '.tar')
|
|
||||||
if ext in archives:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def makedirs(path):
|
|
||||||
try:
|
|
||||||
os.makedirs(path)
|
|
||||||
except OSError, (e, es):
|
|
||||||
if errno.EEXIST != e:
|
|
||||||
raise
|
|
||||||
|
|
||||||
def symlink(src, dst):
|
|
||||||
try:
|
|
||||||
os.symlink(src, dst)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def unlink(path):
|
|
||||||
try:
|
|
||||||
os.unlink(path)
|
|
||||||
except OSError, (e, es):
|
|
||||||
if errno.ENOENT != e:
|
|
||||||
raise
|
|
||||||
|
|
||||||
def rm_r(path):
|
|
||||||
"""like rm -r command."""
|
|
||||||
if os.path.isdir(path):
|
|
||||||
shutil.rmtree(path)
|
|
||||||
else:
|
|
||||||
unlink(path)
|
|
||||||
|
|
||||||
def off():
|
|
||||||
for root, dirs, files in os.walk(PATH_BIN):
|
|
||||||
for f in files:
|
|
||||||
if f == "pythonbrew":
|
|
||||||
continue
|
|
||||||
unlink("%s/%s" % (root, f))
|
|
||||||
unlink("%s/current" % PATH_PYTHONS)
|
|
||||||
|
|
||||||
def copy_myself(path):
|
|
||||||
(fd, src) = tempfile.mkstemp()
|
|
||||||
fp = file(path, "r")
|
|
||||||
line = fp.readline()
|
|
||||||
if line.startswith("#!"):
|
|
||||||
os.write(fd, "#!%s\n" % os.path.realpath(sys.executable))
|
|
||||||
else:
|
|
||||||
os.write(fd, line)
|
|
||||||
os.write(fd, fp.read())
|
|
||||||
os.close(fd)
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
dist = "%s/pythonbrew" % PATH_BIN
|
|
||||||
if os.path.isfile(src) and os.path.isfile(dist):
|
|
||||||
if filecmp.cmp(src, dist):
|
|
||||||
unlink(src)
|
|
||||||
return (False, dist)
|
|
||||||
makedirs(PATH_BIN)
|
|
||||||
shutil.copy(src, dist)
|
|
||||||
os.chmod(dist, 0755)
|
|
||||||
unlink(src)
|
|
||||||
return (True, dist)
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# classes
|
|
||||||
#----------------------------------------------------
|
|
||||||
class Downloader(object):
|
|
||||||
def __init__(self):
|
|
||||||
self._msg = ""
|
|
||||||
self._last_msg = ""
|
|
||||||
self._bytes = 0.0
|
|
||||||
|
|
||||||
def download(self, msg, url, path):
|
|
||||||
self._msg = msg
|
|
||||||
self._bytes = 0
|
|
||||||
urllib.urlretrieve(url, path, self._download_progress)
|
|
||||||
print " downloaded."
|
|
||||||
|
|
||||||
def _download_progress(self, block, blockbytes, maxbytes):
|
|
||||||
self._bytes += float(blockbytes)
|
|
||||||
if self._bytes >= maxbytes:
|
|
||||||
self._bytes = maxbytes
|
|
||||||
percent = (self._bytes / maxbytes) * 100
|
|
||||||
max_size = size_format(maxbytes)
|
|
||||||
now_size = size_format(self._bytes)
|
|
||||||
now_msg = "\rDownloading %s (%s): %3i%% %s" % (self._msg, max_size, percent, now_size)
|
|
||||||
padding = " " * (len(self._last_msg) - len(now_msg))
|
|
||||||
sys.stdout.write("%s%s" % (now_msg, padding))
|
|
||||||
sys.stdout.flush()
|
|
||||||
self._last_msg = now_msg
|
|
||||||
|
|
||||||
class Subprocess(object):
|
|
||||||
def __init__(self, log=None, shell=False, cwd=None, print_cmd=True):
|
|
||||||
self._log = log
|
|
||||||
self._shell = shell
|
|
||||||
self._cwd = cwd
|
|
||||||
self._print_cmd = print_cmd
|
|
||||||
|
|
||||||
def chdir(self, cwd):
|
|
||||||
self._cwd = cwd
|
|
||||||
|
|
||||||
def check_call(self, cmd, shell=None, cwd=None):
|
|
||||||
if shell:
|
|
||||||
self._shell = shell
|
|
||||||
if cwd:
|
|
||||||
self._cwd = cwd
|
|
||||||
if self._print_cmd:
|
|
||||||
print cmd
|
|
||||||
if self._log:
|
|
||||||
cmd = "(%s) >> '%s' 2>&1" % (cmd, self._log)
|
|
||||||
retcode = subprocess.call(cmd, shell=self._shell, cwd=self._cwd)
|
|
||||||
if retcode != 0:
|
|
||||||
raise BuildingException()
|
|
||||||
|
|
||||||
class PythonVersionParser(HTMLParser):
|
|
||||||
def __init__(self):
|
|
||||||
HTMLParser.__init__(self)
|
|
||||||
self._versions = []
|
|
||||||
self._re = re.compile("^(\d+\.\d+(\..*)?)/$")
|
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
|
||||||
if tag == "a":
|
|
||||||
attrs = dict(attrs)
|
|
||||||
if "href" in attrs:
|
|
||||||
m = self._re.search(attrs["href"])
|
|
||||||
if m:
|
|
||||||
self._versions.append(m.group(1))
|
|
||||||
|
|
||||||
def get_sorted_versions(self):
|
|
||||||
return sorted(self._versions)
|
|
||||||
|
|
||||||
class PythonPackages(object):
|
|
||||||
def __init__(self):
|
|
||||||
parser = PythonVersionParser()
|
|
||||||
fp = urllib.urlopen("http://www.python.org/ftp/python/")
|
|
||||||
parser.feed(fp.read())
|
|
||||||
fp.close()
|
|
||||||
parser.close()
|
|
||||||
self._versions = parser.get_sorted_versions()
|
|
||||||
|
|
||||||
def has_version(self, version):
|
|
||||||
return version in self._versions
|
|
||||||
|
|
||||||
def get_packages(self):
|
|
||||||
return ["Python-%s" % v for v in self._versions]
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# commands
|
|
||||||
#----------------------------------------------------
|
|
||||||
class Command(object):
|
|
||||||
name = None
|
|
||||||
usage = None
|
|
||||||
summary = ""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.parser = OptionParser(usage=self.usage,
|
|
||||||
prog='%s %s' % (os.path.basename(sys.argv[0]), self.name))
|
|
||||||
|
|
||||||
def run(self, args):
|
|
||||||
options, args = self.parser.parse_args(args)
|
|
||||||
self.run_command(options, args[1:])
|
|
||||||
|
|
||||||
class HelpCommand(Command):
|
|
||||||
name = "help"
|
|
||||||
usage = "%prog [COMMAND]"
|
|
||||||
summary = "Show available commands"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
command = args[0]
|
|
||||||
if command not in command_dict:
|
|
||||||
parser.error("Unknown command: `%s`" % command)
|
|
||||||
return
|
|
||||||
command = command_dict[command]
|
|
||||||
command.parser.print_help()
|
|
||||||
return
|
|
||||||
parser.print_help()
|
|
||||||
print
|
|
||||||
print "Commands available:"
|
|
||||||
commands = [command_dict[key] for key in sorted(command_dict.keys())]
|
|
||||||
for command in commands:
|
|
||||||
print " %s: %s" % (command.name, command.summary)
|
|
||||||
print
|
|
||||||
print "Further Instructions:"
|
|
||||||
print " http://github.com/utahta/pythonbrew"
|
|
||||||
|
|
||||||
class InitCommand(Command):
|
|
||||||
name = "init"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Run this once to setup the pythonbrew directory ready for installing pythons into"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
makedirs(PATH_PYTHONS)
|
|
||||||
makedirs(PATH_BUILD)
|
|
||||||
makedirs(PATH_DISTS)
|
|
||||||
makedirs(PATH_ETC)
|
|
||||||
|
|
||||||
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))
|
|
||||||
m = re.search("(t?csh)", os.environ.get("SHELL"))
|
|
||||||
if m:
|
|
||||||
shrc = "cshrc"
|
|
||||||
yourshrc = m.group(1)+"rc"
|
|
||||||
else:
|
|
||||||
shrc = yourshrc = "bashrc"
|
|
||||||
print """
|
|
||||||
Pythonbrew environment initiated, required directories are created under
|
|
||||||
|
|
||||||
"""+ROOT+"""
|
|
||||||
|
|
||||||
Well-done! Congratulations! Please add the following line to the end
|
|
||||||
of your ~/."""+yourshrc+"""
|
|
||||||
|
|
||||||
source """+PATH_ETC+"""/"""+shrc+"""
|
|
||||||
|
|
||||||
After that, exit this shell, start a new one, and install some fresh
|
|
||||||
pythons:
|
|
||||||
|
|
||||||
pythonbrew install Python-2.6.6
|
|
||||||
pythonbrew install Python-2.5.5
|
|
||||||
|
|
||||||
For further instructions, simply run:
|
|
||||||
|
|
||||||
pythonbrew
|
|
||||||
|
|
||||||
The default help messages will popup and tell you what to do!
|
|
||||||
|
|
||||||
Enjoy pythonbrew at $HOME!!
|
|
||||||
INSTRUCTION"""
|
|
||||||
|
|
||||||
class InstallCommand(Command):
|
|
||||||
name = "install"
|
|
||||||
usage = "%prog [OPTIONS] PACKAGE_NAMES"
|
|
||||||
summary = "Build and install the given version of python"
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(InstallCommand, self).__init__()
|
|
||||||
self.parser.add_option(
|
|
||||||
"-f", "--force",
|
|
||||||
dest="force",
|
|
||||||
action="store_true",
|
|
||||||
default=False,
|
|
||||||
help="Force installation of a Python."
|
|
||||||
)
|
|
||||||
self.parser.add_option(
|
|
||||||
"-C", "--configure",
|
|
||||||
dest="configure",
|
|
||||||
default="",
|
|
||||||
metavar="CONFIGURE_OPTIONS",
|
|
||||||
help="Custom configure options."
|
|
||||||
)
|
|
||||||
self.parser.add_option(
|
|
||||||
"-n", "--no-setuptools",
|
|
||||||
dest="no_setuptools",
|
|
||||||
action="store_true",
|
|
||||||
default=False,
|
|
||||||
help="Skip installation of setuptools."
|
|
||||||
)
|
|
||||||
self._logfile = "%s/build.log" % ROOT
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
# Install Python
|
|
||||||
self._install_python(args[0], options)
|
|
||||||
else:
|
|
||||||
# Install pythonbrew
|
|
||||||
self._install_myself()
|
|
||||||
|
|
||||||
def _install_myself(self):
|
|
||||||
executable = os.path.abspath(sys.argv[0])
|
|
||||||
(retval, dist) = copy_myself(executable)
|
|
||||||
if not retval:
|
|
||||||
print "You are already running the installed latest version of pythonbrew."
|
|
||||||
print "\n%s" % dist
|
|
||||||
sys.exit()
|
|
||||||
print """The pythonbrew is installed as:
|
|
||||||
|
|
||||||
"""+dist+"""
|
|
||||||
|
|
||||||
You may trash the downloaded """+executable+""" from now on.
|
|
||||||
|
|
||||||
Next, if this is the first time you've run pythonbrew installation, run:
|
|
||||||
|
|
||||||
"""+dist+""" init
|
|
||||||
|
|
||||||
And follow the instruction on screen."""
|
|
||||||
|
|
||||||
def _get_package(self, name):
|
|
||||||
if not os.path.isfile(name) and not os.path.isdir(name):
|
|
||||||
if is_url(name):
|
|
||||||
basename = os.path.basename(name)
|
|
||||||
download_url = name
|
|
||||||
download_path = "%s/%s" % (PATH_DISTS, basename)
|
|
||||||
else:
|
|
||||||
m = re.search("^Python-(\d+\.\d+(\..*)?)$", name)
|
|
||||||
if not m:
|
|
||||||
print "Unknown package: `%s`" % name
|
|
||||||
sys.exit(1)
|
|
||||||
if os.path.isdir("%s/%s" % (PATH_PYTHONS, name)):
|
|
||||||
print "You are already installed `%s`." % name
|
|
||||||
sys.exit()
|
|
||||||
dist_version = m.group(1)
|
|
||||||
pkgs = PythonPackages()
|
|
||||||
if not pkgs.has_version(dist_version):
|
|
||||||
print "Package not found: `%s`" % name
|
|
||||||
sys.exit(1)
|
|
||||||
basename = "%s.tgz" % name
|
|
||||||
download_url = PYTHONDLSITE % (dist_version, basename)
|
|
||||||
download_path = "%s/%s" % (PATH_DISTS, basename)
|
|
||||||
|
|
||||||
if os.path.isfile(download_path):
|
|
||||||
print "Use the previously fetched %s" % (download_path)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
dl = Downloader()
|
|
||||||
dl.download(
|
|
||||||
basename,
|
|
||||||
download_url,
|
|
||||||
download_path
|
|
||||||
)
|
|
||||||
except:
|
|
||||||
unlink(download_path)
|
|
||||||
print "\nInterrupt to abort. `%s`" % (download_url)
|
|
||||||
sys.exit(1)
|
|
||||||
# iffy
|
|
||||||
if os.path.getsize(download_path) < 1000000:
|
|
||||||
print "Failed to download. (maybe not stable version of python) `%s`" % (download_url)
|
|
||||||
unlink(download_path)
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
if is_archive_file(name):
|
|
||||||
basename = os.path.basename(name)
|
|
||||||
print "Copy the archive file %s to %s/%s" % (name, PATH_DISTS, basename)
|
|
||||||
shutil.copy(name, "%s/%s" % (PATH_DISTS, basename))
|
|
||||||
else:
|
|
||||||
print "Invalid file. `%s`" % name
|
|
||||||
sys.exit(1)
|
|
||||||
return basename
|
|
||||||
|
|
||||||
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:
|
|
||||||
print "File not found. `%s`" % (basename)
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def _install_python(self, dist, options):
|
|
||||||
basename = self._get_package(dist)
|
|
||||||
pkgname = splitext(basename)[0]
|
|
||||||
|
|
||||||
install_dir = "%s/%s" % (PATH_PYTHONS, pkgname)
|
|
||||||
configure = "--prefix=%s %s" % (install_dir, options.configure)
|
|
||||||
print "Installing %s into %s" % (pkgname, install_dir);
|
|
||||||
print """This could take a while. You can run the following command on another shell to track the status:
|
|
||||||
|
|
||||||
tail -f %s
|
|
||||||
""" % (self._logfile)
|
|
||||||
try:
|
|
||||||
s = Subprocess(log=self._logfile, shell=True, cwd=PATH_BUILD)
|
|
||||||
s.check_call(self._get_uncompress_command(basename))
|
|
||||||
|
|
||||||
s.chdir("%s/%s" % (PATH_BUILD, pkgname))
|
|
||||||
s.check_call("./configure %s" % (configure))
|
|
||||||
if options.force:
|
|
||||||
s.check_call("make")
|
|
||||||
s.check_call("make install")
|
|
||||||
else:
|
|
||||||
s.check_call("make")
|
|
||||||
s.check_call("make test")
|
|
||||||
s.check_call("make install")
|
|
||||||
except:
|
|
||||||
print """Installing %(pkgname)s failed. See %(ROOT)s/build.log to see why.
|
|
||||||
|
|
||||||
pythonbrew install --force %(pkgname)s""" % {"pkgname":pkgname, "ROOT":ROOT}
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# install setuptools
|
|
||||||
self._install_setuptools(pkgname, options.no_setuptools)
|
|
||||||
print """
|
|
||||||
Installed %(pkgname)s successfully. Run the following command to switch to it.
|
|
||||||
|
|
||||||
pythonbrew switch %(pkgname)s""" % {"pkgname":pkgname}
|
|
||||||
|
|
||||||
def _install_setuptools(self, pkgname, no_setuptools):
|
|
||||||
if no_setuptools:
|
|
||||||
print "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))
|
|
||||||
|
|
||||||
if is_python3:
|
|
||||||
if os.path.isfile("%s/%s/bin/python3" % (PATH_PYTHONS, pkgname)):
|
|
||||||
pyexec = "%s/%s/bin/python3" % (PATH_PYTHONS, pkgname)
|
|
||||||
elif os.path.isfile("%s/%s/bin/python3.0" % (PATH_PYTHONS, pkgname)):
|
|
||||||
pyexec = "%s/%s/bin/python3.0" % (PATH_PYTHONS, pkgname)
|
|
||||||
else:
|
|
||||||
print "Python3 binary not found. `%s/%s`" % (PATH_PYTHONS, pkgname)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
pyexec = "%s/%s/bin/python" % (PATH_PYTHONS, pkgname)
|
|
||||||
|
|
||||||
try:
|
|
||||||
s = Subprocess(log=self._logfile, shell=True, cwd=PATH_DISTS)
|
|
||||||
s.check_call("%s %s" % (pyexec, basename))
|
|
||||||
if os.path.isfile("%s/%s/bin/easy_install" % (PATH_PYTHONS, pkgname)) and not is_python3:
|
|
||||||
s.check_call("%s/%s/bin/easy_install pip" % (PATH_PYTHONS, pkgname), cwd=None)
|
|
||||||
except:
|
|
||||||
print "Installing setuptools failed. See %s/build.log to see why." % (ROOT)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
class InstalledCommand(Command):
|
|
||||||
name = "installed"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "List the installed versions of python"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if not os.path.islink("%s/current" % PATH_PYTHONS):
|
|
||||||
cur = os.path.realpath("%s/bin/python" % ROOT)
|
|
||||||
print "%s (*)" % cur
|
|
||||||
elif os.path.islink("%s/current" % PATH_PYTHONS):
|
|
||||||
cur = os.path.basename(os.path.realpath("%s/current" % PATH_PYTHONS))
|
|
||||||
else:
|
|
||||||
cur = ""
|
|
||||||
for d in sorted(os.listdir("%s/" % PATH_PYTHONS)):
|
|
||||||
if d == "current":
|
|
||||||
continue
|
|
||||||
if cur == d:
|
|
||||||
print "%s (*)" % cur
|
|
||||||
else:
|
|
||||||
print "%s" % (d)
|
|
||||||
|
|
||||||
class SwitchCommand(Command):
|
|
||||||
name = "switch"
|
|
||||||
usage = "%prog PACKAGE"
|
|
||||||
summary = "Switch to the given version"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
dist = args[0]
|
|
||||||
distdir = dist
|
|
||||||
if os.path.isfile( dist ) and os.access( dist, os.X_OK ):
|
|
||||||
if re.search( ".*python(\d(\.\d)?)?$", dist ):
|
|
||||||
self._switch_file(dist)
|
|
||||||
else:
|
|
||||||
print "`%s` is not python binary." % dist
|
|
||||||
return
|
|
||||||
elif not os.path.isdir( "%s/%s" % (PATH_PYTHONS, dist) ):
|
|
||||||
print "`%s` is not installed." % dist
|
|
||||||
return
|
|
||||||
self._switch_dir( distdir )
|
|
||||||
|
|
||||||
def _switch_file(self, dist):
|
|
||||||
off()
|
|
||||||
symlink(dist, "%s/python" % PATH_BIN)
|
|
||||||
print "Switched to "+dist
|
|
||||||
|
|
||||||
def _switch_dir(self, dist):
|
|
||||||
off()
|
|
||||||
symlink(dist, "%s/current" % PATH_PYTHONS)
|
|
||||||
for root, dirs, files in os.walk("%s/current/bin/" % PATH_PYTHONS):
|
|
||||||
for f in files:
|
|
||||||
symlink("%s%s" % (root, f), "%s/%s" % (PATH_BIN, f))
|
|
||||||
break
|
|
||||||
# I want better code
|
|
||||||
if not os.path.isfile("%s/python" % PATH_BIN):
|
|
||||||
if os.path.isfile("%s/python3" % PATH_BIN):
|
|
||||||
symlink(os.path.realpath("%s/python3" % PATH_BIN), "%s/python" % PATH_BIN)
|
|
||||||
elif os.path.isfile("%s/python3.0" % PATH_BIN):
|
|
||||||
symlink(os.path.realpath("%s/python3.0" % PATH_BIN), "%s/python" % PATH_BIN)
|
|
||||||
print "Switched to "+dist
|
|
||||||
|
|
||||||
class OffCommand(Command):
|
|
||||||
name = "off"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Disable pythonbrew"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
off()
|
|
||||||
|
|
||||||
class VersionCommand(Command):
|
|
||||||
name = "version"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Show version"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
print VERSION
|
|
||||||
|
|
||||||
class SearchCommand(Command):
|
|
||||||
name = "search"
|
|
||||||
usage = "%prog Python-<VERSION>"
|
|
||||||
summary = "Search Python packages"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
pkgs = PythonPackages()
|
|
||||||
if args:
|
|
||||||
pattern = args[0]
|
|
||||||
_re = re.compile(r"%s" % pattern)
|
|
||||||
pkgnames = []
|
|
||||||
for pkgname in pkgs.get_packages():
|
|
||||||
if _re.match(pkgname):
|
|
||||||
pkgnames.append(pkgname)
|
|
||||||
if pkgnames:
|
|
||||||
for pkgname in pkgnames:
|
|
||||||
print pkgname
|
|
||||||
else:
|
|
||||||
print "Package not found. `%s`" % pattern
|
|
||||||
else:
|
|
||||||
for pkgname in pkgs.get_packages():
|
|
||||||
print pkgname
|
|
||||||
|
|
||||||
class UninstallCommand(Command):
|
|
||||||
name = "uninstall"
|
|
||||||
usage = "%prog Python-<VERSION>"
|
|
||||||
summary = "Uninstall the given version of python"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
pkgname = args[0]
|
|
||||||
pkgpath = "%s/%s" % (PATH_PYTHONS, pkgname)
|
|
||||||
if not os.path.isdir(pkgpath):
|
|
||||||
print "%s is not installed." % pkgname
|
|
||||||
sys.exit(1)
|
|
||||||
if os.path.islink("%s/current" % PATH_PYTHONS):
|
|
||||||
curpath = os.path.realpath("%s/current" % PATH_PYTHONS)
|
|
||||||
if pkgpath == curpath:
|
|
||||||
off()
|
|
||||||
rm_r(pkgpath)
|
|
||||||
else:
|
|
||||||
self.parser.print_help()
|
|
||||||
|
|
||||||
class CleanCommand(Command):
|
|
||||||
name = "clean"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Remove stale source folders and archives"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
self._clean(PATH_BUILD)
|
|
||||||
self._clean(PATH_DISTS)
|
|
||||||
|
|
||||||
def _clean(self, root):
|
|
||||||
for dir in os.listdir(root):
|
|
||||||
rm_r("%s/%s" % (root, dir))
|
|
||||||
|
|
||||||
class UpdateCommand(Command):
|
|
||||||
name = "update"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Upgrades pythonbrew to the latest version"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
download_url = PYTHONBREW_DLSITE
|
|
||||||
basename = os.path.basename(download_url)
|
|
||||||
download_path = "%s/%s" % (PATH_DISTS, basename)
|
|
||||||
|
|
||||||
try:
|
|
||||||
d = Downloader()
|
|
||||||
d.download(basename, download_url, download_path)
|
|
||||||
except:
|
|
||||||
print "Failed to download. `%s`" % download_url
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
(retval, dist) = copy_myself(download_path)
|
|
||||||
if not retval:
|
|
||||||
print "You are already running the installed latest version of pythonbrew."
|
|
||||||
print "\n%s" % dist
|
|
||||||
sys.exit()
|
|
||||||
print "The pythonbrew has been updated."
|
|
||||||
|
|
||||||
class Pythonbrew(object):
|
|
||||||
def run(self):
|
|
||||||
options, args = parser.parse_args(sys.argv[1:])
|
|
||||||
if options.help and not args:
|
|
||||||
args = ["help"]
|
|
||||||
if not args:
|
|
||||||
parser.error('You must give a command (use "pythonbrew help" to see a list of commands)')
|
|
||||||
return
|
|
||||||
add_command(HelpCommand())
|
|
||||||
add_command(InitCommand())
|
|
||||||
add_command(InstallCommand())
|
|
||||||
add_command(InstalledCommand())
|
|
||||||
add_command(SwitchCommand())
|
|
||||||
add_command(OffCommand())
|
|
||||||
add_command(VersionCommand())
|
|
||||||
add_command(SearchCommand())
|
|
||||||
add_command(UninstallCommand())
|
|
||||||
add_command(CleanCommand())
|
|
||||||
add_command(UpdateCommand())
|
|
||||||
|
|
||||||
command = args[0].lower()
|
|
||||||
if command not in command_dict:
|
|
||||||
parser.error("Unknown command: `%s`" % command)
|
|
||||||
return
|
|
||||||
command = command_dict[command]
|
|
||||||
command.run(args)
|
|
||||||
|
|
||||||
def main():
|
|
||||||
p = Pythonbrew()
|
|
||||||
p.run()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
Executable
+124
@@ -0,0 +1,124 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
PYTHON=`command -v python`
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
printf "
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
${0} [options]
|
||||||
|
|
||||||
|
options:
|
||||||
|
|
||||||
|
--python : Python interpreter.
|
||||||
|
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_arguments()
|
||||||
|
{
|
||||||
|
for arg do
|
||||||
|
val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
|
||||||
|
case "$arg" in
|
||||||
|
--python=*) PYTHON="$val" ;;
|
||||||
|
--help) usage ;;
|
||||||
|
*) echo "Can't find the option. :$arg";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_arguments $@
|
||||||
|
|
||||||
|
if [[ ! -x $PYTHON ]] ; then
|
||||||
|
echo "I think $PYTHON is not Python interpreter."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
PYTHON_VERSION=`$PYTHON -V 2>&1`
|
||||||
|
PYTHON_VERSION=${PYTHON_VERSION/"Python "/""}
|
||||||
|
PYTHON_VERSION_S=`echo $PYTHON_VERSION | sed -e "s/\(^[[:digit:]]\{1,\}.[[:digit:]]\{1,\}\).*/\1/"`
|
||||||
|
|
||||||
|
if [[ $PYTHON_VERSION_S != "2.4" ]] && [[ $PYTHON_VERSION_S != "2.5" ]] && [[ $PYTHON_VERSION_S != "2.6" ]] ; then
|
||||||
|
printf "Python's version is $PYTHON_VERSION_S:
|
||||||
|
2.4 <= python < 3.0 is required.
|
||||||
|
"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
ROOT="$HOME/.pythonbrew"
|
||||||
|
if [[ -n $PYTHONBREW_ROOT ]] ; then
|
||||||
|
ROOT=$PYTHONBREW_ROOT
|
||||||
|
fi
|
||||||
|
PATH_DISTS="$ROOT/dists"
|
||||||
|
PATH_ETC="$ROOT/etc"
|
||||||
|
|
||||||
|
mkdir -p $PATH_DISTS
|
||||||
|
rm -rf $PATH_DISTS/pythonbrew.tar.gz
|
||||||
|
rm -rf $PATH_DISTS/utahta-pythonbrew*
|
||||||
|
|
||||||
|
TEMP_TARBALL="pythonbrew.tar.gz"
|
||||||
|
DOWNLOAD_URL="http://github.com/utahta/pythonbrew/tarball/master"
|
||||||
|
|
||||||
|
echo "Downloading $DOWNLOAD_URL"
|
||||||
|
builtin cd $PATH_DISTS ; curl -L $DOWNLOAD_URL -o "$TEMP_TARBALL" > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Extracting $PATH_DISTS/$TEMP_TARBALL"
|
||||||
|
builtin cd $PATH_DISTS ; tar zxf $TEMP_TARBALL
|
||||||
|
|
||||||
|
TEMP_FILE=`ls $PATH_DISTS | grep utahta-pythonbrew`
|
||||||
|
|
||||||
|
echo "Installing pythonbrew into $ROOT"
|
||||||
|
$PYTHON $PATH_DISTS/$TEMP_FILE/pythonbrew_install.py
|
||||||
|
if [[ $? == 1 ]] ; then
|
||||||
|
echo "Failed to install pythonbrew."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $SHELL in
|
||||||
|
*tcsh)
|
||||||
|
shrc="cshrc"
|
||||||
|
yourshrc="tcshrc"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*csh)
|
||||||
|
shrc="cshrc"
|
||||||
|
yourshrc=$shrc
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
shrc="bashrc"
|
||||||
|
yourshrc=$shrc
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf "
|
||||||
|
The pythonbrew is installed as:
|
||||||
|
|
||||||
|
$ROOT/bin/pythonbrew
|
||||||
|
|
||||||
|
You may trash the downloaded $0 from now on.
|
||||||
|
|
||||||
|
Pythonbrew environment initiated, required directories are created under
|
||||||
|
|
||||||
|
$ROOT
|
||||||
|
|
||||||
|
Well-done! Congratulations! Please add the following line to the end
|
||||||
|
of your ~/.$yourshrc
|
||||||
|
|
||||||
|
source $PATH_ETC/$shrc
|
||||||
|
|
||||||
|
After that, exit this shell, start a new one, and install some fresh
|
||||||
|
pythons:
|
||||||
|
|
||||||
|
pythonbrew install 2.6.6
|
||||||
|
pythonbrew install 2.5.5
|
||||||
|
|
||||||
|
For further instructions, run:
|
||||||
|
|
||||||
|
pythonbrew help
|
||||||
|
|
||||||
|
The default help messages will popup and tell you what to do!
|
||||||
|
|
||||||
|
Enjoy pythonbrew at $ROOT!!
|
||||||
|
"
|
||||||
-696
@@ -1,696 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# vim:fileencoding=utf-8
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import urllib
|
|
||||||
import errno
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import filecmp
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
from HTMLParser import HTMLParser
|
|
||||||
from optparse import OptionParser
|
|
||||||
|
|
||||||
VERSION = "0.4"
|
|
||||||
if os.environ.has_key("PYTHONBREW_ROOT"):
|
|
||||||
ROOT = os.environ["PYTHONBREW_ROOT"]
|
|
||||||
else:
|
|
||||||
ROOT = "%s/python/pythonbrew" % os.environ["HOME"]
|
|
||||||
PYTHONDLSITE = "http://www.python.org/ftp/python/%s/%s"
|
|
||||||
DISTRIBUTE_SETUP_DLSITE = "http://python-distribute.org/distribute_setup.py"
|
|
||||||
PYTHONBREW_DLSITE = "http://github.com/utahta/pythonbrew/raw/master/pythonbrew"
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
parser = OptionParser(usage="%prog COMMAND [OPTIONS]",
|
|
||||||
version=VERSION,
|
|
||||||
add_help_option=False)
|
|
||||||
parser.add_option(
|
|
||||||
'-h', '--help',
|
|
||||||
dest='help',
|
|
||||||
action='store_true',
|
|
||||||
help='Show help')
|
|
||||||
parser.disable_interspersed_args()
|
|
||||||
|
|
||||||
command_dict = {}
|
|
||||||
def add_command(command):
|
|
||||||
command_dict[command.name] = command
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# exception
|
|
||||||
#----------------------------------------------------
|
|
||||||
class BuildingException(Exception):
|
|
||||||
"""General exception during building"""
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# util
|
|
||||||
#----------------------------------------------------
|
|
||||||
def size_format(b):
|
|
||||||
kb = 1000
|
|
||||||
mb = kb*kb
|
|
||||||
b = float(b)
|
|
||||||
if b >= mb:
|
|
||||||
return "%.1fMb" % (b/mb)
|
|
||||||
if b >= kb:
|
|
||||||
return "%.1fKb" % (b/kb)
|
|
||||||
return "%.0fbytes" % (b)
|
|
||||||
|
|
||||||
def is_url(name):
|
|
||||||
if ':' not in name:
|
|
||||||
return False
|
|
||||||
scheme = name.split(':', 1)[0].lower()
|
|
||||||
return scheme in ['http', 'https', 'file', 'ftp']
|
|
||||||
|
|
||||||
def splitext(name):
|
|
||||||
base, ext = os.path.splitext(name)
|
|
||||||
if base.lower().endswith('.tar'):
|
|
||||||
ext = base[-4:] + ext
|
|
||||||
base = base[:-4]
|
|
||||||
return base, ext
|
|
||||||
|
|
||||||
def is_archive_file(name):
|
|
||||||
ext = splitext(name)[1].lower()
|
|
||||||
archives = ('.zip', '.tar.gz', '.tar.bz2', '.tgz', '.tar')
|
|
||||||
if ext in archives:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def makedirs(path):
|
|
||||||
try:
|
|
||||||
os.makedirs(path)
|
|
||||||
except OSError, (e, es):
|
|
||||||
if errno.EEXIST != e:
|
|
||||||
raise
|
|
||||||
|
|
||||||
def symlink(src, dst):
|
|
||||||
try:
|
|
||||||
os.symlink(src, dst)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def unlink(path):
|
|
||||||
try:
|
|
||||||
os.unlink(path)
|
|
||||||
except OSError, (e, es):
|
|
||||||
if errno.ENOENT != e:
|
|
||||||
raise
|
|
||||||
|
|
||||||
def rm_r(path):
|
|
||||||
"""like rm -r command."""
|
|
||||||
if os.path.isdir(path):
|
|
||||||
shutil.rmtree(path)
|
|
||||||
else:
|
|
||||||
unlink(path)
|
|
||||||
|
|
||||||
def off():
|
|
||||||
for root, dirs, files in os.walk(PATH_BIN):
|
|
||||||
for f in files:
|
|
||||||
if f == "pythonbrew":
|
|
||||||
continue
|
|
||||||
unlink("%s/%s" % (root, f))
|
|
||||||
unlink("%s/current" % PATH_PYTHONS)
|
|
||||||
|
|
||||||
def copy_myself(path):
|
|
||||||
(fd, src) = tempfile.mkstemp()
|
|
||||||
fp = file(path, "r")
|
|
||||||
line = fp.readline()
|
|
||||||
if line.startswith("#!"):
|
|
||||||
os.write(fd, "#!%s\n" % os.path.realpath(sys.executable))
|
|
||||||
else:
|
|
||||||
os.write(fd, line)
|
|
||||||
os.write(fd, fp.read())
|
|
||||||
os.close(fd)
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
dist = "%s/pythonbrew" % PATH_BIN
|
|
||||||
if os.path.isfile(src) and os.path.isfile(dist):
|
|
||||||
if filecmp.cmp(src, dist):
|
|
||||||
unlink(src)
|
|
||||||
return (False, dist)
|
|
||||||
makedirs(PATH_BIN)
|
|
||||||
shutil.copy(src, dist)
|
|
||||||
os.chmod(dist, 0755)
|
|
||||||
unlink(src)
|
|
||||||
return (True, dist)
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# classes
|
|
||||||
#----------------------------------------------------
|
|
||||||
class Downloader(object):
|
|
||||||
def __init__(self):
|
|
||||||
self._msg = ""
|
|
||||||
self._last_msg = ""
|
|
||||||
self._bytes = 0.0
|
|
||||||
|
|
||||||
def download(self, msg, url, path):
|
|
||||||
self._msg = msg
|
|
||||||
self._bytes = 0
|
|
||||||
urllib.urlretrieve(url, path, self._download_progress)
|
|
||||||
print " downloaded."
|
|
||||||
|
|
||||||
def _download_progress(self, block, blockbytes, maxbytes):
|
|
||||||
self._bytes += float(blockbytes)
|
|
||||||
if self._bytes >= maxbytes:
|
|
||||||
self._bytes = maxbytes
|
|
||||||
percent = (self._bytes / maxbytes) * 100
|
|
||||||
max_size = size_format(maxbytes)
|
|
||||||
now_size = size_format(self._bytes)
|
|
||||||
now_msg = "\rDownloading %s (%s): %3i%% %s" % (self._msg, max_size, percent, now_size)
|
|
||||||
padding = " " * (len(self._last_msg) - len(now_msg))
|
|
||||||
sys.stdout.write("%s%s" % (now_msg, padding))
|
|
||||||
sys.stdout.flush()
|
|
||||||
self._last_msg = now_msg
|
|
||||||
|
|
||||||
class Subprocess(object):
|
|
||||||
def __init__(self, log=None, shell=False, cwd=None, print_cmd=True):
|
|
||||||
self._log = log
|
|
||||||
self._shell = shell
|
|
||||||
self._cwd = cwd
|
|
||||||
self._print_cmd = print_cmd
|
|
||||||
|
|
||||||
def chdir(self, cwd):
|
|
||||||
self._cwd = cwd
|
|
||||||
|
|
||||||
def check_call(self, cmd, shell=None, cwd=None):
|
|
||||||
if shell:
|
|
||||||
self._shell = shell
|
|
||||||
if cwd:
|
|
||||||
self._cwd = cwd
|
|
||||||
if self._print_cmd:
|
|
||||||
print cmd
|
|
||||||
if self._log:
|
|
||||||
cmd = "(%s) >> '%s' 2>&1" % (cmd, self._log)
|
|
||||||
retcode = subprocess.call(cmd, shell=self._shell, cwd=self._cwd)
|
|
||||||
if retcode != 0:
|
|
||||||
raise BuildingException()
|
|
||||||
|
|
||||||
class PythonVersionParser(HTMLParser):
|
|
||||||
def __init__(self):
|
|
||||||
HTMLParser.__init__(self)
|
|
||||||
self._versions = []
|
|
||||||
self._re = re.compile("^(\d+\.\d+(\..*)?)/$")
|
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
|
||||||
if tag == "a":
|
|
||||||
attrs = dict(attrs)
|
|
||||||
if "href" in attrs:
|
|
||||||
m = self._re.search(attrs["href"])
|
|
||||||
if m:
|
|
||||||
self._versions.append(m.group(1))
|
|
||||||
|
|
||||||
def get_sorted_versions(self):
|
|
||||||
return sorted(self._versions)
|
|
||||||
|
|
||||||
class PythonPackages(object):
|
|
||||||
def __init__(self):
|
|
||||||
parser = PythonVersionParser()
|
|
||||||
fp = urllib.urlopen("http://www.python.org/ftp/python/")
|
|
||||||
parser.feed(fp.read())
|
|
||||||
fp.close()
|
|
||||||
parser.close()
|
|
||||||
self._versions = parser.get_sorted_versions()
|
|
||||||
|
|
||||||
def has_version(self, version):
|
|
||||||
return version in self._versions
|
|
||||||
|
|
||||||
def get_packages(self):
|
|
||||||
return ["Python-%s" % v for v in self._versions]
|
|
||||||
|
|
||||||
#----------------------------------------------------
|
|
||||||
# commands
|
|
||||||
#----------------------------------------------------
|
|
||||||
class Command(object):
|
|
||||||
name = None
|
|
||||||
usage = None
|
|
||||||
summary = ""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.parser = OptionParser(usage=self.usage,
|
|
||||||
prog='%s %s' % (os.path.basename(sys.argv[0]), self.name))
|
|
||||||
|
|
||||||
def run(self, args):
|
|
||||||
options, args = self.parser.parse_args(args)
|
|
||||||
self.run_command(options, args[1:])
|
|
||||||
|
|
||||||
class HelpCommand(Command):
|
|
||||||
name = "help"
|
|
||||||
usage = "%prog [COMMAND]"
|
|
||||||
summary = "Show available commands"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
command = args[0]
|
|
||||||
if command not in command_dict:
|
|
||||||
parser.error("Unknown command: `%s`" % command)
|
|
||||||
return
|
|
||||||
command = command_dict[command]
|
|
||||||
command.parser.print_help()
|
|
||||||
return
|
|
||||||
parser.print_help()
|
|
||||||
print
|
|
||||||
print "Commands available:"
|
|
||||||
commands = [command_dict[key] for key in sorted(command_dict.keys())]
|
|
||||||
for command in commands:
|
|
||||||
print " %s: %s" % (command.name, command.summary)
|
|
||||||
print
|
|
||||||
print "Further Instructions:"
|
|
||||||
print " http://github.com/utahta/pythonbrew"
|
|
||||||
|
|
||||||
class InitCommand(Command):
|
|
||||||
name = "init"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Run this once to setup the pythonbrew directory ready for installing pythons into"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
makedirs(PATH_PYTHONS)
|
|
||||||
makedirs(PATH_BUILD)
|
|
||||||
makedirs(PATH_DISTS)
|
|
||||||
makedirs(PATH_ETC)
|
|
||||||
|
|
||||||
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))
|
|
||||||
m = re.search("(t?csh)", os.environ.get("SHELL"))
|
|
||||||
if m:
|
|
||||||
shrc = "cshrc"
|
|
||||||
yourshrc = m.group(1)+"rc"
|
|
||||||
else:
|
|
||||||
shrc = yourshrc = "bashrc"
|
|
||||||
print """
|
|
||||||
Pythonbrew environment initiated, required directories are created under
|
|
||||||
|
|
||||||
"""+ROOT+"""
|
|
||||||
|
|
||||||
Well-done! Congratulations! Please add the following line to the end
|
|
||||||
of your ~/."""+yourshrc+"""
|
|
||||||
|
|
||||||
source """+PATH_ETC+"""/"""+shrc+"""
|
|
||||||
|
|
||||||
After that, exit this shell, start a new one, and install some fresh
|
|
||||||
pythons:
|
|
||||||
|
|
||||||
pythonbrew install Python-2.6.6
|
|
||||||
pythonbrew install Python-2.5.5
|
|
||||||
|
|
||||||
For further instructions, simply run:
|
|
||||||
|
|
||||||
pythonbrew
|
|
||||||
|
|
||||||
The default help messages will popup and tell you what to do!
|
|
||||||
|
|
||||||
Enjoy pythonbrew at $HOME!!
|
|
||||||
INSTRUCTION"""
|
|
||||||
|
|
||||||
class InstallCommand(Command):
|
|
||||||
name = "install"
|
|
||||||
usage = "%prog [OPTIONS] PACKAGE_NAMES"
|
|
||||||
summary = "Build and install the given version of python"
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(InstallCommand, self).__init__()
|
|
||||||
self.parser.add_option(
|
|
||||||
"-f", "--force",
|
|
||||||
dest="force",
|
|
||||||
action="store_true",
|
|
||||||
default=False,
|
|
||||||
help="Force installation of a Python."
|
|
||||||
)
|
|
||||||
self.parser.add_option(
|
|
||||||
"-C", "--configure",
|
|
||||||
dest="configure",
|
|
||||||
default="",
|
|
||||||
metavar="CONFIGURE_OPTIONS",
|
|
||||||
help="Custom configure options."
|
|
||||||
)
|
|
||||||
self.parser.add_option(
|
|
||||||
"-n", "--no-setuptools",
|
|
||||||
dest="no_setuptools",
|
|
||||||
action="store_true",
|
|
||||||
default=False,
|
|
||||||
help="Skip installation of setuptools."
|
|
||||||
)
|
|
||||||
self._logfile = "%s/build.log" % ROOT
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
# Install Python
|
|
||||||
self._install_python(args[0], options)
|
|
||||||
else:
|
|
||||||
# Install pythonbrew
|
|
||||||
self._install_myself()
|
|
||||||
|
|
||||||
def _install_myself(self):
|
|
||||||
executable = os.path.abspath(sys.argv[0])
|
|
||||||
(retval, dist) = copy_myself(executable)
|
|
||||||
if not retval:
|
|
||||||
print "You are already running the installed latest version of pythonbrew."
|
|
||||||
print "\n%s" % dist
|
|
||||||
sys.exit()
|
|
||||||
print """The pythonbrew is installed as:
|
|
||||||
|
|
||||||
"""+dist+"""
|
|
||||||
|
|
||||||
You may trash the downloaded """+executable+""" from now on.
|
|
||||||
|
|
||||||
Next, if this is the first time you've run pythonbrew installation, run:
|
|
||||||
|
|
||||||
"""+dist+""" init
|
|
||||||
|
|
||||||
And follow the instruction on screen."""
|
|
||||||
|
|
||||||
def _get_package(self, name):
|
|
||||||
if not os.path.isfile(name) and not os.path.isdir(name):
|
|
||||||
if is_url(name):
|
|
||||||
basename = os.path.basename(name)
|
|
||||||
download_url = name
|
|
||||||
download_path = "%s/%s" % (PATH_DISTS, basename)
|
|
||||||
else:
|
|
||||||
m = re.search("^Python-(\d+\.\d+(\..*)?)$", name)
|
|
||||||
if not m:
|
|
||||||
print "Unknown package: `%s`" % name
|
|
||||||
sys.exit(1)
|
|
||||||
if os.path.isdir("%s/%s" % (PATH_PYTHONS, name)):
|
|
||||||
print "You are already installed `%s`." % name
|
|
||||||
sys.exit()
|
|
||||||
dist_version = m.group(1)
|
|
||||||
pkgs = PythonPackages()
|
|
||||||
if not pkgs.has_version(dist_version):
|
|
||||||
print "Package not found: `%s`" % name
|
|
||||||
sys.exit(1)
|
|
||||||
basename = "%s.tgz" % name
|
|
||||||
download_url = PYTHONDLSITE % (dist_version, basename)
|
|
||||||
download_path = "%s/%s" % (PATH_DISTS, basename)
|
|
||||||
|
|
||||||
if os.path.isfile(download_path):
|
|
||||||
print "Use the previously fetched %s" % (download_path)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
dl = Downloader()
|
|
||||||
dl.download(
|
|
||||||
basename,
|
|
||||||
download_url,
|
|
||||||
download_path
|
|
||||||
)
|
|
||||||
except:
|
|
||||||
unlink(download_path)
|
|
||||||
print "\nInterrupt to abort. `%s`" % (download_url)
|
|
||||||
sys.exit(1)
|
|
||||||
# iffy
|
|
||||||
if os.path.getsize(download_path) < 1000000:
|
|
||||||
print "Failed to download. (maybe not stable version of python) `%s`" % (download_url)
|
|
||||||
unlink(download_path)
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
if is_archive_file(name):
|
|
||||||
basename = os.path.basename(name)
|
|
||||||
print "Copy the archive file %s to %s/%s" % (name, PATH_DISTS, basename)
|
|
||||||
shutil.copy(name, "%s/%s" % (PATH_DISTS, basename))
|
|
||||||
else:
|
|
||||||
print "Invalid file. `%s`" % name
|
|
||||||
sys.exit(1)
|
|
||||||
return basename
|
|
||||||
|
|
||||||
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:
|
|
||||||
print "File not found. `%s`" % (basename)
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def _install_python(self, dist, options):
|
|
||||||
basename = self._get_package(dist)
|
|
||||||
pkgname = splitext(basename)[0]
|
|
||||||
|
|
||||||
install_dir = "%s/%s" % (PATH_PYTHONS, pkgname)
|
|
||||||
configure = "--prefix=%s %s" % (install_dir, options.configure)
|
|
||||||
print "Installing %s into %s" % (pkgname, install_dir);
|
|
||||||
print """This could take a while. You can run the following command on another shell to track the status:
|
|
||||||
|
|
||||||
tail -f %s
|
|
||||||
""" % (self._logfile)
|
|
||||||
try:
|
|
||||||
s = Subprocess(log=self._logfile, shell=True, cwd=PATH_BUILD)
|
|
||||||
s.check_call(self._get_uncompress_command(basename))
|
|
||||||
|
|
||||||
s.chdir("%s/%s" % (PATH_BUILD, pkgname))
|
|
||||||
s.check_call("./configure %s" % (configure))
|
|
||||||
if options.force:
|
|
||||||
s.check_call("make")
|
|
||||||
s.check_call("make install")
|
|
||||||
else:
|
|
||||||
s.check_call("make")
|
|
||||||
s.check_call("make test")
|
|
||||||
s.check_call("make install")
|
|
||||||
except:
|
|
||||||
print """Installing %(pkgname)s failed. See %(ROOT)s/build.log to see why.
|
|
||||||
|
|
||||||
pythonbrew install --force %(pkgname)s""" % {"pkgname":pkgname, "ROOT":ROOT}
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# install setuptools
|
|
||||||
self._install_setuptools(pkgname, options.no_setuptools)
|
|
||||||
print """
|
|
||||||
Installed %(pkgname)s successfully. Run the following command to switch to it.
|
|
||||||
|
|
||||||
pythonbrew switch %(pkgname)s""" % {"pkgname":pkgname}
|
|
||||||
|
|
||||||
def _install_setuptools(self, pkgname, no_setuptools):
|
|
||||||
if no_setuptools:
|
|
||||||
print "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))
|
|
||||||
|
|
||||||
if is_python3:
|
|
||||||
if os.path.isfile("%s/%s/bin/python3" % (PATH_PYTHONS, pkgname)):
|
|
||||||
pyexec = "%s/%s/bin/python3" % (PATH_PYTHONS, pkgname)
|
|
||||||
elif os.path.isfile("%s/%s/bin/python3.0" % (PATH_PYTHONS, pkgname)):
|
|
||||||
pyexec = "%s/%s/bin/python3.0" % (PATH_PYTHONS, pkgname)
|
|
||||||
else:
|
|
||||||
print "Python3 binary not found. `%s/%s`" % (PATH_PYTHONS, pkgname)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
pyexec = "%s/%s/bin/python" % (PATH_PYTHONS, pkgname)
|
|
||||||
|
|
||||||
try:
|
|
||||||
s = Subprocess(log=self._logfile, shell=True, cwd=PATH_DISTS)
|
|
||||||
s.check_call("%s %s" % (pyexec, basename))
|
|
||||||
if os.path.isfile("%s/%s/bin/easy_install" % (PATH_PYTHONS, pkgname)) and not is_python3:
|
|
||||||
s.check_call("%s/%s/bin/easy_install pip" % (PATH_PYTHONS, pkgname), cwd=None)
|
|
||||||
except:
|
|
||||||
print "Installing setuptools failed. See %s/build.log to see why." % (ROOT)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
class InstalledCommand(Command):
|
|
||||||
name = "installed"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "List the installed versions of python"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if not os.path.islink("%s/current" % PATH_PYTHONS):
|
|
||||||
cur = os.path.realpath("%s/bin/python" % ROOT)
|
|
||||||
print "%s (*)" % cur
|
|
||||||
elif os.path.islink("%s/current" % PATH_PYTHONS):
|
|
||||||
cur = os.path.basename(os.path.realpath("%s/current" % PATH_PYTHONS))
|
|
||||||
else:
|
|
||||||
cur = ""
|
|
||||||
for d in sorted(os.listdir("%s/" % PATH_PYTHONS)):
|
|
||||||
if d == "current":
|
|
||||||
continue
|
|
||||||
if cur == d:
|
|
||||||
print "%s (*)" % cur
|
|
||||||
else:
|
|
||||||
print "%s" % (d)
|
|
||||||
|
|
||||||
class SwitchCommand(Command):
|
|
||||||
name = "switch"
|
|
||||||
usage = "%prog PACKAGE"
|
|
||||||
summary = "Switch to the given version"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
dist = args[0]
|
|
||||||
distdir = dist
|
|
||||||
if os.path.isfile( dist ) and os.access( dist, os.X_OK ):
|
|
||||||
if re.search( ".*python(\d(\.\d)?)?$", dist ):
|
|
||||||
self._switch_file(dist)
|
|
||||||
else:
|
|
||||||
print "`%s` is not python binary." % dist
|
|
||||||
return
|
|
||||||
elif not os.path.isdir( "%s/%s" % (PATH_PYTHONS, dist) ):
|
|
||||||
print "`%s` is not installed." % dist
|
|
||||||
return
|
|
||||||
self._switch_dir( distdir )
|
|
||||||
|
|
||||||
def _switch_file(self, dist):
|
|
||||||
off()
|
|
||||||
symlink(dist, "%s/python" % PATH_BIN)
|
|
||||||
print "Switched to "+dist
|
|
||||||
|
|
||||||
def _switch_dir(self, dist):
|
|
||||||
off()
|
|
||||||
symlink(dist, "%s/current" % PATH_PYTHONS)
|
|
||||||
for root, dirs, files in os.walk("%s/current/bin/" % PATH_PYTHONS):
|
|
||||||
for f in files:
|
|
||||||
symlink("%s%s" % (root, f), "%s/%s" % (PATH_BIN, f))
|
|
||||||
break
|
|
||||||
# I want better code
|
|
||||||
if not os.path.isfile("%s/python" % PATH_BIN):
|
|
||||||
if os.path.isfile("%s/python3" % PATH_BIN):
|
|
||||||
symlink(os.path.realpath("%s/python3" % PATH_BIN), "%s/python" % PATH_BIN)
|
|
||||||
elif os.path.isfile("%s/python3.0" % PATH_BIN):
|
|
||||||
symlink(os.path.realpath("%s/python3.0" % PATH_BIN), "%s/python" % PATH_BIN)
|
|
||||||
print "Switched to "+dist
|
|
||||||
|
|
||||||
class OffCommand(Command):
|
|
||||||
name = "off"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Disable pythonbrew"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
off()
|
|
||||||
|
|
||||||
class VersionCommand(Command):
|
|
||||||
name = "version"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Show version"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
print VERSION
|
|
||||||
|
|
||||||
class SearchCommand(Command):
|
|
||||||
name = "search"
|
|
||||||
usage = "%prog Python-<VERSION>"
|
|
||||||
summary = "Search Python packages"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
pkgs = PythonPackages()
|
|
||||||
if args:
|
|
||||||
pattern = args[0]
|
|
||||||
_re = re.compile(r"%s" % pattern)
|
|
||||||
pkgnames = []
|
|
||||||
for pkgname in pkgs.get_packages():
|
|
||||||
if _re.match(pkgname):
|
|
||||||
pkgnames.append(pkgname)
|
|
||||||
if pkgnames:
|
|
||||||
for pkgname in pkgnames:
|
|
||||||
print pkgname
|
|
||||||
else:
|
|
||||||
print "Package not found. `%s`" % pattern
|
|
||||||
else:
|
|
||||||
for pkgname in pkgs.get_packages():
|
|
||||||
print pkgname
|
|
||||||
|
|
||||||
class UninstallCommand(Command):
|
|
||||||
name = "uninstall"
|
|
||||||
usage = "%prog Python-<VERSION>"
|
|
||||||
summary = "Uninstall the given version of python"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
if args:
|
|
||||||
pkgname = args[0]
|
|
||||||
pkgpath = "%s/%s" % (PATH_PYTHONS, pkgname)
|
|
||||||
if not os.path.isdir(pkgpath):
|
|
||||||
print "%s is not installed." % pkgname
|
|
||||||
sys.exit(1)
|
|
||||||
if os.path.islink("%s/current" % PATH_PYTHONS):
|
|
||||||
curpath = os.path.realpath("%s/current" % PATH_PYTHONS)
|
|
||||||
if pkgpath == curpath:
|
|
||||||
off()
|
|
||||||
rm_r(pkgpath)
|
|
||||||
else:
|
|
||||||
self.parser.print_help()
|
|
||||||
|
|
||||||
class CleanCommand(Command):
|
|
||||||
name = "clean"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Remove stale source folders and archives"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
self._clean(PATH_BUILD)
|
|
||||||
self._clean(PATH_DISTS)
|
|
||||||
|
|
||||||
def _clean(self, root):
|
|
||||||
for dir in os.listdir(root):
|
|
||||||
rm_r("%s/%s" % (root, dir))
|
|
||||||
|
|
||||||
class UpdateCommand(Command):
|
|
||||||
name = "update"
|
|
||||||
usage = "%prog"
|
|
||||||
summary = "Upgrades pythonbrew to the latest version"
|
|
||||||
|
|
||||||
def run_command(self, options, args):
|
|
||||||
download_url = PYTHONBREW_DLSITE
|
|
||||||
basename = os.path.basename(download_url)
|
|
||||||
download_path = "%s/%s" % (PATH_DISTS, basename)
|
|
||||||
|
|
||||||
try:
|
|
||||||
d = Downloader()
|
|
||||||
d.download(basename, download_url, download_path)
|
|
||||||
except:
|
|
||||||
print "Failed to download. `%s`" % download_url
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
(retval, dist) = copy_myself(download_path)
|
|
||||||
if not retval:
|
|
||||||
print "You are already running the installed latest version of pythonbrew."
|
|
||||||
print "\n%s" % dist
|
|
||||||
sys.exit()
|
|
||||||
print "The pythonbrew has been updated."
|
|
||||||
|
|
||||||
class Pythonbrew(object):
|
|
||||||
def run(self):
|
|
||||||
options, args = parser.parse_args(sys.argv[1:])
|
|
||||||
if options.help and not args:
|
|
||||||
args = ["help"]
|
|
||||||
if not args:
|
|
||||||
parser.error('You must give a command (use "pythonbrew help" to see a list of commands)')
|
|
||||||
return
|
|
||||||
add_command(HelpCommand())
|
|
||||||
add_command(InitCommand())
|
|
||||||
add_command(InstallCommand())
|
|
||||||
add_command(InstalledCommand())
|
|
||||||
add_command(SwitchCommand())
|
|
||||||
add_command(OffCommand())
|
|
||||||
add_command(VersionCommand())
|
|
||||||
add_command(SearchCommand())
|
|
||||||
add_command(UninstallCommand())
|
|
||||||
add_command(CleanCommand())
|
|
||||||
add_command(UpdateCommand())
|
|
||||||
|
|
||||||
command = args[0].lower()
|
|
||||||
if command not in command_dict:
|
|
||||||
parser.error("Unknown command: `%s`" % command)
|
|
||||||
return
|
|
||||||
command = command_dict[command]
|
|
||||||
command.run(args)
|
|
||||||
|
|
||||||
def main():
|
|
||||||
p = Pythonbrew()
|
|
||||||
p.run()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import sys
|
||||||
|
from pythonbrew.basecommand import command_dict, load_all_commands
|
||||||
|
from pythonbrew.baseparser import parser
|
||||||
|
|
||||||
|
def main():
|
||||||
|
options, args = parser.parse_args(sys.argv[1:])
|
||||||
|
if options.help and not args:
|
||||||
|
args = ["help"]
|
||||||
|
if not args:
|
||||||
|
parser.error('You must give a command (use "pythonbrew help" to see a list of commands)')
|
||||||
|
return
|
||||||
|
|
||||||
|
load_all_commands()
|
||||||
|
command = args[0].lower()
|
||||||
|
if command not in command_dict:
|
||||||
|
parser.error("Unknown command: `%s`" % command)
|
||||||
|
return
|
||||||
|
command = command_dict[command]
|
||||||
|
command.run(args)
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from optparse import OptionParser
|
||||||
|
from pythonbrew import commands
|
||||||
|
from pythonbrew.define import PATH_BIN_PYTHONBREW
|
||||||
|
|
||||||
|
command_dict = {}
|
||||||
|
|
||||||
|
class Command(object):
|
||||||
|
name = None
|
||||||
|
usage = None
|
||||||
|
summary = ""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.parser = OptionParser(usage=self.usage,
|
||||||
|
prog='%s %s' % (PATH_BIN_PYTHONBREW, self.name))
|
||||||
|
command_dict[self.name] = self
|
||||||
|
|
||||||
|
def run(self, args):
|
||||||
|
options, args = self.parser.parse_args(args)
|
||||||
|
self.run_command(options, args[1:])
|
||||||
|
|
||||||
|
def load_command(name):
|
||||||
|
full_name = 'pythonbrew.commands.%s' % name
|
||||||
|
if full_name in sys.modules:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
__import__(full_name)
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def load_all_commands():
|
||||||
|
for name in command_names():
|
||||||
|
load_command(name)
|
||||||
|
|
||||||
|
def command_names():
|
||||||
|
return [path[:-3] for path in os.listdir(commands.__path__[0]) if not re.match("(__init__\.py$|.*\.pyc$)", path)]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
from optparse import OptionParser
|
||||||
|
from pythonbrew.define import VERSION, PATH_BIN_PYTHONBREW
|
||||||
|
|
||||||
|
parser = OptionParser(usage="%prog COMMAND [OPTIONS]",
|
||||||
|
prog=PATH_BIN_PYTHONBREW,
|
||||||
|
version=VERSION,
|
||||||
|
add_help_option=False)
|
||||||
|
parser.add_option(
|
||||||
|
'-h', '--help',
|
||||||
|
dest='help',
|
||||||
|
action='store_true',
|
||||||
|
help='Show help')
|
||||||
|
parser.disable_interspersed_args()
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import PATH_BUILD, PATH_DISTS
|
||||||
|
from pythonbrew.util import rm_r
|
||||||
|
|
||||||
|
class CleanCommand(Command):
|
||||||
|
name = "clean"
|
||||||
|
usage = "%prog"
|
||||||
|
summary = "Remove stale source folders and archives"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
self._clean(PATH_BUILD)
|
||||||
|
self._clean(PATH_DISTS)
|
||||||
|
|
||||||
|
def _clean(self, root):
|
||||||
|
for dir in os.listdir(root):
|
||||||
|
rm_r("%s/%s" % (root, dir))
|
||||||
|
|
||||||
|
CleanCommand()
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
from pythonbrew.basecommand import Command, command_dict
|
||||||
|
from pythonbrew.baseparser import parser
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
|
||||||
|
class HelpCommand(Command):
|
||||||
|
name = "help"
|
||||||
|
usage = "%prog [COMMAND]"
|
||||||
|
summary = "Show available commands"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
if args:
|
||||||
|
command = args[0]
|
||||||
|
if command not in command_dict:
|
||||||
|
parser.error("Unknown command: `%s`" % command)
|
||||||
|
return
|
||||||
|
command = command_dict[command]
|
||||||
|
command.parser.print_help()
|
||||||
|
return
|
||||||
|
parser.print_help()
|
||||||
|
logger.info("\nCommands available:")
|
||||||
|
commands = [command_dict[key] for key in sorted(command_dict.keys())]
|
||||||
|
for command in commands:
|
||||||
|
logger.info(" %s: %s" % (command.name, command.summary))
|
||||||
|
logger.info("\nFurther Instructions:")
|
||||||
|
logger.info(" http://github.com/utahta/pythonbrew")
|
||||||
|
|
||||||
|
HelpCommand()
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
from pythonbrew.installer import PythonInstaller
|
||||||
|
|
||||||
|
class InstallCommand(Command):
|
||||||
|
name = "install"
|
||||||
|
usage = "%prog [OPTIONS] VERSION"
|
||||||
|
summary = "Build and install the given version of python"
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(InstallCommand, self).__init__()
|
||||||
|
self.parser.add_option(
|
||||||
|
"-f", "--force",
|
||||||
|
dest="force",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="Force installation of a Python."
|
||||||
|
)
|
||||||
|
self.parser.add_option(
|
||||||
|
"-C", "--configure",
|
||||||
|
dest="configure",
|
||||||
|
default="",
|
||||||
|
metavar="CONFIGURE_OPTIONS",
|
||||||
|
help="Custom configure options."
|
||||||
|
)
|
||||||
|
self.parser.add_option(
|
||||||
|
"-n", "--no-setuptools",
|
||||||
|
dest="no_setuptools",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="Skip installation of setuptools."
|
||||||
|
)
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
if args:
|
||||||
|
# Install Python
|
||||||
|
PythonInstaller(args[0], options).install()
|
||||||
|
else:
|
||||||
|
logger.error("Package not found.")
|
||||||
|
|
||||||
|
InstallCommand()
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import os
|
||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import PATH_PYTHONS
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class InstalledCommand(Command):
|
||||||
|
name = "installed"
|
||||||
|
usage = "%prog"
|
||||||
|
summary = "List the installed versions of python"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
cur = ""
|
||||||
|
if not os.path.islink("%s/current" % PATH_PYTHONS):
|
||||||
|
logger.info("%s (*)" % sys.executable)
|
||||||
|
elif os.path.islink("%s/current" % PATH_PYTHONS):
|
||||||
|
cur = os.path.basename(os.path.realpath("%s/current" % PATH_PYTHONS))
|
||||||
|
for d in sorted(os.listdir("%s/" % PATH_PYTHONS)):
|
||||||
|
if d == "current":
|
||||||
|
continue
|
||||||
|
if cur == d:
|
||||||
|
logger.info("%s (*)" % cur)
|
||||||
|
else:
|
||||||
|
logger.info("%s" % (d))
|
||||||
|
|
||||||
|
InstalledCommand()
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import re
|
||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import PYTHON_PACKAGE_URL
|
||||||
|
from pythonbrew.util import Package
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
|
||||||
|
class ListCommand(Command):
|
||||||
|
name = "list"
|
||||||
|
usage = "%prog [VERSION]"
|
||||||
|
summary = "List the available install version of python"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
if args:
|
||||||
|
pkg = Package(args[0])
|
||||||
|
_re = re.compile(r"%s" % pkg.name)
|
||||||
|
pkgs = []
|
||||||
|
for pkgname in self._get_packages_name():
|
||||||
|
if _re.match(pkgname):
|
||||||
|
pkgs.append(pkgname)
|
||||||
|
if pkgs:
|
||||||
|
logger.info("Pythons:")
|
||||||
|
for pkgname in pkgs:
|
||||||
|
logger.info(" %s" % pkgname)
|
||||||
|
else:
|
||||||
|
print "Package not found. `%s`" % pkg.name
|
||||||
|
else:
|
||||||
|
logger.info("Pythons:")
|
||||||
|
for pkgname in self._get_packages_name():
|
||||||
|
logger.info(" %s" % pkgname)
|
||||||
|
|
||||||
|
def _get_packages_name(self):
|
||||||
|
return ["Python-%s" % version for version in sorted(PYTHON_PACKAGE_URL.keys())]
|
||||||
|
|
||||||
|
ListCommand()
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.util import off
|
||||||
|
|
||||||
|
class OffCommand(Command):
|
||||||
|
name = "off"
|
||||||
|
usage = "%prog"
|
||||||
|
summary = "Disable pythonbrew"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
off()
|
||||||
|
|
||||||
|
OffCommand()
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import PATH_PYTHONS, PATH_BIN
|
||||||
|
from pythonbrew.util import off, symlink, Package
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
|
||||||
|
class SwitchCommand(Command):
|
||||||
|
name = "switch"
|
||||||
|
usage = "%prog VERSION"
|
||||||
|
summary = "Switch to the given version"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
if not args:
|
||||||
|
logger.error("Unrecognized command line argument: argument not found.")
|
||||||
|
sys.exit(1)
|
||||||
|
pkg = Package(args[0])
|
||||||
|
pkgname = pkg.name
|
||||||
|
pkgdir = "%s/%s" % (PATH_PYTHONS, pkgname)
|
||||||
|
if not os.path.isdir(pkgdir):
|
||||||
|
logger.error("`%s` is not installed." % pkgname)
|
||||||
|
sys.exit(1)
|
||||||
|
self._switch_dir(pkgdir)
|
||||||
|
logger.info("Switched to %s" % pkgname)
|
||||||
|
|
||||||
|
def _switch_dir(self, pkgdir):
|
||||||
|
off()
|
||||||
|
symlink(pkgdir, "%s/current" % PATH_PYTHONS)
|
||||||
|
for root, dirs, files in os.walk("%s/current/bin/" % PATH_PYTHONS):
|
||||||
|
for f in files:
|
||||||
|
symlink("%s%s" % (root, f), "%s/%s" % (PATH_BIN, f))
|
||||||
|
break
|
||||||
|
# I want better code
|
||||||
|
if not os.path.isfile("%s/python" % PATH_BIN):
|
||||||
|
if os.path.isfile("%s/python3" % PATH_BIN):
|
||||||
|
symlink(os.path.realpath("%s/python3" % PATH_BIN), "%s/python" % PATH_BIN)
|
||||||
|
elif os.path.isfile("%s/python3.0" % PATH_BIN):
|
||||||
|
symlink(os.path.realpath("%s/python3.0" % PATH_BIN), "%s/python" % PATH_BIN)
|
||||||
|
|
||||||
|
SwitchCommand()
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import PATH_PYTHONS
|
||||||
|
from pythonbrew.util import off, rm_r, Package
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
|
||||||
|
class UninstallCommand(Command):
|
||||||
|
name = "uninstall"
|
||||||
|
usage = "%prog VERSION"
|
||||||
|
summary = "Uninstall the given version of python"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
if args:
|
||||||
|
pkg = Package(args[0])
|
||||||
|
pkgname = pkg.name
|
||||||
|
pkgpath = "%s/%s" % (PATH_PYTHONS, pkgname)
|
||||||
|
if not os.path.isdir(pkgpath):
|
||||||
|
logger.error("`%s` is not installed." % pkgname)
|
||||||
|
sys.exit(1)
|
||||||
|
if os.path.islink("%s/current" % PATH_PYTHONS):
|
||||||
|
curpath = os.path.realpath("%s/current" % PATH_PYTHONS)
|
||||||
|
if pkgpath == curpath:
|
||||||
|
off()
|
||||||
|
rm_r(pkgpath)
|
||||||
|
else:
|
||||||
|
self.parser.print_help()
|
||||||
|
|
||||||
|
UninstallCommand()
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import PATH_DISTS, VERSION, PYTHONBREW_DIRNAME, ROOT
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
from pythonbrew.downloader import Downloader, get_pythonbrew_update_url
|
||||||
|
from pythonbrew.util import Subprocess, rm_r
|
||||||
|
|
||||||
|
class UpdateCommand(Command):
|
||||||
|
name = "update"
|
||||||
|
usage = "%prog"
|
||||||
|
summary = "Upgrades pythonbrew to the latest version"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
version = "head"
|
||||||
|
if args:
|
||||||
|
version = args[0]
|
||||||
|
|
||||||
|
# check for latest version
|
||||||
|
if version <= VERSION:
|
||||||
|
logger.info("You are already running the installed latest version of pythonbrew.")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
download_url = get_pythonbrew_update_url(version)
|
||||||
|
if not download_url:
|
||||||
|
logger.error("`%s` of pythonbrew not found." % version)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
distname = "pythonbrew.tgz"
|
||||||
|
download_path = "%s/%s" % (PATH_DISTS, distname)
|
||||||
|
try:
|
||||||
|
d = Downloader()
|
||||||
|
d.download(distname, download_url, download_path)
|
||||||
|
except:
|
||||||
|
logger.error("Failed to download. `%s`" % download_url)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
_re = re.compile("^%s.*" % PYTHONBREW_DIRNAME)
|
||||||
|
for name in os.listdir(PATH_DISTS):
|
||||||
|
if _re.match(name):
|
||||||
|
rm_r("%s/%s" % (PATH_DISTS, name))
|
||||||
|
try:
|
||||||
|
s = Subprocess(shell=True, cwd=PATH_DISTS, print_cmd=False)
|
||||||
|
logger.info("Extracting %s" % download_path)
|
||||||
|
s.check_call("tar zxf %s" % download_path)
|
||||||
|
except:
|
||||||
|
logger.error("Failed to update pythonbrew.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
for name in os.listdir(PATH_DISTS):
|
||||||
|
if _re.match(name):
|
||||||
|
try:
|
||||||
|
installer_path = "%s/%s" % (PATH_DISTS, name)
|
||||||
|
s = Subprocess(shell=True, cwd=PATH_DISTS, print_cmd=False)
|
||||||
|
logger.info("Installing %s into %s" % (installer_path, ROOT))
|
||||||
|
s.check_call("%s %s/pythonbrew_install.py" % (sys.executable, installer_path))
|
||||||
|
except:
|
||||||
|
logger.error("Failed to update pythonbrew.")
|
||||||
|
sys.exit(1)
|
||||||
|
break
|
||||||
|
logger.info("The pythonbrew has been updated.")
|
||||||
|
|
||||||
|
UpdateCommand()
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
from pythonbrew.basecommand import Command
|
||||||
|
from pythonbrew.define import VERSION
|
||||||
|
from pythonbrew.log import logger
|
||||||
|
|
||||||
|
class VersionCommand(Command):
|
||||||
|
name = "version"
|
||||||
|
usage = "%prog"
|
||||||
|
summary = "Show version"
|
||||||
|
|
||||||
|
def run_command(self, options, args):
|
||||||
|
logger.info(VERSION)
|
||||||
|
|
||||||
|
VersionCommand()
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
VERSION = "0.6"
|
||||||
|
|
||||||
|
if os.environ.has_key("PYTHONBREW_ROOT"):
|
||||||
|
ROOT = os.environ["PYTHONBREW_ROOT"]
|
||||||
|
else:
|
||||||
|
ROOT = os.path.join(os.environ["HOME"],".pythonbrew")
|
||||||
|
|
||||||
|
INSTALLER_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
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 = 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"
|
||||||
|
|
||||||
|
# download pythonbrew url
|
||||||
|
PYTHONBREW_UPDATE_URL = {
|
||||||
|
"head": "http://github.com/utahta/pythonbrew/tarball/master",
|
||||||
|
"0.5": "https://github.com/utahta/pythonbrew/tarball/0.5",
|
||||||
|
}
|
||||||
|
PYTHONBREW_DIRNAME = "utahta-pythonbrew"
|
||||||
|
|
||||||
|
# download Python package url
|
||||||
|
PYTHON_PACKAGE_URL = {}
|
||||||
|
PYTHON_PACKAGE_URL["1.5.2"] = "http://www.python.org/ftp/python/src/py152.tgz"
|
||||||
|
PYTHON_PACKAGE_URL["1.6.1"] = "http://www.python.org/download/releases/1.6.1/Python-1.6.1.tar.gz"
|
||||||
|
_PYTHON_PACKAGE_VERSIONS = [
|
||||||
|
"2.0", "2.0.1",
|
||||||
|
"2.1", "2.1.1", "2.1.2", "2.1.3",
|
||||||
|
"2.2", "2.2.1", "2.2.2", "2.2.3",
|
||||||
|
"2.3", "2.3.1", "2.3.2", "2.3.4", "2.3.5", "2.3.6", "2.3.7",
|
||||||
|
"2.4", "2.4.1", "2.4.2", "2.4.3", "2.4.4", "2.4.5", "2.4.6",
|
||||||
|
"2.5", "2.5.1", "2.5.2", "2.5.3", "2.5.4", "2.5.5",
|
||||||
|
"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",
|
||||||
|
]
|
||||||
|
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"
|
||||||
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
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):
|
||||||
|
self._msg = ""
|
||||||
|
self._last_msg = ""
|
||||||
|
self._bytes = 0.0
|
||||||
|
|
||||||
|
def download(self, msg, url, path):
|
||||||
|
self._msg = msg
|
||||||
|
self._bytes = 0
|
||||||
|
urllib.urlretrieve(url, path, self._download_progress)
|
||||||
|
print " downloaded."
|
||||||
|
|
||||||
|
def _download_progress(self, block, blockbytes, maxbytes):
|
||||||
|
self._bytes += float(blockbytes)
|
||||||
|
if self._bytes >= maxbytes:
|
||||||
|
self._bytes = maxbytes
|
||||||
|
percent = (self._bytes / maxbytes) * 100
|
||||||
|
max_size = size_format(maxbytes)
|
||||||
|
now_size = size_format(self._bytes)
|
||||||
|
now_msg = "\rDownloading %s (%s): %3i%% %s" % (self._msg, max_size, percent, now_size)
|
||||||
|
padding = " " * (len(self._last_msg) - len(now_msg))
|
||||||
|
sys.stdout.write("%s%s" % (now_msg, padding))
|
||||||
|
sys.stdout.flush()
|
||||||
|
self._last_msg = now_msg
|
||||||
|
|
||||||
|
def get_pythonbrew_update_url(version):
|
||||||
|
if PYTHONBREW_UPDATE_URL.has_key(version):
|
||||||
|
return PYTHONBREW_UPDATE_URL[version]
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_python_package_url(version):
|
||||||
|
if PYTHON_PACKAGE_URL.has_key(version):
|
||||||
|
return PYTHON_PACKAGE_URL[version]
|
||||||
|
return None
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
class BuildingException(Exception):
|
||||||
|
"""General exception during building"""
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
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,\
|
||||||
|
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_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
|
||||||
|
|
||||||
|
def install_pythonbrew():
|
||||||
|
makedirs(PATH_PYTHONS)
|
||||||
|
makedirs(PATH_BUILD)
|
||||||
|
makedirs(PATH_DISTS)
|
||||||
|
makedirs(PATH_ETC)
|
||||||
|
makedirs(PATH_BIN)
|
||||||
|
makedirs(PATH_LOG)
|
||||||
|
makedirs(PATH_SCRIPTS)
|
||||||
|
makedirs(PATH_SCRIPTS_PYTHONBREW)
|
||||||
|
makedirs(PATH_SCRIPTS_PYTHONBREW_COMMANDS)
|
||||||
|
|
||||||
|
for path in glob.glob(os.path.join(INSTALLER_ROOT,"*.py")):
|
||||||
|
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW)
|
||||||
|
|
||||||
|
for path in glob.glob(os.path.join(INSTALLER_ROOT,"commands","*.py")):
|
||||||
|
shutil.copy(path, PATH_SCRIPTS_PYTHONBREW_COMMANDS)
|
||||||
|
|
||||||
|
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
|
||||||
|
if __name__ == "__main__":
|
||||||
|
pythonbrew.main()
|
||||||
|
""")
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
fp = open(PATH_BIN_PYTHONBREW, "w")
|
||||||
|
fp.write("""#!/usr/bin/env bash
|
||||||
|
%s %s/pythonbrew_main.py "$@"
|
||||||
|
""" % (sys.executable, PATH_SCRIPTS))
|
||||||
|
fp.close()
|
||||||
|
os.chmod(PATH_BIN_PYTHONBREW, 0755)
|
||||||
|
symlink(PATH_BIN_PYTHONBREW, PATH_BIN_PYBREW) # pyb as pythonbrew
|
||||||
|
|
||||||
|
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.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()
|
||||||
|
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.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."
|
||||||
|
% {"pkgname":self.pkg.name})
|
||||||
|
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):
|
||||||
|
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 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 %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)
|
||||||
|
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
|
||||||
|
download_file = os.path.join(PATH_DISTS, filename)
|
||||||
|
|
||||||
|
dl = Downloader()
|
||||||
|
dl.download(filename, download_url, download_file)
|
||||||
|
|
||||||
|
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)
|
||||||
|
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 = os.path.join(install_dir,"bin","python")
|
||||||
|
|
||||||
|
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.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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
|
||||||
|
INFO = logging.INFO
|
||||||
|
ERROR = logging.ERROR
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._consumers = []
|
||||||
|
consumer = LoggerInfo()
|
||||||
|
self.add_consumer(Logger.INFO, consumer)
|
||||||
|
|
||||||
|
consumer = LoggerError()
|
||||||
|
self.add_consumer(Logger.ERROR, consumer)
|
||||||
|
|
||||||
|
def debug(self, msg, *args, **keys):
|
||||||
|
self._log(Logger.DEBUG, msg, *args, **keys)
|
||||||
|
|
||||||
|
def info(self, msg, *args, **keys):
|
||||||
|
self._log(Logger.INFO, msg, *args, **keys)
|
||||||
|
|
||||||
|
def error(self, msg, *args, **keys):
|
||||||
|
self._log(Logger.ERROR, msg, *args, **keys)
|
||||||
|
|
||||||
|
def _log(self, level, msg, *args, **keys):
|
||||||
|
for (consumer_level, consumer) in self._consumers:
|
||||||
|
if level == consumer_level:
|
||||||
|
consumer.log(level, msg, *args, **keys)
|
||||||
|
|
||||||
|
def add_consumer(self, level, consumer):
|
||||||
|
self._consumers.append((level, consumer))
|
||||||
|
|
||||||
|
logger = Logger()
|
||||||
@@ -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\]+)
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
+34
@@ -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
|
||||||
+11
@@ -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
|
||||||
|
|
||||||
+20
@@ -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
|
||||||
|
|
||||||
+20
@@ -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
|
||||||
+11
@@ -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@
|
||||||
+20
@@ -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
|
||||||
+14
@@ -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
|
||||||
+427
@@ -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 */
|
||||||
|
};
|
||||||
+20
@@ -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")
|
||||||
+18
@@ -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
|
||||||
@@ -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\]+)
|
||||||
@@ -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
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
+11
@@ -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, \
|
||||||
+18
@@ -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.
|
||||||
|
|
||||||
+51
@@ -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 ()
|
||||||
+31
@@ -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)
|
||||||
+16
@@ -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 */
|
||||||
|
|
||||||
+21
@@ -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
|
||||||
|
|
||||||
+20
@@ -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
|
||||||
+11
@@ -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
|
||||||
+13
@@ -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
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
import os
|
||||||
|
import errno
|
||||||
|
import shutil
|
||||||
|
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
|
||||||
|
import platform
|
||||||
|
|
||||||
|
def size_format(b):
|
||||||
|
kb = 1000
|
||||||
|
mb = kb*kb
|
||||||
|
b = float(b)
|
||||||
|
if b >= mb:
|
||||||
|
return "%.1fMb" % (b/mb)
|
||||||
|
if b >= kb:
|
||||||
|
return "%.1fKb" % (b/kb)
|
||||||
|
return "%.0fbytes" % (b)
|
||||||
|
|
||||||
|
def is_url(name):
|
||||||
|
if ':' not in name:
|
||||||
|
return False
|
||||||
|
scheme = name.split(':', 1)[0].lower()
|
||||||
|
return scheme in ['http', 'https', 'file', 'ftp']
|
||||||
|
|
||||||
|
def splitext(name):
|
||||||
|
base, ext = os.path.splitext(name)
|
||||||
|
if base.lower().endswith('.tar'):
|
||||||
|
ext = base[-4:] + ext
|
||||||
|
base = base[:-4]
|
||||||
|
return base, ext
|
||||||
|
|
||||||
|
def is_archive_file(name):
|
||||||
|
ext = splitext(name)[1].lower()
|
||||||
|
archives = ('.zip', '.tar.gz', '.tar.bz2', '.tgz', '.tar')
|
||||||
|
if ext in archives:
|
||||||
|
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 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)
|
||||||
|
except OSError, (e, es):
|
||||||
|
if errno.EEXIST != e:
|
||||||
|
raise
|
||||||
|
|
||||||
|
def symlink(src, dst):
|
||||||
|
try:
|
||||||
|
os.symlink(src, dst)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def unlink(path):
|
||||||
|
try:
|
||||||
|
os.unlink(path)
|
||||||
|
except OSError, (e, es):
|
||||||
|
if errno.ENOENT != e:
|
||||||
|
raise
|
||||||
|
|
||||||
|
def rm_r(path):
|
||||||
|
"""like rm -r command."""
|
||||||
|
if os.path.isdir(path):
|
||||||
|
shutil.rmtree(path)
|
||||||
|
else:
|
||||||
|
unlink(path)
|
||||||
|
|
||||||
|
def off():
|
||||||
|
for root, dirs, files in os.walk(PATH_BIN):
|
||||||
|
for f in files:
|
||||||
|
if f == "pythonbrew" or f == "pybrew":
|
||||||
|
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
|
||||||
|
self._shell = shell
|
||||||
|
self._cwd = cwd
|
||||||
|
self._print_cmd = print_cmd
|
||||||
|
|
||||||
|
def chdir(self, cwd):
|
||||||
|
self._cwd = cwd
|
||||||
|
|
||||||
|
def check_call(self, cmd, shell=None, cwd=None):
|
||||||
|
if shell:
|
||||||
|
self._shell = shell
|
||||||
|
if cwd:
|
||||||
|
self._cwd = cwd
|
||||||
|
if self._print_cmd:
|
||||||
|
logger.info(cmd)
|
||||||
|
if self._log:
|
||||||
|
cmd = "(%s) >> '%s' 2>&1" % (cmd, self._log)
|
||||||
|
retcode = subprocess.call(cmd, shell=self._shell, cwd=self._cwd)
|
||||||
|
if retcode != 0:
|
||||||
|
raise BuildingException()
|
||||||
|
|
||||||
|
class Package(object):
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = None
|
||||||
|
self.version = None
|
||||||
|
m = re.search("^Python-(.*)$", name)
|
||||||
|
if m:
|
||||||
|
self.name = name
|
||||||
|
self.version = m.group(1)
|
||||||
|
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])
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
from pythonbrew.installer import install_pythonbrew
|
||||||
|
if __name__ == "__main__":
|
||||||
|
install_pythonbrew()
|
||||||
Reference in New Issue
Block a user