diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 06:10:13 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 06:10:13 +0000 |
commit | b5503c84574faf0a6559ce7b726925f30b5d3227 (patch) | |
tree | 218e7f7d7b7bc5bf464f5979ac78544305c3e420 | |
parent | 61ba9fdeb87245afac4981637c39e23491e78bfc (diff) |
automatic import of python-pyyaml-include
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pyyaml-include.spec | 864 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 866 insertions, 0 deletions
@@ -0,0 +1 @@ +/pyyaml-include-1.3.tar.gz diff --git a/python-pyyaml-include.spec b/python-pyyaml-include.spec new file mode 100644 index 0000000..979b595 --- /dev/null +++ b/python-pyyaml-include.spec @@ -0,0 +1,864 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pyyaml-include +Version: 1.3 +Release: 1 +Summary: Extending PyYAML with a custom constructor for including YAML files within YAML files +License: GNU General Public License v3 or later (GPLv3+) +URL: https://github.com/tanbro/pyyaml-include +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/84/df/c57e47c8d144a424b57304f58661bd09d5bece6c43ac79f3bd4b727f5445/pyyaml-include-1.3.tar.gz +BuildArch: noarch + +Requires: python3-PyYAML +Requires: python3-toml +Requires: python3-toml + +%description +# pyyaml-include + +[](https://github.com/tanbro/pyyaml-include) +[](https://github.com/tanbro/pyyaml-include/actions?query=workflow%3A%22Python+package%22) +[](https://pyyaml-include.readthedocs.io/en/stable/?badge=stable) +[](https://sonarcloud.io/dashboard?id=tanbro_pyyaml-include) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) + +An extending constructor of [PyYAML][]: include [YAML][] files into [YAML][] document. + +## Install + +```sh +pip install pyyaml-include +``` + +## Usage + +Consider we have such [YAML] files: + +```text +├── 0.yml +└── include.d + ├── 1.yml + └── 2.yml +``` + +- `1.yml` 's content: + + ```yaml + name: "1" + ``` + +- `2.yml` 's content: + + ```yaml + name: "2" + ``` + +To include `1.yml`, `2.yml` in `0.yml`, we shall add `YamlIncludeConstructor` to [PyYAML]'s loader, then add an `!include` tag in `0.yaml`: + +```python +import yaml +from yamlinclude import YamlIncludeConstructor + +YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader, base_dir='/your/conf/dir') + +with open('0.yml') as f: + data = yaml.load(f, Loader=yaml.FullLoader) + +print(data) +``` + +### Mapping + +If `0.yml` was: + +```yaml +file1: !include include.d/1.yml +file2: !include include.d/2.yml +``` + +We'll get: + +```yaml +file1: + name: "1" +file2: + name: "2" +``` + +### Sequence + +If `0.yml` was: + +```yaml +files: + - !include include.d/1.yml + - !include include.d/2.yml +``` + +We'll get: + +```yaml +files: + - name: "1" + - name: "2" +``` + +> ℹ **Note**: +> +> File name can be either absolute (like `/usr/conf/1.5/Make.yml`) or relative (like `../../cfg/img.yml`). + +### Wildcards + +File name can contain shell-style wildcards. Data loaded from the file(s) found by wildcards will be set in a sequence. + +That is to say, a list will be returned when including file name contains wildcards. +Length of the returned list equals number of matched files: + +- when only 1 file matched, length of list will be 1 +- when there are no files matched, an empty list will be returned + +If `0.yml` was: + +```yaml +files: !include include.d/*.yml +``` + +We'll get: + +```yaml +files: + - name: "1" + - name: "2" +``` + +> ℹ **Note**: +> +> - For `Python>=3.5`, if `recursive` argument of `!include` [YAML] tag is `true`, the pattern `“**”` will match any files and zero or more directories and subdirectories. +> - Using the `“**”` pattern in large directory trees may consume an inordinate amount of time because of recursive search. + +In order to enable `recursive` argument, we shall set it in `Mapping` or `Sequence` arguments mode: + +- Arguments in `Sequence` mode: + + ```yaml + !include [tests/data/include.d/**/*.yml, true] + ``` + +- Arguments in `Mapping` mode: + + ```yaml + !include {pathname: tests/data/include.d/**/*.yml, recursive: true} + ``` + +### Non YAML files + +This extending constructor can now load data from non YAML files, supported file types are: + +- `json` +- `toml` (only available when [toml](https://pypi.org/project/toml/) installed) +- `ini` + +The constructor read non YAML files by different readers according to a pattern table defined in `src/yamlinclude/readers.py`. + +Default reader table can be replaced by a custom `reader_map` when call `add_to_loader_class`. + +[YAML]: http://yaml.org/ +[PyYaml]: https://pypi.org/project/PyYAML/ + +# AUTHORS + +* Liu Xue Yan (<liu_xue_yan@foxmail.com>) + + [](mailto:liu_xue_yan@foxmail.com) + +# Changelog + +## 1.3 + +Date: 2022-04-24 + +- New: + - PyYAML 6.0 supported + +- Misc: + - Better CI processes + +## 1.2 + +Date: 2019-02-03 + +- New: + - non YAML file including + +- Misc: + - adjust docs + - add pip and conda configure file of development environment + +- Fix: + - add `PlainTextReader` into `__all__` list of `reders` module + +## 1.1 + +Date: 2019-03-18 + +- Change: + - Update PyYAML to 5.* + - Rename: Argument `loader_class` of `YamlIncludeConstructor.add_to_loader_class()` (former: `loader_cls`) + +## 1.0.4 + +Date: 2019-01-07 + +- Change: + + - rename: `TAG` ==> `DEFAULT_TAG_NAME` + - add: `encoding` argument + +- Fix: + + - A wrong logging text format + +- Misc: + + - add: `.pylintrc` + +## 1.0.3 + +Date: 2018-12-04 + +- New Feature: + + - Add `base_dir` argument + +- Misc: + + - Add some new unit-test + - Add Python3.7 in CircleCI + +## 1.0.2 + +Date: 2018-07-11 + +- Add: + + - `encoding` argument + +- Bug fix: + + - encoding error if non-ascii characters on non-utf8 os. + +## 1.0.1 + +Date: 2018-07-03 + +- Add: + + - Old Python2.6 and new Python3.7 compatibilities + + - class method `add_to_loader_class` + + A class method to add the constructor itself into YAML loader class + + - Sphinx docs + +- Change: + + - Rename module file `include.py` to `constructor.py` + + - Rename class data member `DEFAULT_TAG` to `TAG` + +## 1.0 + +Date: 2018-06-08 + + + + +%package -n python3-pyyaml-include +Summary: Extending PyYAML with a custom constructor for including YAML files within YAML files +Provides: python-pyyaml-include +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pyyaml-include +# pyyaml-include + +[](https://github.com/tanbro/pyyaml-include) +[](https://github.com/tanbro/pyyaml-include/actions?query=workflow%3A%22Python+package%22) +[](https://pyyaml-include.readthedocs.io/en/stable/?badge=stable) +[](https://sonarcloud.io/dashboard?id=tanbro_pyyaml-include) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) + +An extending constructor of [PyYAML][]: include [YAML][] files into [YAML][] document. + +## Install + +```sh +pip install pyyaml-include +``` + +## Usage + +Consider we have such [YAML] files: + +```text +├── 0.yml +└── include.d + ├── 1.yml + └── 2.yml +``` + +- `1.yml` 's content: + + ```yaml + name: "1" + ``` + +- `2.yml` 's content: + + ```yaml + name: "2" + ``` + +To include `1.yml`, `2.yml` in `0.yml`, we shall add `YamlIncludeConstructor` to [PyYAML]'s loader, then add an `!include` tag in `0.yaml`: + +```python +import yaml +from yamlinclude import YamlIncludeConstructor + +YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader, base_dir='/your/conf/dir') + +with open('0.yml') as f: + data = yaml.load(f, Loader=yaml.FullLoader) + +print(data) +``` + +### Mapping + +If `0.yml` was: + +```yaml +file1: !include include.d/1.yml +file2: !include include.d/2.yml +``` + +We'll get: + +```yaml +file1: + name: "1" +file2: + name: "2" +``` + +### Sequence + +If `0.yml` was: + +```yaml +files: + - !include include.d/1.yml + - !include include.d/2.yml +``` + +We'll get: + +```yaml +files: + - name: "1" + - name: "2" +``` + +> ℹ **Note**: +> +> File name can be either absolute (like `/usr/conf/1.5/Make.yml`) or relative (like `../../cfg/img.yml`). + +### Wildcards + +File name can contain shell-style wildcards. Data loaded from the file(s) found by wildcards will be set in a sequence. + +That is to say, a list will be returned when including file name contains wildcards. +Length of the returned list equals number of matched files: + +- when only 1 file matched, length of list will be 1 +- when there are no files matched, an empty list will be returned + +If `0.yml` was: + +```yaml +files: !include include.d/*.yml +``` + +We'll get: + +```yaml +files: + - name: "1" + - name: "2" +``` + +> ℹ **Note**: +> +> - For `Python>=3.5`, if `recursive` argument of `!include` [YAML] tag is `true`, the pattern `“**”` will match any files and zero or more directories and subdirectories. +> - Using the `“**”` pattern in large directory trees may consume an inordinate amount of time because of recursive search. + +In order to enable `recursive` argument, we shall set it in `Mapping` or `Sequence` arguments mode: + +- Arguments in `Sequence` mode: + + ```yaml + !include [tests/data/include.d/**/*.yml, true] + ``` + +- Arguments in `Mapping` mode: + + ```yaml + !include {pathname: tests/data/include.d/**/*.yml, recursive: true} + ``` + +### Non YAML files + +This extending constructor can now load data from non YAML files, supported file types are: + +- `json` +- `toml` (only available when [toml](https://pypi.org/project/toml/) installed) +- `ini` + +The constructor read non YAML files by different readers according to a pattern table defined in `src/yamlinclude/readers.py`. + +Default reader table can be replaced by a custom `reader_map` when call `add_to_loader_class`. + +[YAML]: http://yaml.org/ +[PyYaml]: https://pypi.org/project/PyYAML/ + +# AUTHORS + +* Liu Xue Yan (<liu_xue_yan@foxmail.com>) + + [](mailto:liu_xue_yan@foxmail.com) + +# Changelog + +## 1.3 + +Date: 2022-04-24 + +- New: + - PyYAML 6.0 supported + +- Misc: + - Better CI processes + +## 1.2 + +Date: 2019-02-03 + +- New: + - non YAML file including + +- Misc: + - adjust docs + - add pip and conda configure file of development environment + +- Fix: + - add `PlainTextReader` into `__all__` list of `reders` module + +## 1.1 + +Date: 2019-03-18 + +- Change: + - Update PyYAML to 5.* + - Rename: Argument `loader_class` of `YamlIncludeConstructor.add_to_loader_class()` (former: `loader_cls`) + +## 1.0.4 + +Date: 2019-01-07 + +- Change: + + - rename: `TAG` ==> `DEFAULT_TAG_NAME` + - add: `encoding` argument + +- Fix: + + - A wrong logging text format + +- Misc: + + - add: `.pylintrc` + +## 1.0.3 + +Date: 2018-12-04 + +- New Feature: + + - Add `base_dir` argument + +- Misc: + + - Add some new unit-test + - Add Python3.7 in CircleCI + +## 1.0.2 + +Date: 2018-07-11 + +- Add: + + - `encoding` argument + +- Bug fix: + + - encoding error if non-ascii characters on non-utf8 os. + +## 1.0.1 + +Date: 2018-07-03 + +- Add: + + - Old Python2.6 and new Python3.7 compatibilities + + - class method `add_to_loader_class` + + A class method to add the constructor itself into YAML loader class + + - Sphinx docs + +- Change: + + - Rename module file `include.py` to `constructor.py` + + - Rename class data member `DEFAULT_TAG` to `TAG` + +## 1.0 + +Date: 2018-06-08 + + + + +%package help +Summary: Development documents and examples for pyyaml-include +Provides: python3-pyyaml-include-doc +%description help +# pyyaml-include + +[](https://github.com/tanbro/pyyaml-include) +[](https://github.com/tanbro/pyyaml-include/actions?query=workflow%3A%22Python+package%22) +[](https://pyyaml-include.readthedocs.io/en/stable/?badge=stable) +[](https://sonarcloud.io/dashboard?id=tanbro_pyyaml-include) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) +[](https://pypi.org/project/pyyaml-include/) + +An extending constructor of [PyYAML][]: include [YAML][] files into [YAML][] document. + +## Install + +```sh +pip install pyyaml-include +``` + +## Usage + +Consider we have such [YAML] files: + +```text +├── 0.yml +└── include.d + ├── 1.yml + └── 2.yml +``` + +- `1.yml` 's content: + + ```yaml + name: "1" + ``` + +- `2.yml` 's content: + + ```yaml + name: "2" + ``` + +To include `1.yml`, `2.yml` in `0.yml`, we shall add `YamlIncludeConstructor` to [PyYAML]'s loader, then add an `!include` tag in `0.yaml`: + +```python +import yaml +from yamlinclude import YamlIncludeConstructor + +YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader, base_dir='/your/conf/dir') + +with open('0.yml') as f: + data = yaml.load(f, Loader=yaml.FullLoader) + +print(data) +``` + +### Mapping + +If `0.yml` was: + +```yaml +file1: !include include.d/1.yml +file2: !include include.d/2.yml +``` + +We'll get: + +```yaml +file1: + name: "1" +file2: + name: "2" +``` + +### Sequence + +If `0.yml` was: + +```yaml +files: + - !include include.d/1.yml + - !include include.d/2.yml +``` + +We'll get: + +```yaml +files: + - name: "1" + - name: "2" +``` + +> ℹ **Note**: +> +> File name can be either absolute (like `/usr/conf/1.5/Make.yml`) or relative (like `../../cfg/img.yml`). + +### Wildcards + +File name can contain shell-style wildcards. Data loaded from the file(s) found by wildcards will be set in a sequence. + +That is to say, a list will be returned when including file name contains wildcards. +Length of the returned list equals number of matched files: + +- when only 1 file matched, length of list will be 1 +- when there are no files matched, an empty list will be returned + +If `0.yml` was: + +```yaml +files: !include include.d/*.yml +``` + +We'll get: + +```yaml +files: + - name: "1" + - name: "2" +``` + +> ℹ **Note**: +> +> - For `Python>=3.5`, if `recursive` argument of `!include` [YAML] tag is `true`, the pattern `“**”` will match any files and zero or more directories and subdirectories. +> - Using the `“**”` pattern in large directory trees may consume an inordinate amount of time because of recursive search. + +In order to enable `recursive` argument, we shall set it in `Mapping` or `Sequence` arguments mode: + +- Arguments in `Sequence` mode: + + ```yaml + !include [tests/data/include.d/**/*.yml, true] + ``` + +- Arguments in `Mapping` mode: + + ```yaml + !include {pathname: tests/data/include.d/**/*.yml, recursive: true} + ``` + +### Non YAML files + +This extending constructor can now load data from non YAML files, supported file types are: + +- `json` +- `toml` (only available when [toml](https://pypi.org/project/toml/) installed) +- `ini` + +The constructor read non YAML files by different readers according to a pattern table defined in `src/yamlinclude/readers.py`. + +Default reader table can be replaced by a custom `reader_map` when call `add_to_loader_class`. + +[YAML]: http://yaml.org/ +[PyYaml]: https://pypi.org/project/PyYAML/ + +# AUTHORS + +* Liu Xue Yan (<liu_xue_yan@foxmail.com>) + + [](mailto:liu_xue_yan@foxmail.com) + +# Changelog + +## 1.3 + +Date: 2022-04-24 + +- New: + - PyYAML 6.0 supported + +- Misc: + - Better CI processes + +## 1.2 + +Date: 2019-02-03 + +- New: + - non YAML file including + +- Misc: + - adjust docs + - add pip and conda configure file of development environment + +- Fix: + - add `PlainTextReader` into `__all__` list of `reders` module + +## 1.1 + +Date: 2019-03-18 + +- Change: + - Update PyYAML to 5.* + - Rename: Argument `loader_class` of `YamlIncludeConstructor.add_to_loader_class()` (former: `loader_cls`) + +## 1.0.4 + +Date: 2019-01-07 + +- Change: + + - rename: `TAG` ==> `DEFAULT_TAG_NAME` + - add: `encoding` argument + +- Fix: + + - A wrong logging text format + +- Misc: + + - add: `.pylintrc` + +## 1.0.3 + +Date: 2018-12-04 + +- New Feature: + + - Add `base_dir` argument + +- Misc: + + - Add some new unit-test + - Add Python3.7 in CircleCI + +## 1.0.2 + +Date: 2018-07-11 + +- Add: + + - `encoding` argument + +- Bug fix: + + - encoding error if non-ascii characters on non-utf8 os. + +## 1.0.1 + +Date: 2018-07-03 + +- Add: + + - Old Python2.6 and new Python3.7 compatibilities + + - class method `add_to_loader_class` + + A class method to add the constructor itself into YAML loader class + + - Sphinx docs + +- Change: + + - Rename module file `include.py` to `constructor.py` + + - Rename class data member `DEFAULT_TAG` to `TAG` + +## 1.0 + +Date: 2018-06-08 + + + + +%prep +%autosetup -n pyyaml-include-1.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pyyaml-include -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3-1 +- Package Spec generated @@ -0,0 +1 @@ +b81c82391dce93a13cd3777848cd4397 pyyaml-include-1.3.tar.gz |