summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-10 12:05:08 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-10 12:05:08 +0000
commitf2d5f9100bd244107e693dc19f00390d16f2b3c1 (patch)
tree04c88d9c545cde0737210c5f9dbd5e88446c64e5
parente18a203b39835e79f8104c813c72a2161cf5f684 (diff)
automatic import of python-pyyaml-env-tag
-rw-r--r--.gitignore1
-rw-r--r--python-pyyaml-env-tag.spec421
-rw-r--r--sources1
3 files changed, 423 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..d621f1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pyyaml_env_tag-0.1.tar.gz
diff --git a/python-pyyaml-env-tag.spec b/python-pyyaml-env-tag.spec
new file mode 100644
index 0000000..e44e066
--- /dev/null
+++ b/python-pyyaml-env-tag.spec
@@ -0,0 +1,421 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pyyaml_env_tag
+Version: 0.1
+Release: 1
+Summary: A custom YAML tag for referencing environment variables in YAML files.
+License: MIT License
+URL: https://github.com/waylan/pyyaml-env-tag
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/fb/8e/da1c6c58f751b70f8ceb1eb25bc25d524e8f14fe16edcce3f4e3ba08629c/pyyaml_env_tag-0.1.tar.gz
+BuildArch: noarch
+
+Requires: python3-pyyaml
+
+%description
+# pyyaml_env_tag
+
+A custom YAML tag for referencing environment variables in YAML files.
+
+## Installation
+
+Install `PyYAML` and the `pyyaml_env_tag` package with pip:
+
+```bash
+pip install pyyaml pyyaml_env_tag
+```
+
+### Enabling the tag
+
+To enable the tag, import and add the `construct_env_tag` constructor to your YAML
+loader of choice.
+
+```python
+import yaml
+from yaml_env_tag import construct_env_tag
+
+yaml.Loader.add_constructor('!ENV', construct_env_tag)
+```
+
+Then you may use the loader as per usual. For example:
+
+```python
+yaml.load(data, Loader=yaml.Loader)
+```
+
+## Using the tag
+
+Include the tag `!ENV` followed by the name of an environment variable in a YAML
+file and the value of the environment variable will be used in its place.
+
+```yaml
+key: !ENV SOME_VARIABLE
+```
+
+If `SOME_VARIABLE` is set to `A string!`, then the above YAML would result in the
+following Python object:
+
+```python
+{'key': 'A string!'}
+```
+
+The content of the variable is parsed using YAML's implicit scalar types, such as
+string, bool, integer, float, datestamp and null. More complex types are not
+recognized and simply passed through as a string. For example, if `SOME_VARIABLE`
+was set to the string `true`, then the above YAML would result in the following:
+
+```python
+{'key': True}
+```
+
+If the variable specified is not set, then a `null` value is assigned as a default.
+You may define your own default as the last item in a sequence.
+
+```yaml
+key: !ENV [SOME_VARIABLE, default]
+```
+
+In the above example, if `SOME_VARIABLE` is not defined, the string `default` would
+be used instead, as follows:
+
+```python
+{'key': 'default'}
+```
+
+You may list multiple variables as fallbacks. The first variable which is set is
+used. In any sequance with more than one item, the last item must always be a
+default value and will not be resolved as an environment variable.
+
+```yaml
+key: !ENV [SOME_VARIABLE, FALLBACK, default]
+```
+
+As with variable contents, the default is resolved to a Python object of the
+implied type (string, bool, integer, float, datestamp and null).
+
+When `SOME_VARIABLE` is not set, all four of the following items will resolve to
+the same value (`None`):
+
+```yaml
+- !ENV SOME_VARIABLE
+- !ENV [SOME_VARIABLE]
+- !ENV [SOME_VARIABLE, ~]
+- !ENV [SOME_VARIABLE, null]
+```
+
+## Related
+
+pyyaml_env_tag was inspired by the Ruby package [yaml-env-tag].
+
+An alternate method of referencing environment variables in YAML files is
+implemented by [pyyaml-tags] and [python_yaml_environment_variables].
+Each of those libraries use a template string and replace the template tag with
+the content of the variable. While this allows a single value to reference
+multiple variables and to contain additional content, it restricts all values
+to strings only and does not provide a way to define defaults.
+
+[yaml-env-tag]: https://github.com/jirutka/yaml-env-tag
+[pyyaml-tags]: https://github.com/meiblorn/pyyaml-tags
+[python_yaml_environment_variables]: https://gist.github.com/mkaranasou/ba83e25c835a8f7629e34dd7ede01931
+
+## License
+
+pyyaml_env_tag is licensed under the [MIT License] as defined in `LICENSE`.
+
+[MIT License]: https://opensource.org/licenses/MIT
+
+## Changelog
+
+### Version 0.1 (released 2020-11-11)
+
+The initial release.
+
+
+%package -n python3-pyyaml_env_tag
+Summary: A custom YAML tag for referencing environment variables in YAML files.
+Provides: python-pyyaml_env_tag
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pyyaml_env_tag
+# pyyaml_env_tag
+
+A custom YAML tag for referencing environment variables in YAML files.
+
+## Installation
+
+Install `PyYAML` and the `pyyaml_env_tag` package with pip:
+
+```bash
+pip install pyyaml pyyaml_env_tag
+```
+
+### Enabling the tag
+
+To enable the tag, import and add the `construct_env_tag` constructor to your YAML
+loader of choice.
+
+```python
+import yaml
+from yaml_env_tag import construct_env_tag
+
+yaml.Loader.add_constructor('!ENV', construct_env_tag)
+```
+
+Then you may use the loader as per usual. For example:
+
+```python
+yaml.load(data, Loader=yaml.Loader)
+```
+
+## Using the tag
+
+Include the tag `!ENV` followed by the name of an environment variable in a YAML
+file and the value of the environment variable will be used in its place.
+
+```yaml
+key: !ENV SOME_VARIABLE
+```
+
+If `SOME_VARIABLE` is set to `A string!`, then the above YAML would result in the
+following Python object:
+
+```python
+{'key': 'A string!'}
+```
+
+The content of the variable is parsed using YAML's implicit scalar types, such as
+string, bool, integer, float, datestamp and null. More complex types are not
+recognized and simply passed through as a string. For example, if `SOME_VARIABLE`
+was set to the string `true`, then the above YAML would result in the following:
+
+```python
+{'key': True}
+```
+
+If the variable specified is not set, then a `null` value is assigned as a default.
+You may define your own default as the last item in a sequence.
+
+```yaml
+key: !ENV [SOME_VARIABLE, default]
+```
+
+In the above example, if `SOME_VARIABLE` is not defined, the string `default` would
+be used instead, as follows:
+
+```python
+{'key': 'default'}
+```
+
+You may list multiple variables as fallbacks. The first variable which is set is
+used. In any sequance with more than one item, the last item must always be a
+default value and will not be resolved as an environment variable.
+
+```yaml
+key: !ENV [SOME_VARIABLE, FALLBACK, default]
+```
+
+As with variable contents, the default is resolved to a Python object of the
+implied type (string, bool, integer, float, datestamp and null).
+
+When `SOME_VARIABLE` is not set, all four of the following items will resolve to
+the same value (`None`):
+
+```yaml
+- !ENV SOME_VARIABLE
+- !ENV [SOME_VARIABLE]
+- !ENV [SOME_VARIABLE, ~]
+- !ENV [SOME_VARIABLE, null]
+```
+
+## Related
+
+pyyaml_env_tag was inspired by the Ruby package [yaml-env-tag].
+
+An alternate method of referencing environment variables in YAML files is
+implemented by [pyyaml-tags] and [python_yaml_environment_variables].
+Each of those libraries use a template string and replace the template tag with
+the content of the variable. While this allows a single value to reference
+multiple variables and to contain additional content, it restricts all values
+to strings only and does not provide a way to define defaults.
+
+[yaml-env-tag]: https://github.com/jirutka/yaml-env-tag
+[pyyaml-tags]: https://github.com/meiblorn/pyyaml-tags
+[python_yaml_environment_variables]: https://gist.github.com/mkaranasou/ba83e25c835a8f7629e34dd7ede01931
+
+## License
+
+pyyaml_env_tag is licensed under the [MIT License] as defined in `LICENSE`.
+
+[MIT License]: https://opensource.org/licenses/MIT
+
+## Changelog
+
+### Version 0.1 (released 2020-11-11)
+
+The initial release.
+
+
+%package help
+Summary: Development documents and examples for pyyaml_env_tag
+Provides: python3-pyyaml_env_tag-doc
+%description help
+# pyyaml_env_tag
+
+A custom YAML tag for referencing environment variables in YAML files.
+
+## Installation
+
+Install `PyYAML` and the `pyyaml_env_tag` package with pip:
+
+```bash
+pip install pyyaml pyyaml_env_tag
+```
+
+### Enabling the tag
+
+To enable the tag, import and add the `construct_env_tag` constructor to your YAML
+loader of choice.
+
+```python
+import yaml
+from yaml_env_tag import construct_env_tag
+
+yaml.Loader.add_constructor('!ENV', construct_env_tag)
+```
+
+Then you may use the loader as per usual. For example:
+
+```python
+yaml.load(data, Loader=yaml.Loader)
+```
+
+## Using the tag
+
+Include the tag `!ENV` followed by the name of an environment variable in a YAML
+file and the value of the environment variable will be used in its place.
+
+```yaml
+key: !ENV SOME_VARIABLE
+```
+
+If `SOME_VARIABLE` is set to `A string!`, then the above YAML would result in the
+following Python object:
+
+```python
+{'key': 'A string!'}
+```
+
+The content of the variable is parsed using YAML's implicit scalar types, such as
+string, bool, integer, float, datestamp and null. More complex types are not
+recognized and simply passed through as a string. For example, if `SOME_VARIABLE`
+was set to the string `true`, then the above YAML would result in the following:
+
+```python
+{'key': True}
+```
+
+If the variable specified is not set, then a `null` value is assigned as a default.
+You may define your own default as the last item in a sequence.
+
+```yaml
+key: !ENV [SOME_VARIABLE, default]
+```
+
+In the above example, if `SOME_VARIABLE` is not defined, the string `default` would
+be used instead, as follows:
+
+```python
+{'key': 'default'}
+```
+
+You may list multiple variables as fallbacks. The first variable which is set is
+used. In any sequance with more than one item, the last item must always be a
+default value and will not be resolved as an environment variable.
+
+```yaml
+key: !ENV [SOME_VARIABLE, FALLBACK, default]
+```
+
+As with variable contents, the default is resolved to a Python object of the
+implied type (string, bool, integer, float, datestamp and null).
+
+When `SOME_VARIABLE` is not set, all four of the following items will resolve to
+the same value (`None`):
+
+```yaml
+- !ENV SOME_VARIABLE
+- !ENV [SOME_VARIABLE]
+- !ENV [SOME_VARIABLE, ~]
+- !ENV [SOME_VARIABLE, null]
+```
+
+## Related
+
+pyyaml_env_tag was inspired by the Ruby package [yaml-env-tag].
+
+An alternate method of referencing environment variables in YAML files is
+implemented by [pyyaml-tags] and [python_yaml_environment_variables].
+Each of those libraries use a template string and replace the template tag with
+the content of the variable. While this allows a single value to reference
+multiple variables and to contain additional content, it restricts all values
+to strings only and does not provide a way to define defaults.
+
+[yaml-env-tag]: https://github.com/jirutka/yaml-env-tag
+[pyyaml-tags]: https://github.com/meiblorn/pyyaml-tags
+[python_yaml_environment_variables]: https://gist.github.com/mkaranasou/ba83e25c835a8f7629e34dd7ede01931
+
+## License
+
+pyyaml_env_tag is licensed under the [MIT License] as defined in `LICENSE`.
+
+[MIT License]: https://opensource.org/licenses/MIT
+
+## Changelog
+
+### Version 0.1 (released 2020-11-11)
+
+The initial release.
+
+
+%prep
+%autosetup -n pyyaml_env_tag-0.1
+
+%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_env_tag -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..0eb831c
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+bb7743fe8e53d8716da6c1bdb7945641 pyyaml_env_tag-0.1.tar.gz