[63720] trunk/dports/lang

jwa at macports.org jwa at macports.org
Sat Feb 13 10:55:02 PST 2010


Revision: 63720
          http://trac.macports.org/changeset/63720
Author:   jwa at macports.org
Date:     2010-02-13 10:54:59 -0800 (Sat, 13 Feb 2010)
Log Message:
-----------
first port of python 2.7, this is alpha release, port is preliminary, it should allow some testing, though

Added Paths:
-----------
    trunk/dports/lang/python27/
    trunk/dports/lang/python27/Portfile
    trunk/dports/lang/python27/files/
    trunk/dports/lang/python27/files/_localemodule.c.ed
    trunk/dports/lang/python27/files/locale.py.ed
    trunk/dports/lang/python27/files/patch-Lib-cgi.py.diff
    trunk/dports/lang/python27/files/patch-Lib-ctypes-macholib-dyld.py.diff
    trunk/dports/lang/python27/files/patch-Lib-distutils-dist.py.diff
    trunk/dports/lang/python27/files/patch-Mac-IDLE-Makefile.in.diff
    trunk/dports/lang/python27/files/patch-Mac-Makefile.in.diff
    trunk/dports/lang/python27/files/patch-Mac-PythonLauncher-Makefile.in.diff
    trunk/dports/lang/python27/files/patch-Mac-Tools-Doc-setup.py.diff
    trunk/dports/lang/python27/files/patch-Makefile.pre.in.diff
    trunk/dports/lang/python27/files/patch-readlinefix.diff
    trunk/dports/lang/python27/files/patch-setup.py.diff
    trunk/dports/lang/python27/files/patch-setup_no_tkinter.py.diff
    trunk/dports/lang/python27/files/posixmodule.c.ed
    trunk/dports/lang/python27/files/pyconfig.ed
    trunk/dports/lang/python27/files/python27

