diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-29 12:40:11 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-29 12:40:11 +0000 |
commit | 94b2f6da265b176051a5e7793ba4bf08081330b8 (patch) | |
tree | 6cf0940b16a98ed3e9343d9c1f03d4e80faacb63 | |
parent | 1909d08d29af35dfd26922ff6d534651ba9b8ba2 (diff) |
automatic import of python-anyioc
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-anyioc.spec | 192 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 194 insertions, 0 deletions
@@ -0,0 +1 @@ +/anyioc-0.15.0.tar.gz diff --git a/python-anyioc.spec b/python-anyioc.spec new file mode 100644 index 0000000..53da57f --- /dev/null +++ b/python-anyioc.spec @@ -0,0 +1,192 @@ +%global _empty_manifest_terminate_build 0 +Name: python-anyioc +Version: 0.15.0 +Release: 1 +Summary: Another simple ioc framework for python +License: MIT +URL: https://pypi.org/project/anyioc/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c5/20/839c0b651df9e4dec0d5dd0c591a9a2c1cf2314b47e9852d66f5712e011e/anyioc-0.15.0.tar.gz +BuildArch: noarch + + +%description +# anyioc + + +[](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml) +[](https://pypi.org/project/anyioc/) + + +Another simple ioc framework for python. + +## Usage + +``` py +from anyioc import ServiceProvider +provider = ServiceProvider() +provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider` +value = provider.get('the key') +assert value == 102 +``` + +## Register and resolve + +By default, you can use following methods to register services: + +- `ServiceProvider.register_singleton(key, factory)` +- `ServiceProvider.register_scoped(key, factory)` +- `ServiceProvider.register_transient(key, factory)` +- `ServiceProvider.register(key, factory, lifetime)` +- `ServiceProvider.register_value(key, value)` +- `ServiceProvider.register_group(key, keys)` +- `ServiceProvider.register_bind(new_key, target_key)` + +And use following methods to resolve services: + +- `ServiceProvider.__getitem__(key)` +- `ServiceProvider.get(key)` +- `ServiceProvider.get_many(key)` + +*`get` return `None` if the service was not found, but `__getitem__` will raise a `ServiceNotFoundError`.* + +Read full [documentation](https://github.com/Cologler/anyioc-python/wiki). + + +%package -n python3-anyioc +Summary: Another simple ioc framework for python +Provides: python-anyioc +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-anyioc +# anyioc + + +[](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml) +[](https://pypi.org/project/anyioc/) + + +Another simple ioc framework for python. + +## Usage + +``` py +from anyioc import ServiceProvider +provider = ServiceProvider() +provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider` +value = provider.get('the key') +assert value == 102 +``` + +## Register and resolve + +By default, you can use following methods to register services: + +- `ServiceProvider.register_singleton(key, factory)` +- `ServiceProvider.register_scoped(key, factory)` +- `ServiceProvider.register_transient(key, factory)` +- `ServiceProvider.register(key, factory, lifetime)` +- `ServiceProvider.register_value(key, value)` +- `ServiceProvider.register_group(key, keys)` +- `ServiceProvider.register_bind(new_key, target_key)` + +And use following methods to resolve services: + +- `ServiceProvider.__getitem__(key)` +- `ServiceProvider.get(key)` +- `ServiceProvider.get_many(key)` + +*`get` return `None` if the service was not found, but `__getitem__` will raise a `ServiceNotFoundError`.* + +Read full [documentation](https://github.com/Cologler/anyioc-python/wiki). + + +%package help +Summary: Development documents and examples for anyioc +Provides: python3-anyioc-doc +%description help +# anyioc + + +[](https://github.com/Cologler/anyioc-python/actions/workflows/testing.yml) +[](https://pypi.org/project/anyioc/) + + +Another simple ioc framework for python. + +## Usage + +``` py +from anyioc import ServiceProvider +provider = ServiceProvider() +provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider` +value = provider.get('the key') +assert value == 102 +``` + +## Register and resolve + +By default, you can use following methods to register services: + +- `ServiceProvider.register_singleton(key, factory)` +- `ServiceProvider.register_scoped(key, factory)` +- `ServiceProvider.register_transient(key, factory)` +- `ServiceProvider.register(key, factory, lifetime)` +- `ServiceProvider.register_value(key, value)` +- `ServiceProvider.register_group(key, keys)` +- `ServiceProvider.register_bind(new_key, target_key)` + +And use following methods to resolve services: + +- `ServiceProvider.__getitem__(key)` +- `ServiceProvider.get(key)` +- `ServiceProvider.get_many(key)` + +*`get` return `None` if the service was not found, but `__getitem__` will raise a `ServiceNotFoundError`.* + +Read full [documentation](https://github.com/Cologler/anyioc-python/wiki). + + +%prep +%autosetup -n anyioc-0.15.0 + +%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-anyioc -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.15.0-1 +- Package Spec generated @@ -0,0 +1 @@ +34a10a0b4ce046d94f397702e0e5712a anyioc-0.15.0.tar.gz |