[KiRi] Force image generation unless the user asked otherwise
This commit is contained in:
parent
2737da234c
commit
a291a8fde1
|
|
@ -22,7 +22,7 @@ Dependencies:
|
||||||
import datetime
|
import datetime
|
||||||
import pwd
|
import pwd
|
||||||
import os
|
import os
|
||||||
from shutil import copy2
|
from shutil import copy2, rmtree
|
||||||
from subprocess import CalledProcessError
|
from subprocess import CalledProcessError
|
||||||
from tempfile import mkdtemp, NamedTemporaryFile
|
from tempfile import mkdtemp, NamedTemporaryFile
|
||||||
from .error import KiPlotConfigurationError
|
from .error import KiPlotConfigurationError
|
||||||
|
|
@ -292,9 +292,12 @@ class KiRiOptions(VariantOptions):
|
||||||
try:
|
try:
|
||||||
for h in hashes:
|
for h in hashes:
|
||||||
hash = h[0]
|
hash = h[0]
|
||||||
if self.keep_generated and os.path.isdir(os.path.join(self.cache_dir, hash[:7])):
|
dst_dir = os.path.join(self.cache_dir, hash[:7])
|
||||||
|
already_generated = os.path.isdir(dst_dir)
|
||||||
|
if self.keep_generated and already_generated:
|
||||||
logger.debug(f'- Images for {hash} already generated')
|
logger.debug(f'- Images for {hash} already generated')
|
||||||
continue
|
continue
|
||||||
|
rmtree(dst_dir)
|
||||||
git_tmp_wd = mkdtemp()
|
git_tmp_wd = mkdtemp()
|
||||||
logger.debug('Checking out '+hash+' to '+git_tmp_wd)
|
logger.debug('Checking out '+hash+' to '+git_tmp_wd)
|
||||||
self.run_git(['worktree', 'add', git_tmp_wd, hash])
|
self.run_git(['worktree', 'add', git_tmp_wd, hash])
|
||||||
|
|
@ -317,6 +320,12 @@ class KiRiOptions(VariantOptions):
|
||||||
pcb_dirty = self.git_dirty(GS.pcb_file)
|
pcb_dirty = self.git_dirty(GS.pcb_file)
|
||||||
if sch_dirty or pcb_dirty:
|
if sch_dirty or pcb_dirty:
|
||||||
# Include the current files
|
# Include the current files
|
||||||
|
dst_dir = os.path.join(self.cache_dir, HASH_LOCAL)
|
||||||
|
already_generated = os.path.isdir(dst_dir)
|
||||||
|
if self.keep_generated and already_generated:
|
||||||
|
logger.debug(f'- Images for {HASH_LOCAL} already generated')
|
||||||
|
else:
|
||||||
|
rmtree(dst_dir)
|
||||||
name_sch = self.do_cache(GS.sch_file, GS.sch_dir, HASH_LOCAL)
|
name_sch = self.do_cache(GS.sch_file, GS.sch_dir, HASH_LOCAL)
|
||||||
self.save_sch_sheet(HASH_LOCAL, name_sch)
|
self.save_sch_sheet(HASH_LOCAL, name_sch)
|
||||||
self.do_cache(GS.pcb_file, GS.pcb_dir, HASH_LOCAL)
|
self.do_cache(GS.pcb_file, GS.pcb_dir, HASH_LOCAL)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue