mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #1615322 [Failure when cleaning build](https://bugs.launchpad.net/calibre/+bug/1615322)
This commit is contained in:
parent
04e9737979
commit
c36c60b708
@ -181,6 +181,8 @@ def init_env():
|
|||||||
class Build(Command):
|
class Build(Command):
|
||||||
|
|
||||||
short_description = 'Build calibre C/C++ extension modules'
|
short_description = 'Build calibre C/C++ extension modules'
|
||||||
|
DEFAULT_OUTPUTDIR = os.path.abspath(os.path.join(SRC, 'calibre', 'plugins'))
|
||||||
|
DEFAULT_BUILDDIR = os.path.abspath(os.path.join(os.path.dirname(SRC), 'build'))
|
||||||
|
|
||||||
description = textwrap.dedent('''\
|
description = textwrap.dedent('''\
|
||||||
calibre depends on several python extensions written in C/C++.
|
calibre depends on several python extensions written in C/C++.
|
||||||
@ -222,8 +224,8 @@ class Build(Command):
|
|||||||
return
|
return
|
||||||
self.env = init_env()
|
self.env = init_env()
|
||||||
extensions = map(parse_extension, filter(is_ext_allowed, read_extensions()))
|
extensions = map(parse_extension, filter(is_ext_allowed, read_extensions()))
|
||||||
self.build_dir = os.path.abspath(opts.build_dir or os.path.join(os.path.dirname(SRC), 'build'))
|
self.build_dir = os.path.abspath(opts.build_dir or self.DEFAULT_BUILDDIR)
|
||||||
self.output_dir = os.path.abspath(opts.output_dir or os.path.join(SRC, 'calibre', 'plugins'))
|
self.output_dir = os.path.abspath(opts.output_dir or self.DEFAULT_OUTPUTDIR)
|
||||||
self.obj_dir = os.path.join(self.build_dir, 'objects')
|
self.obj_dir = os.path.join(self.build_dir, 'objects')
|
||||||
for x in (self.output_dir, self.obj_dir):
|
for x in (self.output_dir, self.obj_dir):
|
||||||
if not os.path.exists(x):
|
if not os.path.exists(x):
|
||||||
@ -468,16 +470,13 @@ class Build(Command):
|
|||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
self.output_dir = self.DEFAULT_OUTPUTDIR
|
||||||
extensions = map(parse_extension, filter(is_ext_allowed, read_extensions()))
|
extensions = map(parse_extension, filter(is_ext_allowed, read_extensions()))
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
dest = self.dest(ext)
|
dest = self.dest(ext)
|
||||||
for x in (dest, dest+'.manifest'):
|
for x in (dest, dest+'.manifest'):
|
||||||
if os.path.exists(x):
|
if os.path.exists(x):
|
||||||
os.remove(x)
|
os.remove(x)
|
||||||
build_dir = self.j(self.d(self.SRC), 'build')
|
build_dir = self.DEFAULT_BUILDDIR
|
||||||
if os.path.exists(build_dir):
|
if os.path.exists(build_dir):
|
||||||
shutil.rmtree(build_dir)
|
shutil.rmtree(build_dir)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user