Added: trunk/dports/lang/python27/Portfile
===================================================================
--- trunk/dports/lang/python27/Portfile	                        (rev 0)
+++ trunk/dports/lang/python27/Portfile	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,172 @@
+# $Id: Portfile 62611 2010-01-12 05:18:08Z blb at macports.org $
+
+PortSystem 1.0
+PortGroup select 1.0
+
+name                    python27
+version                 2.7a3
+#set major               [lindex [split $version .] 0]
+#set branch              [join [lrange [split ${version} .] 0 1] .]
+set branch              2.7
+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.
+
+notes \
+   To fully complete your installation and make python ${branch} the default, \
+   please run:\n \
+   \tsudo port install python_select\n \
+   \tsudo python_select ${name}
+
+homepage                http://www.python.org/
+master_sites            ${homepage}/ftp/python/${branch}/ \
+                        ftp://ftp.python.org/pub/python/${branch}/
+
+distname                Python-${version}
+use_bzip2               yes
+
+checksums           md5     16970db11bd086bd12b9af1394da2def \
+                    sha1    ff46c0307feae2304622d7c54c59d33f8ae3e8c5 \
+                    rmd160  796c5651a35b5673490deb0a2e06cc28f0bb8802
+
+# patch-Lib-distutils-dist.py.diff comes from
+# <http://bugs.python.org/issue1180>
+# Setting PYTHONHOME with patch-Mac-IDLE-Makefile.in.diff,
+# patch-Mac-Makefile.in.diff, and patch-Mac-PythonLauncher-Makefile.in.diff
+# is to work around http://bugs.python.org/issue5766
+# patch-readlinefix.diff comes from
+# <http://bugs.python.org/issue5833>
+patchfiles              patch-Makefile.pre.in.diff \
+                        patch-setup.py.diff \
+                        patch-Lib-cgi.py.diff \
+                        patch-Mac-IDLE-Makefile.in.diff \
+                        patch-Mac-Makefile.in.diff \
+                        patch-Mac-PythonLauncher-Makefile.in.diff \
+                        patch-Lib-ctypes-macholib-dyld.py.diff
+
+#                        patch-Mac-Tools-Doc-setup.py.diff
+#                        patch-readlinefix.diff
+#                        patch-Lib-distutils-dist.py.diff
+
+depends_lib             port:gettext port:zlib port:openssl port:tk \
+                        port:sqlite3 port:db46 port:ncurses port:gdbm \
+                        port:bzip2 port:readline
+
+configure.args          --enable-framework=${frameworks_dir} \
+                        --enable-ipv6
+
+configure.cppflags-append -I${prefix}/include/ncurses
+
+post-patch {
+   reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Lib/cgi.py \
+      ${worksrcpath}/Lib/ctypes/macholib/dyld.py
+   reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|g" \
+      ${worksrcpath}/Mac/Makefile.in ${worksrcpath}/Mac/IDLE/Makefile.in \
+      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
+
+#      ${worksrcpath}/Mac/Tools/Doc/setup.py 
+
+   # See http://trac.macports.org/changeset/37861
+   reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
+      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
+
+   # http://trac.macports.org/ticket/21517
+#   system "cd ${worksrcpath} && ed - Modules/_localemodule.c < ${filespath}/_localemodule.c.ed"
+#   system "cd ${worksrcpath} && ed - Lib/locale.py < ${filespath}/locale.py.ed"
+
+   if {${os.platform} == "darwin" && ${os.major} > 9} {
+      # http://trac.macports.org/ticket/21559
+      system "cd ${worksrcpath} && ed - Modules/posixmodule.c < ${filespath}/posixmodule.c.ed"
+   }
+}
+
+build.target            all
+
+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}]
+
+post-destroot {
+   set framewpath ${frameworks_dir}/Python.framework
+   set framewdir  ${framewpath}/Versions/${branch}
+
+   foreach dir { Headers Resources Python Versions/Current } {
+      file delete ${destroot}${framewpath}/${dir}
+   }
+
+   ln -s ${framewdir}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1
+   ln -s ${framewdir}/Python ${destroot}${prefix}/lib/libpython${branch}.dylib
+   ln -s ${framewdir}/bin/2to3 ${destroot}${prefix}/bin/2to3-${branch}
+
+   # Without this, LINKFORSHARED is set to 
+   # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
+   # (this becomes Python.framework/Versions/2.6/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.6/Python)
+   reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile
+
+   foreach unversionedFile {idle pydoc python python-config pythonw smtpd.py} {
+      delete ${destroot}${prefix}/bin/${unversionedFile}
+   }
+}
+
+platform darwin {
+   post-configure {
+      # See http://trac.macports.org/ticket/18376
+      system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
+   }
+}
+
+variant universal {
+   post-patch {
+      set universal_arch_flags {}
+      set arch_run_32bit {}
+      foreach arch ${universal_archs} {
+         lappend universal_arch_flags -arch ${arch}
+         if { ${arch}=="i386" || ${arch}=="ppc" } {
+            lappend arch_run_32bit -${arch}
+         }
+      }
+      reinplace \
+         "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
+         ${worksrcpath}/configure
+      if {${os.major} >= 9} {
+         reinplace \
+            "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
+            ${worksrcpath}/configure
+      }
+   }
+   if {${macosx_version} == "10.4" && ${os.arch} == "powerpc"} {
+      configure.args-append   --enable-universalsdk=${developer_dir}/SDKs/MacOSX10.4u.sdk
+   } else {
+      configure.args-append   --enable-universalsdk=/
+   }
+}
+
+variant ucs4 description {Enable support for UCS4} {
+   configure.args-append   --enable-unicode=ucs4
+}
+
+variant no_tkinter description {Disable Tkinter support, which will break IDLE} {
+   patchfiles-append    patch-setup_no_tkinter.py.diff
+   depends_lib-delete   port:tk 
+}
+
+
+livecheck.type          regex
+livecheck.url           ${homepage}download/releases/
+livecheck.regex         Python (${branch}(?:\\.\\d+)*)
+

Added: trunk/dports/lang/python27/files/_localemodule.c.ed
===================================================================
--- trunk/dports/lang/python27/files/_localemodule.c.ed	                        (rev 0)
+++ trunk/dports/lang/python27/files/_localemodule.c.ed	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,3 @@
+g/defined(__APPLE__)/s//0/g
+w
+

Added: trunk/dports/lang/python27/files/locale.py.ed
===================================================================
--- trunk/dports/lang/python27/files/locale.py.ed	                        (rev 0)
+++ trunk/dports/lang/python27/files/locale.py.ed	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,3 @@
+g/'darwin', /s///
+w
+

Added: trunk/dports/lang/python27/files/patch-Lib-cgi.py.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Lib-cgi.py.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Lib-cgi.py.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -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.6
+ 
+-# 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.
+ 

