[+] remove build dir when deploy with force=True

This commit is contained in:
Siarhei Siniak 2025-05-27 10:25:15 +03:00
parent a7c192a51e
commit e0843e8496
3 changed files with 17 additions and 3 deletions

@ -5,7 +5,7 @@ project(
).stdout().strip('\n'), ).stdout().strip('\n'),
# 'online.fxreader.uv', # 'online.fxreader.uv',
# ['c', 'cpp'], # ['c', 'cpp'],
version: '0.1.5.17+27.6', version: '0.1.5.17+27.7',
# default_options: [ # default_options: [
# 'cpp_std=c++23', # 'cpp_std=c++23',
# # 'prefer_static=true', # # 'prefer_static=true',

@ -357,6 +357,17 @@ class CLI(abc.ABC):
extra_args: list[str] = [] extra_args: list[str] = []
pyproject_build_dir = project.build_dir / 'pyproject'
if force and pyproject_build_dir.exists():
logger.info(
dict(
pyproject_build_dir=pyproject_build_dir,
msg='remove build dir',
)
)
shutil.rmtree(pyproject_build_dir)
if len(self.third_party_roots) > 0: if len(self.third_party_roots) > 0:
extra_args.extend(['-Csetup-args=%s' % ('-Dthird_party_roots=%s' % str(o.absolute())) for o in self.third_party_roots]) extra_args.extend(['-Csetup-args=%s' % ('-Dthird_party_roots=%s' % str(o.absolute())) for o in self.third_party_roots])
@ -368,7 +379,7 @@ class CLI(abc.ABC):
'-n', '-n',
*extra_args, *extra_args,
'-Csetup-args=-Dmodes=pyproject', '-Csetup-args=-Dmodes=pyproject',
'-Cbuild-dir=%s' % str(project.build_dir / 'pyproject'), '-Cbuild-dir=%s' % str(pyproject_build_dir),
'-Csetup-args=-Dinstall_path=%s' % str(project.dest_dir), '-Csetup-args=-Dinstall_path=%s' % str(project.dest_dir),
# '-Cbuild-dir=%s' % str(project.build_dir), # '-Cbuild-dir=%s' % str(project.build_dir),
str(project.source_dir), str(project.source_dir),
@ -378,7 +389,7 @@ class CLI(abc.ABC):
if not output_dir is None: if not output_dir is None:
cmd.extend(['-o', str(output_dir)]) cmd.extend(['-o', str(output_dir)])
logger.info(dict(env=env)) logger.info(dict(env=env, cmd=cmd))
subprocess.check_call( subprocess.check_call(
cmd, cmd,

Binary file not shown.