From b4f302b7905552e048ce184f4058287136cf6c61 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 18 Oct 2024 07:17:10 -0300 Subject: [PATCH] [DOCs][Fixed] We had 3 FileList classes, only one shown --- docs/samples/generic_plot.kibot.yaml | 10 +++---- .../configuration/outputs/CompressOptions.rst | 4 +-- .../outputs/Copy_FilesOptions.rst | 4 +-- .../outputs/FilesListCompress.rst | 18 ++++++++++++ .../configuration/outputs/FilesListCopy.rst | 29 +++++++++++++++++++ .../outputs/FilesListPDFUnite.rst | 14 +++++++++ .../configuration/outputs/PDFUniteOptions.rst | 4 +-- kibot/out_compress.py | 4 +-- kibot/out_copy_files.py | 16 +++++----- kibot/out_pdfunite.py | 4 +-- 10 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 docs/source/configuration/outputs/FilesListCompress.rst create mode 100644 docs/source/configuration/outputs/FilesListCopy.rst create mode 100644 docs/source/configuration/outputs/FilesListPDFUnite.rst diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 8e6cb4d06..31edba1d0 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -858,11 +858,11 @@ outputs: # Not used for the `project` mode source: '*' # [string='files'] [files,out_files,output,3d_models,project] From where do we get the files to be copied. - # `files`: files relative to the current working directory. - # `out_files`: files relative to output dir specified with `-d` command line option. - # `output`: files generated by the output specified by `source`. - # `3d_models`: 3D models used in the project. - # `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+) + # - `files`: files relative to the current working directory. + # - `out_files`: files relative to output dir specified with `-d` command line option. + # - `output`: files generated by the output specified by `source`. + # - `3d_models`: 3D models used in the project. + # - `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+) source_type: 'files' # [boolean=true] Store the file pointed by symlinks, not the symlink follow_links: true diff --git a/docs/source/configuration/outputs/CompressOptions.rst b/docs/source/configuration/outputs/CompressOptions.rst index 256e856c7..d00fa8212 100644 --- a/docs/source/configuration/outputs/CompressOptions.rst +++ b/docs/source/configuration/outputs/CompressOptions.rst @@ -4,7 +4,7 @@ CompressOptions parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~ -- **files** :index:`: ` [:ref:`FilesList parameters `] [:ref:`list(dict) `] (default: ``[]``) Which files will be included. +- **files** :index:`: ` [:ref:`FilesListCompress parameters `] [:ref:`list(dict) `] (default: ``[]``) Which files will be included. - **format** :index:`: ` [:ref:`string `] (default: ``'ZIP'``) (choices: "ZIP", "TAR", "RAR") Output file format. - **output** :index:`: ` [:ref:`string `] (default: ``'%f-%i%I%v.%x'``) Name for the generated archive (%i=name of the output %x=according to format). Affected by global options. - ``compression`` :index:`: ` [:ref:`string `] (default: ``'auto'``) (choices: "auto", "stored", "deflated", "bzip2", "lzma") Compression algorithm. Use auto to let KiBot select a suitable one. @@ -16,4 +16,4 @@ CompressOptions parameters .. toctree:: :caption: Used dicts - FilesList + FilesListCompress diff --git a/docs/source/configuration/outputs/Copy_FilesOptions.rst b/docs/source/configuration/outputs/Copy_FilesOptions.rst index 4d63bc4ff..a0201ad68 100644 --- a/docs/source/configuration/outputs/Copy_FilesOptions.rst +++ b/docs/source/configuration/outputs/Copy_FilesOptions.rst @@ -9,7 +9,7 @@ Copy_FilesOptions parameters They are downloaded to a temporal directory and discarded. If you want to cache the downloaded files specify a directory using the KIBOT_3D_MODELS environment variable. -- **files** :index:`: ` [:ref:`FilesList parameters `] [:ref:`list(dict) `] (default: ``[]``) Which files will be included. +- **files** :index:`: ` [:ref:`FilesListCopy parameters `] [:ref:`list(dict) `] (default: ``[]``) Which files will be included. - **no_virtual** :index:`: ` [:ref:`boolean `] (default: ``false``) Used to exclude 3D models for components with 'virtual' attribute. - ``dnf_filter`` :index:`: ` [:ref:`string ` | :ref:`list(string) `] (default: ``'_null'``) Name of the filter to mark components as not fitted. A short-cut to use for simple cases where a variant is an overkill. @@ -31,4 +31,4 @@ Copy_FilesOptions parameters .. toctree:: :caption: Used dicts - FilesList + FilesListCopy diff --git a/docs/source/configuration/outputs/FilesListCompress.rst b/docs/source/configuration/outputs/FilesListCompress.rst new file mode 100644 index 000000000..e54e237c4 --- /dev/null +++ b/docs/source/configuration/outputs/FilesListCompress.rst @@ -0,0 +1,18 @@ +.. _FilesListCompress: + + +FilesListCompress parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **from_output** :index:`: ` [:ref:`string `] (default: ``''``) Collect files from the selected output. + When used the `source` option is ignored. +- **source** :index:`: ` [:ref:`string `] (default: ``'*'``) File names to add, wildcards allowed. Use ** for recursive match. + By default this pattern is applied to the output dir specified with `-d` command line option. + See the `from_cwd` and `from_output_dir` options. +- ``dest`` :index:`: ` [:ref:`string `] (default: ``''``) Destination directory inside the archive, empty means the same of the file. +- ``filter`` :index:`: ` [:ref:`string `] (default: ``'.*'``) A regular expression that source files must match. +- ``from_cwd`` :index:`: ` [:ref:`boolean `] (default: ``false``) Use the current working directory instead of the dir specified by `-d`. +- ``from_output_dir`` :index:`: ` [:ref:`boolean `] (default: ``false``) Use the current directory specified by the output instead of the dir specified by `-d`. + Note that it only applies when using `from_output` and no `dest` is specified. + It has more prescedence than `from_cwd`. + diff --git a/docs/source/configuration/outputs/FilesListCopy.rst b/docs/source/configuration/outputs/FilesListCopy.rst new file mode 100644 index 000000000..4994adc33 --- /dev/null +++ b/docs/source/configuration/outputs/FilesListCopy.rst @@ -0,0 +1,29 @@ +.. _FilesListCopy: + + +FilesListCopy parameters +~~~~~~~~~~~~~~~~~~~~~~~~ + +- **source** :index:`: ` [:ref:`string `] (default: ``'*'``) For the `files` and `out_files` mode this is th file names to add, + wildcards allowed. Use ** for recursive match. + For the `output` mode this is the name of the output. + For the `3d_models` is a pattern to match the name of the 3D models extracted from the PCB. + Not used for the `project` mode. +- **source_type** :index:`: ` [:ref:`string `] (default: ``'files'``) (choices: "files", "out_files", "output", "3d_models", "project") From where do we get the files to be copied. + + - `files`: files relative to the current working directory. + - `out_files`: files relative to output dir specified with `-d` command line option. + - `output`: files generated by the output specified by `source`. + - `3d_models`: 3D models used in the project. + - `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+). +- ``dest`` :index:`: ` [:ref:`string `] (default: ``''``) Destination directory inside the output dir, empty means the same of the file + relative to the source directory. + Note that when you specify a name here files are copied to this destination + without creating subdirs. The `project` mode is an exception. + For the `3d_models` type you can use DIR+ to create subdirs under DIR. +- ``filter`` :index:`: ` [:ref:`string `] (default: ``'.*'``) A regular expression that source files must match. + Not used for the `project` mode. +- ``save_pcb`` :index:`: ` [:ref:`boolean `] (default: ``false``) Only usable for the `3d_models` mode. + Save a PCB copy modified to use the copied 3D models. + You don't need to specify it for `project` mode. + diff --git a/docs/source/configuration/outputs/FilesListPDFUnite.rst b/docs/source/configuration/outputs/FilesListPDFUnite.rst new file mode 100644 index 000000000..0e4ecedb6 --- /dev/null +++ b/docs/source/configuration/outputs/FilesListPDFUnite.rst @@ -0,0 +1,14 @@ +.. _FilesListPDFUnite: + + +FilesListPDFUnite parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- **from_output** :index:`: ` [:ref:`string `] (default: ``''``) Collect files from the selected output. + When used the `source` option is ignored. +- **source** :index:`: ` [:ref:`string `] (default: ``'*.pdf'``) File names to add, wildcards allowed. Use ** for recursive match. + By default this pattern is applied to the output dir specified with `-d` command line option. + See the `from_cwd` option. +- ``filter`` :index:`: ` [:ref:`string `] (default: ``'.*\\.pdf'``) A regular expression that source files must match. +- ``from_cwd`` :index:`: ` [:ref:`boolean `] (default: ``false``) Use the current working directory instead of the dir specified by `-d`. + diff --git a/docs/source/configuration/outputs/PDFUniteOptions.rst b/docs/source/configuration/outputs/PDFUniteOptions.rst index 6cb2d8710..8d3097071 100644 --- a/docs/source/configuration/outputs/PDFUniteOptions.rst +++ b/docs/source/configuration/outputs/PDFUniteOptions.rst @@ -5,10 +5,10 @@ PDFUniteOptions parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~ - **output** :index:`: ` [:ref:`string `] (default: ``'%f-%i%I%v.%x'``) Name for the generated PDF (%i=name of the output %x=pdf). Affected by global options. -- **outputs** :index:`: ` [:ref:`FilesList parameters `] [:ref:`list(dict) `] (default: ``[]``) Which files will be included. +- **outputs** :index:`: ` [:ref:`FilesListPDFUnite parameters `] [:ref:`list(dict) `] (default: ``[]``) Which files will be included. - ``use_external_command`` :index:`: ` [:ref:`boolean `] (default: ``false``) Use the `pdfunite` tool instead of PyPDF2 Python module. .. toctree:: :caption: Used dicts - FilesList + FilesListPDFUnite diff --git a/kibot/out_compress.py b/kibot/out_compress.py index 679d44af9..487dcad59 100644 --- a/kibot/out_compress.py +++ b/kibot/out_compress.py @@ -32,7 +32,7 @@ logger = log.get_logger() -class FilesList(Optionable): +class FilesListCompress(Optionable): def __init__(self): super().__init__() with document: @@ -81,7 +81,7 @@ def __init__(self): """ *[ZIP,TAR,RAR] Output file format """ self.compression = 'auto' """ [auto,stored,deflated,bzip2,lzma] Compression algorithm. Use auto to let KiBot select a suitable one """ - self.files = FilesList + self.files = FilesListCompress """ *[list(dict)=[]] Which files will be included """ self.move_files = False """ Move the files to the archive. In other words: remove the files after adding them to the archive """ diff --git a/kibot/out_copy_files.py b/kibot/out_copy_files.py index ccee18856..e210ec3a1 100644 --- a/kibot/out_copy_files.py +++ b/kibot/out_copy_files.py @@ -30,7 +30,7 @@ def may_be_rel(file): return file -class FilesList(Optionable): +class FilesListCopy(Optionable): def __init__(self): super().__init__() with document: @@ -42,11 +42,11 @@ def __init__(self): Not used for the `project` mode """ self.source_type = 'files' """ *[files,out_files,output,3d_models,project] From where do we get the files to be copied. - `files`: files relative to the current working directory. - `out_files`: files relative to output dir specified with `-d` command line option. - `output`: files generated by the output specified by `source`. - `3d_models`: 3D models used in the project. - `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+) """ + - `files`: files relative to the current working directory. + - `out_files`: files relative to output dir specified with `-d` command line option. + - `output`: files generated by the output specified by `source`. + - `3d_models`: 3D models used in the project. + - `project`: schematic, PCB, footprints, symbols, 3D models and project files (KiCad 6+) """ self.filter = '.*' """ A regular expression that source files must match. Not used for the `project` mode """ @@ -86,7 +86,7 @@ def __str__(self): class Copy_FilesOptions(Base3DOptions): def __init__(self): with document: - self.files = FilesList + self.files = FilesListCopy """ *[list(dict)=[]] Which files will be included """ self.follow_links = True """ Store the file pointed by symlinks, not the symlink """ @@ -217,7 +217,7 @@ def get_3d_models(self, f, mode_project, dry): self.filter_pcb_components(do_3D=True, do_2D=True) # Download missing models and rename all collected 3D models (renamed) f.rel_dirs = self.rel_dirs - files_list = self.download_models(rename_filter=f.source, rename_function=FilesList.apply_rename, rename_data=f) + files_list = self.download_models(rename_filter=f.source, rename_function=FilesListCopy.apply_rename, rename_data=f) if f.save_pcb or mode_project: dest_dir = self.output_dir diff --git a/kibot/out_pdfunite.py b/kibot/out_pdfunite.py index d0987ecdc..c0a61dac6 100644 --- a/kibot/out_pdfunite.py +++ b/kibot/out_pdfunite.py @@ -19,7 +19,7 @@ logger = log.get_logger() -class FilesList(Optionable): +class FilesListPDFUnite(Optionable): def __init__(self): super().__init__() with document: @@ -46,7 +46,7 @@ def __init__(self): with document: self.output = GS.def_global_output """ *Name for the generated PDF (%i=name of the output %x=pdf) """ - self.outputs = FilesList + self.outputs = FilesListPDFUnite """ *[list(dict)=[]] Which files will be included """ self.use_external_command = False """ Use the `pdfunite` tool instead of PyPDF2 Python module """