Thomas Waldmann avatar Thomas Waldmann committed 38b5c27

raise minimum requirement to python 2.7

now that debian wheezy is stable (and thus even debian stable has python 2.7 -
almost 3 years after the python 2.7 release), it is time to move on.

there are some nice features in 2.7 - we can use them now:

http://docs.python.org/2.7/whatsnew/2.7.html

there is also no risk any more that language or library features creep in
unnoticed that are incompatible with the minimum requirement.
we also save some time as we don't have to test on / care for 2.6 any more.

about this changeset:

most should be self-explanatory, except this:

MoinMoin/constants/keys.py - we could not use unicode key constants yet due
to a bug in pre-2.6.5 python that did not allow unicode keys in kwargs.

The change in MoinMoin/storage/middleware/indexing.py is also related to that,
we just had to make sure keys are str, not unicode as that dict later was
exploded into a function call like f(**doc).

notes for developers:
if you developed on 2.6 until now, you need to create a fresh new virtualenv
using python 2.7.

Comments (0)

Files changed (10)

MoinMoin/__init__.py

 project = "MoinMoin"
 
 import sys
-if sys.hexversion < 0x2060000:
-    sys.exit("%s requires Python 2.6 or greater.\n" % project)
+if sys.hexversion < 0x2070000:
+    sys.exit("%s requires Python 2.7.x.\n" % project)
 
 
 from MoinMoin.util.version import Version

MoinMoin/auth/_tests/test_ldap_login.py

 from MoinMoin._tests import wikiconfig
 from MoinMoin.auth import handle_login
 
-# first check if we have python 2.4, python-ldap and slapd:
 msg = check_environ()
 if msg:
     pytest.skip(msg)

MoinMoin/constants/keys.py

 MoinMoin - meta data key / index field name related constants
 """
 
-# IMPORTANT: until we require a python >= 2.6.5, we need to keep the keys as
-#            str (not unicode), because of "Issue #4978: Passing keyword
-#            arguments as unicode strings is now allowed." (from 2.6.5 chglog)
-
 # metadata keys
-NAME = "name"
-NAME_OLD = "name_old"
-NAMESPACE = "namespace"
+NAME = u"name"
+NAME_OLD = u"name_old"
+NAMESPACE = u"namespace"
 
 # if an item is reverted, we store the revision number we used for reverting there:
-REVERTED_TO = "reverted_to"
+REVERTED_TO = u"reverted_to"
 
 # some metadata key constants:
-ACL = "acl"
+ACL = u"acl"
 
 # keys for storing group and dict information
 # group of user names, e.g. for ACLs:
-USERGROUP = "usergroup"
+USERGROUP = u"usergroup"
 # needs more precise name / use case:
-SOMEDICT = "somedict"
+SOMEDICT = u"somedict"
 
-CONTENTTYPE = "contenttype"
-ITEMTYPE = "itemtype"
-SIZE = "size"
-LANGUAGE = "language"
-EXTERNALLINKS = "externallinks"
-ITEMLINKS = "itemlinks"
-ITEMTRANSCLUSIONS = "itemtransclusions"
-TAGS = "tags"
+CONTENTTYPE = u"contenttype"
+ITEMTYPE = u"itemtype"
+SIZE = u"size"
+LANGUAGE = u"language"
+EXTERNALLINKS = u"externallinks"
+ITEMLINKS = u"itemlinks"
+ITEMTRANSCLUSIONS = u"itemtransclusions"
+TAGS = u"tags"
 
-ACTION = "action"
-ADDRESS = "address"
-HOSTNAME = "hostname"
-USERID = "userid"
-MTIME = "mtime"
-EXTRA = "extra"
-COMMENT = "comment"
-SUMMARY = "summary"
+ACTION = u"action"
+ADDRESS = u"address"
+HOSTNAME = u"hostname"
+USERID = u"userid"
+MTIME = u"mtime"
+EXTRA = u"extra"
+COMMENT = u"comment"
+SUMMARY = u"summary"
 
 # we need a specific hash algorithm to store hashes of revision data into meta
 # data. meta[HASH_ALGORITHM] = hash(rev_data, HASH_ALGORITHM)
 # some backends may use this also for other purposes.
-HASH_ALGORITHM = 'sha1'
+HASH_ALGORITHM = u"sha1"
 HASH_LEN = 40  # length of hex str representation of hash value
 
 # some field names for whoosh index schema / documents in index:
-NAME_EXACT = "name_exact"
-ITEMID = "itemid"
-REVID = "revid"
-PARENTID = "parentid"
-DATAID = "dataid"
-WIKINAME = "wikiname"
-CONTENT = "content"
+NAME_EXACT = u"name_exact"
+ITEMID = u"itemid"
+REVID = u"revid"
+PARENTID = u"parentid"
+DATAID = u"dataid"
+WIKINAME = u"wikiname"
+CONTENT = u"content"
 
 # magic REVID for current revision:
-CURRENT = "current"
+CURRENT = u"current"
 
 # stuff from user profiles / for whoosh index
-EMAIL = "email"
-OPENID = "openid"
-DISPLAY_NAME = "display_name"
-THEME_NAME = "theme_name"
-LOCALE = "locale"
-TIMEZONE = "timezone"
-ENC_PASSWORD = "enc_password"
-SUBSCRIBED_ITEMS = "subscribed_items"
-BOOKMARKS = "bookmarks"
-QUICKLINKS = "quicklinks"
-SESSION_KEY = "session_key"
-SESSION_TOKEN = "session_token"
-RECOVERPASS_KEY = "recoverpass_key"
-EDIT_ON_DOUBLECLICK = "edit_on_doubleclick"
-SCROLL_PAGE_AFTER_EDIT = "scroll_page_after_edit"
-SHOW_COMMENTS = "show_comments"
-MAILTO_AUTHOR = "mailto_author"
-CSS_URL = "css_url"
-EDIT_ROWS = "edit_rows"
-RESULTS_PER_PAGE = "results_per_page"
-WANT_TRIVIAL = "want_trivial"
-EMAIL_SUBSCRIBED_EVENTS = "email_subscribed_events"
-DISABLED = "disabled"
+EMAIL = u"email"
+OPENID = u"openid"
+DISPLAY_NAME = u"display_name"
+THEME_NAME = u"theme_name"
+LOCALE = u"locale"
+TIMEZONE = u"timezone"
+ENC_PASSWORD = u"enc_password"
+SUBSCRIBED_ITEMS = u"subscribed_items"
+BOOKMARKS = u"bookmarks"
+QUICKLINKS = u"quicklinks"
+SESSION_KEY = u"session_key"
+SESSION_TOKEN = u"session_token"
+RECOVERPASS_KEY = u"recoverpass_key"
+EDIT_ON_DOUBLECLICK = u"edit_on_doubleclick"
+SCROLL_PAGE_AFTER_EDIT = u"scroll_page_after_edit"
+SHOW_COMMENTS = u"show_comments"
+MAILTO_AUTHOR = u"mailto_author"
+CSS_URL = u"css_url"
+EDIT_ROWS = u"edit_rows"
+RESULTS_PER_PAGE = u"results_per_page"
+WANT_TRIVIAL = u"want_trivial"
+EMAIL_SUBSCRIBED_EVENTS = u"email_subscribed_events"
+DISABLED = u"disabled"
 
 # in which backend is some revision stored?
-BACKENDNAME = "backendname"
+BACKENDNAME = u"backendname"
 
 USEROBJ_ATTRS = [
     # User objects proxy these attributes of the UserProfile objects:
 ]
 
 # keys for blog homepages
-LOGO = "logo"
-SUPERTAGS = "supertags"
+LOGO = u"logo"
+SUPERTAGS = u"supertags"
 # keys for blog entries
-PTIME = "ptime"
+PTIME = u"ptime"
 
 # keys for tickets
-EFFORT = "effort"
-DIFFICULTY = "difficulty"
-SEVERITY = "severity"
-PRIORITY = "priority"
-ASSIGNED_TO = "assigned_to"
-SUPERSEDED_BY = "superseded_by"
-DEPENDS_ON = "depends_on"
-CLOSED = "closed"
+EFFORT = u"effort"
+DIFFICULTY = u"difficulty"
+SEVERITY = u"severity"
+PRIORITY = u"priority"
+ASSIGNED_TO = u"assigned_to"
+SUPERSEDED_BY = u"superseded_by"
+DEPENDS_ON = u"depends_on"
+CLOSED = u"closed"
 
 # index names
 LATEST_REVS = 'latest_revs'

MoinMoin/converter/text_csv_in.py

     def __call__(self, data, contenttype=None, arguments=None):
         text = decode_data(data, contenttype)
         content = normalize_split_text(text)
-        # as of py 2.6.5 (and in the year 2010), the csv module seems to still
+        # as of py 2.7.x (and in the year 2013), the csv module seems to still
         # have troubles with unicode, thus we encode to utf-8 ...
         content = [line.encode('utf-8') for line in content]
         dialect = csv.Sniffer().sniff(content[0])

MoinMoin/storage/middleware/indexing.py

     :param wikiname: interwikiname of this wiki
     :returns: document to put into whoosh index
     """
