Allow setup to be run from outside the tree

This commit is contained in:
Kovid Goyal 2016-06-24 21:10:57 +05:30
parent 227cc4b103
commit 4e0d95818c

View File

@ -46,13 +46,13 @@ def require_clean_git():
def initialize_constants():
global __version__, __appname__, modules, functions, basenames, scripts
src = open('src/calibre/constants.py', 'rb').read()
src = open(os.path.join(SRC, 'calibre/constants.py'), 'rb').read()
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('src/calibre/linux.py', 'rb').read()).group(1)
search(open(os.path.join(SRC, 'calibre/linux.py'), 'rb').read()).group(1)
entry_points = eval(epsrc, {'__appname__': __appname__})
def e2b(ep):