[Compress] Added option to store symlinks.

This commit is contained in:
Salvador E. Tropea 2022-08-31 13:36:20 -03:00
parent 651f3890d5
commit a0075d12c7
4 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Global option: `drc_exclusions_workaround`
KiCad bug [11562](https://gitlab.com/kicad/code/kicad/-/issues/11562)
- Internal BoM: KiCad 6 text variables expansion in the fields (#247)
- Compress: Option to store symlinks. (See #265)
### Fixed
- OAR computation (Report) (#225)

View File

@ -1471,6 +1471,7 @@ Notes:
- **`format`**: [string='ZIP'] [ZIP,TAR,RAR] Output file format.
- **`output`**: [string='%f-%i%I%v.%x'] Name for the generated archive (%i=name of the output %x=according to format). Affected by global options.
- `compression`: [string='auto'] [auto,stored,deflated,bzip2,lzma] Compression algorithm. Use auto to let KiBot select a suitable one.
- `follow_links`: [boolean=true] Store the file pointed by symlinks, not the symlink.
- `move_files`: [boolean=false] Move the files to the archive. In other words: remove the files after adding them to the archive.
- *remove_files*: Alias for move_files.
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.

View File

@ -400,6 +400,8 @@ outputs:
# By default this pattern is applied to the output dir specified with `-d` command line option.
# See the `from_cwd` option
source: '*'
# [boolean=true] Store the file pointed by symlinks, not the symlink
follow_links: true
# [string='ZIP'] [ZIP,TAR,RAR] Output file format
format: 'ZIP'
# [boolean=false] Move the files to the archive. In other words: remove the files after adding them to the archive

View File

@ -78,6 +78,8 @@ class CompressOptions(BaseOptions):
""" Move the files to the archive. In other words: remove the files after adding them to the archive """
self.remove_files = None
""" {move_files} """
self.follow_links = True
""" Store the file pointed by symlinks, not the symlink """
super().__init__()
def config(self, parent):
@ -176,7 +178,7 @@ class CompressOptions(BaseOptions):
logger.debug('- Pattern {} list of files: {}'.format(source, files_list))
# Filter and adapt them
for fname in filter(re.compile(f.filter).match, files_list):
fname_real = os.path.realpath(fname)
fname_real = os.path.realpath(fname) if self.follow_links else os.path.abspath(fname)
# Avoid including the output
if fname_real == output_real:
continue