-    doc = dict([(str(key), value)
+    doc = dict([(key, value)
                 for key, value in meta.items()
                 if key in schema])
     for key in [MTIME, PTIME]:

MoinMoin/util/crypto.py

 - generate password recovery tokens
 - verify password recovery tokens
 - generate random strings of given length (for salting)
-
-Code is tested on Python 2.6/2.7.
 """
 
 from __future__ import absolute_import, division

docs/admin/requirements.rst

 Requirements
 ============
 
-MoinMoin requires Python >= 2.6 and < 3.0.
+MoinMoin requires Python 2.7.x.
 We usually test using CPython and this is what we recommend.
 
-You can also try PyPy: PyPy >= 1.6 seems to work with moin.
+You can also try PyPy, it seems to work.
 
 Servers
 =======
 
 BuildArchitectures: noarch
 BuildRequires:  python-devel
-Requires:       python >= 2.6
+Requires:       python >= 2.7
 
 %description
 
 %changelog
 * Sun Jun 21 2010 Thomas Waldmann
 - Raised requirement to Python 2.6 (for MoinMoin 2.0.0alpha).
+* Sat May 4 2013 Thomas Waldmann
+- Raised requirement to Python 2.7 (for MoinMoin 2.0.0alpha).
 
 
 # find the right python version
 if [ -z "$PYTHON" ]; then
-    for PYTHON in python{2.7,2.6,2,}; do
+    for PYTHON in python{2.7,2,}; do
         hash $PYTHON 2>&- && break
     done
 fi
 
 # find the right virtualenv version
 if [ -z "$VIRTUALENV" ]; then
-    for VIRTUALENV in virtualenv{2.7,2.6,2,}; do
+    for VIRTUALENV in virtualenv{2.7,2,}; do
         hash $VIRTUALENV 2>&- && break
     done
 fi
 
 from MoinMoin import project, version
 
-if sys.hexversion < 0x2060000:
-    # we require 2.6.x or 2.7.x, python 3.x does not work yet.
-    sys.stderr.write("%s %s requires Python 2.6 or greater.\n" % (project, str(version)))
+if sys.hexversion < 0x2070000:
+    # we require 2.7.x, python 3.x does not work yet.
+    sys.stderr.write("%s %s requires Python 2.7.x.\n" % (project, str(version)))
     sys.exit(1)
 
 with open('README.txt') as f:
 Natural Language :: English
 Operating System :: OS Independent
 Programming Language :: Python
-Programming Language :: Python :: 2.6
 Programming Language :: Python :: 2.7
 Topic :: Internet :: WWW/HTTP :: WSGI
 Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.