Added: trunk/dports/lang/python27/files/patch-Lib-ctypes-macholib-dyld.py.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Lib-ctypes-macholib-dyld.py.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Lib-ctypes-macholib-dyld.py.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,11 @@
+--- Lib/ctypes/macholib/dyld.py.orig	2008-02-21 11:52:20.000000000 -0700
++++ Lib/ctypes/macholib/dyld.py	2009-10-11 02:42:21.000000000 -0600
+@@ -26,7 +26,7 @@
+ 
+ DEFAULT_LIBRARY_FALLBACK = [
+     os.path.expanduser("~/lib"),
+-    "/usr/local/lib",
++    "@@PREFIX@@/lib",
+     "/lib",
+     "/usr/lib",
+ ]

Added: trunk/dports/lang/python27/files/patch-Lib-distutils-dist.py.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Lib-distutils-dist.py.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Lib-distutils-dist.py.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,51 @@
+--- Lib/distutils/dist.py.orig	2008-09-03 05:13:56.000000000 -0600
++++ Lib/distutils/dist.py	2008-10-03 18:33:47.000000000 -0600
+@@ -60,6 +60,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
+@@ -267,6 +268,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__ ()
+@@ -327,6 +334,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()
+@@ -347,7 +357,7 @@
+ 
+         # And look for the user config file
+         user_file = os.path.join(os.path.expanduser('~'), user_filename)
+-        if os.path.isfile(user_file):
++        if self.want_user_cfg and os.path.isfile(user_file):
+             files.append(user_file)
+ 
+         # All platforms support local setup.cfg
+@@ -355,6 +365,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 ()

