mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Some py3 fixes for the setup module
This commit is contained in:
parent
d62d9dc2e6
commit
ce377076b9
@ -86,13 +86,13 @@ def require_clean_git():
|
||||
def initialize_constants():
|
||||
global __version__, __appname__, modules, functions, basenames, scripts
|
||||
|
||||
src = open(os.path.join(SRC, 'calibre/constants.py'), 'rb').read()
|
||||
src = open(os.path.join(SRC, 'calibre/constants.py'), 'rb').read().decode('utf-8')
|
||||
nv = re.search(r'numeric_version\s+=\s+\((\d+), (\d+), (\d+)\)', src)
|
||||
__version__ = '%s.%s.%s'%(nv.group(1), nv.group(2), nv.group(3))
|
||||
__appname__ = re.search(r'__appname__\s+=\s+(u{0,1})[\'"]([^\'"]+)[\'"]',
|
||||
src).group(2)
|
||||
epsrc = re.compile(r'entry_points = (\{.*?\})', re.DOTALL).\
|
||||
search(open(os.path.join(SRC, 'calibre/linux.py'), 'rb').read()).group(1)
|
||||
search(open(os.path.join(SRC, 'calibre/linux.py'), 'rb').read().decode('utf-8')).group(1)
|
||||
entry_points = eval(epsrc, {'__appname__': __appname__})
|
||||
|
||||
def e2b(ep):
|
||||
|
@ -657,7 +657,7 @@ class GetTranslations(Translations): # {{{
|
||||
|
||||
def check_for_control_chars(f):
|
||||
raw = open(f, 'rb').read().decode('utf-8')
|
||||
pat = re.compile(ur'[\0-\x08\x0b\x0c\x0e-\x1f\x7f\x80-\x9f]')
|
||||
pat = re.compile(type(u'')(r'[\0-\x08\x0b\x0c\x0e-\x1f\x7f\x80-\x9f]'))
|
||||
errs = []
|
||||
for i, line in enumerate(raw.splitlines()):
|
||||
if pat.search(line) is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user