python3 compatibility
This commit is contained in:
parent
792a335a35
commit
965fd44e6c
6 changed files with 14 additions and 13 deletions
|
@ -7,5 +7,5 @@ Full of awesome little tools that do magic and stuff.
|
|||
|
||||
__all__ = ["core"]
|
||||
|
||||
import preconfig
|
||||
from . import preconfig
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Core modules from Cecil's library
|
|||
|
||||
__all__ = ["objproxy", "config"]
|
||||
|
||||
import objproxy, config
|
||||
from . import objproxy, config
|
||||
|
||||
def ascii(s):
|
||||
if isinstance(s, unicode):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os, sys
|
||||
import inifile
|
||||
import objproxy
|
||||
from cecil import preconfig
|
||||
from . import inifile
|
||||
from . import objproxy
|
||||
from .. import preconfig
|
||||
|
||||
|
||||
config = objproxy.Proxy({})
|
||||
|
@ -113,7 +113,7 @@ def save_config(original_name=True, make_path=True):
|
|||
saved = True
|
||||
break
|
||||
if not saved:
|
||||
raise OSError, "No writable path to save configuration"
|
||||
raise(OSError, "No writable path to save configuration")
|
||||
|
||||
if preconfig.load_config:
|
||||
init(preconfig.appname)
|
||||
|
|
|
@ -63,7 +63,7 @@ class inifilesec(dict):
|
|||
if lk in self:
|
||||
return dict.__getitem__(self, key.lower())
|
||||
else:
|
||||
raise KeyError, "Section '%s' has no key '%s'" % (self.name, key)
|
||||
raise(KeyError, "Section '%s' has no key '%s'" % (self.name, key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if not self.has_key(key.lower()):
|
||||
|
@ -205,13 +205,13 @@ class inifile(dict):
|
|||
|
||||
def __getitem__(self, key):
|
||||
if not isinstance(key, basestring):
|
||||
raise TypeError, "Ini files can only contain string keys"
|
||||
raise(TypeError, "Ini files can only contain string keys")
|
||||
|
||||
if self.cur_section != None:
|
||||
if dict.__getitem__(self, self.cur_section).has_key(key.lower()):
|
||||
return dict.__getitem__(self, self.cur_section)[key.lower()]
|
||||
else:
|
||||
raise KeyError, "Section '%s' does not contain a key named '%s'" % (self.cur_section, key)
|
||||
raise(KeyError, "Section '%s' does not contain a key named '%s'" % (self.cur_section, key))
|
||||
else:
|
||||
#if not self.has_key(key.lower()):
|
||||
# self[key.lower()] = inifilesec(key, self)
|
||||
|
@ -219,8 +219,8 @@ class inifile(dict):
|
|||
def __setitem__(self, key, value):
|
||||
if self.cur_section != None:
|
||||
if not self.has_key(self.cur_section):
|
||||
raise KeyError, "Section '%s' does not exist" % (self.cur_section)
|
||||
raise(KeyError, "Section '%s' does not exist" % (self.cur_section))
|
||||
self[self.cur_section][key.lower()] = value
|
||||
else:
|
||||
raise ValueError, "Cannot set the value of a section header"
|
||||
raise(ValueError, "Cannot set the value of a section header")
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
## {{{ http://code.activestate.com/recipes/496741/ (r1)
|
||||
|
||||
## Original algorithm adapted from {{{ http://code.activestate.com/recipes/496741/ (r1)
|
||||
class Proxy(object):
|
||||
__slots__ = ["_obj", "__weakref__"]
|
||||
_local = {
|
||||
|
|
2
setup.py
2
setup.py
|
@ -35,7 +35,7 @@ else:
|
|||
fd.close()
|
||||
|
||||
ver = '%s%d' % (majorversion, buildnumber)
|
||||
print "Building version %s" % (ver,)
|
||||
print("Building version %s" % (ver,))
|
||||
setup(
|
||||
name='pycecil',
|
||||
version=ver,
|
||||
|
|
Loading…
Add table
Reference in a new issue