mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 01:30:07 +01:00
Many, many (many!) changes needed to build and run the Phoenix extension modules with Python 3. Where possible changes were made such that the code works with both Python 2.7 and 3.2 without conditionals. In general the following types of changes were made:
* Changed imports to use either absolute or explicit relative imports. Implicit relative imports are no longer allowed. * Changes to accomodate standard library classes or modues moving to other locations, or being removed entirely. * Changes related to print becoming a function, execfile being removed, u'' no longer allowed, and other syntax related issues. * Working around C APIs that have changed or simply vanished. (PyInt, PyString, PyBytes, etc.) * Dealing with text file objects using strings vs binary file objects using bytes, auto-encoding, and etc. * Replacing the use of PyCObject with PyCapsule and dealing with an apparent bug where PyCapsule objects can't be imported from submodules within a package. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -184,7 +184,7 @@ class Enumeration(object):
|
||||
|
||||
def __getattr__(self, attr):
|
||||
|
||||
if not self.lookup.has_key(attr):
|
||||
if not attr in self.lookup:
|
||||
raise AttributeError
|
||||
|
||||
return self.lookup[attr]
|
||||
|
||||
@@ -11,20 +11,24 @@
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Standard library imports
|
||||
import sys
|
||||
import os
|
||||
import codecs
|
||||
import shutil
|
||||
import cPickle
|
||||
|
||||
from UserDict import UserDict
|
||||
if sys.version_info < (3,):
|
||||
import cPickle as pickle
|
||||
from UserDict import UserDict
|
||||
else:
|
||||
import pickle
|
||||
from collections import UserDict
|
||||
|
||||
# Phoenix-specific imports
|
||||
from templates import TEMPLATE_CONTRIB
|
||||
from .templates import TEMPLATE_CONTRIB
|
||||
|
||||
from constants import IGNORE, PUNCTUATION
|
||||
from constants import CPP_ITEMS, VERSION, VALUE_MAP
|
||||
from constants import RE_KEEP_SPACES, EXTERN_INHERITANCE
|
||||
from constants import DOXYROOT, SPHINXROOT, WIDGETS_IMAGES_ROOT
|
||||
from .constants import IGNORE, PUNCTUATION
|
||||
from .constants import CPP_ITEMS, VERSION, VALUE_MAP
|
||||
from .constants import RE_KEEP_SPACES, EXTERN_INHERITANCE
|
||||
from .constants import DOXYROOT, SPHINXROOT, WIDGETS_IMAGES_ROOT
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
@@ -577,14 +581,14 @@ def PickleItem(description, current_module, name, kind):
|
||||
|
||||
if os.path.isfile(pickle_file):
|
||||
fid = open(pickle_file, 'rb')
|
||||
items = cPickle.load(fid)
|
||||
items = pickle.load(fid)
|
||||
fid.close()
|
||||
else:
|
||||
items = {}
|
||||
|
||||
items[name] = description
|
||||
fid = open(pickle_file, 'wb')
|
||||
cPickle.dump(items, fid)
|
||||
pickle.dump(items, fid)
|
||||
fid.close()
|
||||
|
||||
|
||||
@@ -592,7 +596,7 @@ def PickleItem(description, current_module, name, kind):
|
||||
|
||||
def PickleClassInfo(class_name, element, short_description):
|
||||
"""
|
||||
Saves some information about a class in a cPickle-compatible file., i.e. the
|
||||
Saves some information about a class in a pickle-compatible file., i.e. the
|
||||
list of methods in that class and its super-classes.
|
||||
|
||||
:param string `class_name`: the name of the class we want to pickle;
|
||||
@@ -604,7 +608,7 @@ def PickleClassInfo(class_name, element, short_description):
|
||||
|
||||
if os.path.isfile(pickle_file):
|
||||
fid = open(pickle_file, 'rb')
|
||||
items = cPickle.load(fid)
|
||||
items = pickle.load(fid)
|
||||
fid.close()
|
||||
else:
|
||||
items = {}
|
||||
@@ -618,7 +622,7 @@ def PickleClassInfo(class_name, element, short_description):
|
||||
|
||||
items[class_name] = (method_list, bases, short_description)
|
||||
fid = open(pickle_file, 'wb')
|
||||
cPickle.dump(items, fid)
|
||||
pickle.dump(items, fid)
|
||||
fid.close()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user