Added: trunk/dports/lang/python27/files/patch-Mac-IDLE-Makefile.in.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Mac-IDLE-Makefile.in.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Mac-IDLE-Makefile.in.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,20 @@
+--- Mac/IDLE/Makefile.in.orig	2009-01-02 04:47:17.000000000 -0700
++++ Mac/IDLE/Makefile.in	2009-04-16 00:54:43.000000000 -0600
+@@ -22,7 +22,7 @@
+ 
+ BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
+ 
+-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
++PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
+ 
+ all: IDLE.app
+ 
+@@ -42,7 +42,7 @@
+ 		$(srcdir)/../Icons/PythonSource.icns \
+ 		$(srcdir)/../Icons/PythonCompiled.icns Info.plist
+ 	rm -fr IDLE.app
+-	$(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
++	PYTHONHOME=$(DESTDIR)$(prefix) $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
+ 		--builddir=. \
+ 		--name=IDLE \
+ 		--link-exec \

Added: trunk/dports/lang/python27/files/patch-Mac-Makefile.in.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Mac-Makefile.in.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Mac-Makefile.in.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,20 @@
+--- Mac/Makefile.in.orig	2009-03-30 13:58:41.000000000 -0600
++++ Mac/Makefile.in	2009-04-16 00:54:26.000000000 -0600
+@@ -19,7 +19,7 @@
+ 
+ # These are normally glimpsed from the previous set
+ bindir=$(prefix)/bin
+-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
++PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
+ APPINSTALLDIR=$(prefix)/Resources/Python.app
+ 
+ # Variables for installing the "normal" unix binaries
+@@ -224,7 +224,7 @@
+ 	cd IDLE && make install
+ 
+ install_BuildApplet:
+-	$(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
++	PYTHONHOME=$(DESTDIR)$(prefix) $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
+ 		--destroot "$(DESTDIR)" \
+ 		--python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"`  \
+ 		--output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \

Added: trunk/dports/lang/python27/files/patch-Mac-PythonLauncher-Makefile.in.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Mac-PythonLauncher-Makefile.in.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Mac-PythonLauncher-Makefile.in.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,25 @@
+--- Mac/PythonLauncher/Makefile.in.orig	2009-01-02 04:47:17.000000000 -0700
++++ Mac/PythonLauncher/Makefile.in	2009-04-16 00:55:11.000000000 -0600
+@@ -1,3 +1,4 @@
++prefix=@prefix@
+ CC=@CC@
+ LD=@CC@
+ BASECFLAGS=@BASECFLAGS@
+@@ -21,7 +22,7 @@
+ 
+ BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
+ 
+-PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
++PYTHONAPPSDIR=@@APPLICATIONS_DIR@@/$(PYTHONFRAMEWORK) $(VERSION)
+ OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
+ 
+ all: Python\ Launcher.app
+@@ -42,7 +43,7 @@
+ 		$(srcdir)/../Icons/PythonCompiled.icns \
+ 		$(srcdir)/factorySettings.plist
+ 	rm -fr "Python Launcher.app"
+-	$(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
++	PYTHONHOME=$(DESTDIR)$(prefix) $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
+ 		--builddir=. \
+ 		--name="Python Launcher" \
+ 		--executable="Python Launcher" \

Added: trunk/dports/lang/python27/files/patch-Mac-Tools-Doc-setup.py.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Mac-Tools-Doc-setup.py.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Mac-Tools-Doc-setup.py.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,11 @@
+--- Mac/Tools/Doc/setup.py.diff	2008-03-29 09:24:25.000000000 -0600
++++ Mac/Tools/Doc/setup.py	2008-10-04 19:53:40.000000000 -0600
+@@ -30,7 +30,7 @@
+ 
+ MAJOR_VERSION='2.4'
+ MINOR_VERSION='2.4.1'
+-DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
++DESTDIR='@@APPLICATIONS_DIR@@/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
+ 
+ class DocBuild(build):
+     def initialize_options(self):

Added: trunk/dports/lang/python27/files/patch-Makefile.pre.in.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-Makefile.pre.in.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-Makefile.pre.in.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,31 @@
+--- Makefile.pre.in.orig	2008-06-19 20:47:03.000000000 -0600
++++ Makefile.pre.in	2008-07-28 19:57:15.000000000 -0600
+@@ -394,8 +394,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
+@@ -993,7 +993,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) \
+@@ -1073,7 +1073,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)

Added: trunk/dports/lang/python27/files/patch-readlinefix.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-readlinefix.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-readlinefix.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,162 @@
+--- Modules/readline.c	2008-11-04 12:43:31.000000000 -0800
++++ Modules/readline.c	2009-04-22 15:50:49.000000000 -0700
+@@ -759,6 +759,10 @@
+ static char **
+ flex_complete(char *text, int start, int end)
+ {
++#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
++	rl_completion_append_character ='\0';
++	rl_completion_suppress_append = 0;
++#endif
+ 	Py_XDECREF(begidx);
+ 	Py_XDECREF(endidx);
+ 	begidx = PyInt_FromLong((long) start);
+@@ -799,11 +803,8 @@
+ 	rl_attempted_completion_function = (CPPFunction *)flex_complete;
+ 	/* Set Python word break characters */
+ 	rl_completer_word_break_characters =
+-		strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?");
++		strdup(" \t\n`!@#%^&*()=+[{]}\\|;:,<>?");
+ 		/* All nonalphanums except '.' */
+-#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
+-	rl_completion_append_character ='\0';
+-#endif
+ 
+ 	begidx = PyInt_FromLong(0L);
+ 	endidx = PyInt_FromLong(0L);
+--- Lib/rlcompleter.py	2009-04-22 15:42:38.000000000 -0700
++++ Lib/rlcompleter.py	2009-04-22 15:43:00.000000000 -0700
+@@ -1,9 +1,10 @@
+ """Word completion for GNU readline 2.0.
+ 
+ This requires the latest extension to the readline module. The completer
+-completes keywords, built-ins and globals in a selectable namespace (which
+-defaults to __main__); when completing NAME.NAME..., it evaluates (!) the
+-expression up to the last dot and completes its attributes.
++completes keywords, built-ins, globals, and file names in a selectable
++namespace (which defaults to __main__); when completing NAME.NAME...,
++it evaluates (!) the expression up to the last dot and completes its
++attributes.
+ 
+ It's very cool to do "import sys" type "sys.", hit the
+ completion key (twice), and see the list of names defined by the
+@@ -72,24 +73,34 @@
+             self.use_main_ns = 0
+             self.namespace = namespace
+ 
++        # The cache of matches for a particular text fragment.
++        self.matches = []
++
+     def complete(self, text, state):
+         """Return the next possible completion for 'text'.
+ 
+         This is called successively with state == 0, 1, 2, ... until it
+-        returns None.  The completion should begin with 'text'.
++        returns None.  The completion should begin with 'text'.  Any text
++        with a period (.) will match as an attribute.  Any text that begins
++        with a single or double quote will match using file name expansion.
+ 
+         """
+         if self.use_main_ns:
+             self.namespace = __main__.__dict__
+ 
++        # For the first call with this set of text, compute all possible
++        # matches and store them in a member variable.  Subsequent calls
++        # will then iterate through this set of matches.
+         if state == 0:
+-            if "." in text:
++            if ('"' in text) or ("'" in text):
++                self.matches = self.file_matches(text)
++            elif "." in text:
+                 self.matches = self.attr_matches(text)
+             else:
+                 self.matches = self.global_matches(text)
+-        try:
++        if state < len(self.matches):
+             return self.matches[state]
+-        except IndexError:
++        else:
+             return None
+ 
+     def _callable_postfix(self, val, word):
+@@ -129,9 +140,14 @@
+ 
+         """
+         import re
++        import types
++
++        # Setup the regular expression for attributes
+         m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
+         if not m:
+             return []
++
++        # Group 1 is the class name, group 3 is the attribute text
+         expr, attr = m.group(1, 3)
+         try:
+             thisobject = eval(expr, self.namespace)
+@@ -143,9 +159,18 @@
+         if "__builtins__" in words:
+             words.remove("__builtins__")
+ 
+-        if hasattr(thisobject, '__class__'):
+-            words.append('__class__')
+-            words.extend(get_class_members(thisobject.__class__))
++        # If this type is a class instance, use the __class__ member to
++        # get the dictionary of attributes
++        if type(thisobject) == types.InstanceType:
++            if hasattr(thisobject, '__class__'):
++                words.append('__class__')
++                words.extend(get_class_members(thisobject.__class__))
++        elif type(thisobject) == types.ClassType:
++            words.extend(get_class_members(thisobject))
++        else:
++            words.extend(dir(thisobject))
++
++        # Build the full matching text from class.attribute matches
+         matches = []
+         n = len(attr)
+         for word in words:
+@@ -155,6 +180,43 @@
+                 matches.append(word)
+         return matches
+ 
++    def file_matches(self, text):
++        """Compute matches when text is a file name.
++
++        Expects a leading single or double quote character in the text.
++        Will expand a leading ~ or ~user to a valid home directory.
++        Will expand a leading $VAR to an environment variable name."""
++        import glob
++        import os
++
++        # save the leading quote character so we can re-add it later
++        quote = text[0]
++        # strip the leading quote character
++        path = text[1:]
++
++        # expand a tilde (~) or a leading environment variable in the text
++        path = os.path.expanduser( path )
++        path = os.path.expandvars( path )
++
++        # append the any match character to send to the glob routine
++        path = path + "*"
++
++        # use the glob module to get all of the matches
++        rawMatches = glob.glob( path )
++
++        # re-prefix the text with the quoting character and append the correct
++        # terminating character depending on the type of match that was found.
++        # Directories are terminated with '/' and files with an ending quote.
++        matches = []
++        for entry in rawMatches:
++            if os.path.isdir( entry ):
++                matches.append( quote + entry + os.sep )
++            elif os.path.isfile( entry ):
++                matches.append( quote + entry + quote )
++            else:
++                matches.append( quote + entry )
++        return matches
++
+ def get_class_members(klass):
+     ret = dir(klass)
+     if hasattr(klass,'__bases__'):

Added: trunk/dports/lang/python27/files/patch-setup.py.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-setup.py.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-setup.py.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,53 @@
+--- setup.py.orig	2009-04-01 05:20:48.000000000 +1100
++++ setup.py	2009-09-03 10:20:32.000000000 +1000
+@@ -1494,7 +1496,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']
+ 
+         # All existing framework builds of Tcl/Tk don't support 64-bit
+@@ -1529,13 +1531,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
+@@ -1583,17 +1579,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':

Added: trunk/dports/lang/python27/files/patch-setup_no_tkinter.py.diff
===================================================================
--- trunk/dports/lang/python27/files/patch-setup_no_tkinter.py.diff	                        (rev 0)
+++ trunk/dports/lang/python27/files/patch-setup_no_tkinter.py.diff	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,11 @@
+--- setup.py.orig	2009-03-31 12:20:48.000000000 -0600
++++ setup.py	2009-09-17 00:33:12.000000000 -0600
+@@ -17,7 +17,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 = ["_tkinter"]
+ 
+ def add_dir_to_list(dirlist, dir):
+     """Add the directory 'dir' to the list 'dirlist' (at the front) if

Added: trunk/dports/lang/python27/files/posixmodule.c.ed
===================================================================
--- trunk/dports/lang/python27/files/posixmodule.c.ed	                        (rev 0)
+++ trunk/dports/lang/python27/files/posixmodule.c.ed	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,66 @@
+/PyInt_FromLong((long)st->st_uid)/s//PyInt_FromLong((long)(int)st->st_uid)/
+/PyInt_FromLong((long)st->st_gid)/s//PyInt_FromLong((long)(int)st->st_gid)/
+/^posix_chown/a
+.
+/long uid, gid;/s//int uid, gid;/
+/"etll:chown"/s//"etii:chown"/
+/return PyInt_FromLong((long)getegid());/s//return PyInt_FromLong((long)(int)getegid());/
+/return PyInt_FromLong((long)geteuid());/s//return PyInt_FromLong((long)(int)geteuid());/
+/return PyInt_FromLong((long)getgid());/s//return PyInt_FromLong((long)(int)getgid());/
+/^posix_getgroups/-1i
+#include <pwd.h>
+int getgrouplist_2(const char *name, gid_t basegid, gid_t **groups);
+
+.
+/gid_t grouplist\[MAX_GROUPS\];/c
+        gid_t *grouplist = NULL;
+        struct passwd *pw;
+.
+/n = getgroups(MAX_GROUPS, grouplist);/c
+        if ((pw = getpwuid(getuid())) == NULL) {
+            errno = EINVAL;
+            posix_error();
+            return NULL;
+        }
+        n = getgrouplist_2(pw->pw_name, pw->pw_gid, &grouplist);
+.
+/if (n < 0)/c
+        if (n < 0) {
+            errno = EINVAL;
+.
+/else {/s//} else {/
+/PyInt_FromLong((long)grouplist\[i\]);/s//PyInt_FromLong((long)(int)grouplist[i]);/
+/return result;/i
+    if (grouplist) free(grouplist);
+.
+/return PyInt_FromLong((long)getuid());/s//return PyInt_FromLong((long)(int)getuid());/
+/^posix_setgroups/a
+.
+/gid_t grouplist\[MAX_GROUPS\];/s//gid_t *grouplist;/
+/if (len > MAX_GROUPS) {/a
+.
+.,/^[ 	]*}/c
+	if ((grouplist = (gid_t *)malloc(len * sizeof(gid_t))) == NULL) {
+		PyErr_NoMemory();
+		return NULL;
+	}
+.
+/if (grouplist\[i\] != x) {/s//if ((int)grouplist[i] != x) {/
+/if (grouplist\[i\] != x) {/s//if ((int)grouplist[i] != x) {/
+/Py_INCREF(Py_None);/i
+	free(grouplist);
+.
+/^static struct constdef posix_constants_confstr/a
+.
+/^};/i
+#ifdef _CS_DARWIN_USER_DIR
+    {"CS_DARWIN_USER_DIR", _CS_DARWIN_USER_DIR},
+#endif
+#ifdef _CS_DARWIN_USER_TEMP_DIR
+    {"CS_DARWIN_USER_TEMP_DIR", _CS_DARWIN_USER_TEMP_DIR},
+#endif
+#ifdef _CS_DARWIN_USER_CACHE_DIR
+    {"CS_DARWIN_USER_CACHE_DIR", _CS_DARWIN_USER_CACHE_DIR},
+#endif
+.
+w

Added: trunk/dports/lang/python27/files/pyconfig.ed
===================================================================
--- trunk/dports/lang/python27/files/pyconfig.ed	                        (rev 0)
+++ trunk/dports/lang/python27/files/pyconfig.ed	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,2 @@
+g,.*\(HAVE_POLL[_A-Z]*\).*,s,,/* #undef \1 */,
+w

Added: trunk/dports/lang/python27/files/python27
===================================================================
--- trunk/dports/lang/python27/files/python27	                        (rev 0)
+++ trunk/dports/lang/python27/files/python27	2010-02-13 18:54:59 UTC (rev 63720)
@@ -0,0 +1,12 @@
+bin/python2.7
+bin/pythonw2.7
+bin/python2.7-config
+bin/idle2.7
+bin/pydoc2.7
+bin/smtpd2.7.py
+share/man/man1/python2.7.1
+-
+${frameworks_dir}/Python.framework/Versions/2.7
+${frameworks_dir}/Python.framework/Versions/2.7/Headers
+${frameworks_dir}/Python.framework/Versions/2.7/Resources
+${frameworks_dir}/Python.framework/Versions/2.7/Python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100213/6d38783b/attachment-0001.html>


More information about the macports-changes mailing list