summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-11 17:37:41 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-11 17:37:41 +0000
commit0438584d9299d0d8a401e93fb295db0caa578f86 (patch)
tree2469d7d63034379b6ee794cac9bb10aa01bafa98
parentff573d6d94816dfe440d21cb69f597da424dc3ee (diff)
automatic import of python-contextdecorator
-rw-r--r--.gitignore1
-rw-r--r--python-contextdecorator.spec357
-rw-r--r--sources1
3 files changed, 359 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..ccdcbfc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/contextdecorator-0.10.0.tar.gz
diff --git a/python-contextdecorator.spec b/python-contextdecorator.spec
new file mode 100644
index 0000000..275d28a
--- /dev/null
+++ b/python-contextdecorator.spec
@@ -0,0 +1,357 @@
+%global _empty_manifest_terminate_build 0
+Name: python-contextdecorator
+Version: 0.10.0
+Release: 1
+Summary: Create APIs that work as decorators and as context managers.
+License: UNKNOWN
+URL: UNKNOWN
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/77/43/03f264fa07fb0f794bfe174751eb6e6e294a89fc53af87ea1cb0df26ac18/contextdecorator-0.10.0.tar.gz
+BuildArch: noarch
+
+
+%description
+If you're a library or framework creator then it is nice to be able to create
+APIs that can be used *either* as decorators or context managers.
+
+The contextdecorator module is a backport of new features added to the
+`contextlib module <http://docs.python.org/library/contextlib.html>`_ in
+Python 3.2. contextdecorator works with Python 2.4+ including Python 3.
+
+Context managers inheriting from ``ContextDecorator`` have to implement
+``__enter__`` and ``__exit__`` as normal.
+`__exit__ <http://docs.python.org/reference/datamodel.html#object.__exit__>`_
+retains its optional exception handling even when used as a decorator.
+
+Example::
+
+ from contextdecorator import ContextDecorator
+
+ class mycontext(ContextDecorator):
+ def __enter__(self):
+ print 'Starting'
+ return self
+
+ def __exit__(self, *exc):
+ print 'Finishing'
+ return False
+
+ >>> @mycontext()
+ ... def function():
+ ... print 'The bit in the middle'
+ ...
+ >>> function()
+ Starting
+ The bit in the middle
+ Finishing
+
+ >>> with mycontext():
+ ... print 'The bit in the middle'
+ ...
+ Starting
+ The bit in the middle
+ Finishing
+
+Existing context managers that already have a base class can be extended by
+using ``ContextDecorator`` as a mixin class::
+
+ from contextdecorator import ContextDecorator
+
+ class mycontext(ContextBaseClass, ContextDecorator):
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *exc):
+ return False
+
+contextdecorator also contains an implementation of `contextlib.contextmanager
+<http://docs.python.org/library/contextlib.html#contextlib.contextmanager>`_
+that uses ``ContextDecorator``. The context managers it creates can be used as
+decorators as well as in with statements. ::
+
+ from contextdecorator import contextmanager
+
+ @contextmanager
+ def mycontext(*args):
+ print 'Started'
+ try:
+ yield
+ finally:
+ print 'Finished!'
+
+ >>> @mycontext('some', 'args')
+ ... def function():
+ ... print 'In the middle'
+ ...
+ Started
+ In the middle
+ Finished!
+
+ >>> with mycontext('some', 'args'):
+ ... print 'In the middle'
+ ...
+ Started
+ In the middle
+ Finished!
+
+Repository and issue tracker:
+
+* `contextdecorator on google code <http://code.google.com/p/contextdecorator/>`_
+
+The project is available for download from `PyPI
+<http://pypi.python.org/pypi/contextdecorator>`_
+so it can be easily installed:
+
+ | ``pip install -U contextdecorator``
+ | ``easy_install -U contextdecorator``
+
+The tests require `unittest2 <http://pypi.python.org/pypi/unittest2>`_
+to run.
+
+%package -n python3-contextdecorator
+Summary: Create APIs that work as decorators and as context managers.
+Provides: python-contextdecorator
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-contextdecorator
+If you're a library or framework creator then it is nice to be able to create
+APIs that can be used *either* as decorators or context managers.
+
+The contextdecorator module is a backport of new features added to the
+`contextlib module <http://docs.python.org/library/contextlib.html>`_ in
+Python 3.2. contextdecorator works with Python 2.4+ including Python 3.
+
+Context managers inheriting from ``ContextDecorator`` have to implement
+``__enter__`` and ``__exit__`` as normal.
+`__exit__ <http://docs.python.org/reference/datamodel.html#object.__exit__>`_
+retains its optional exception handling even when used as a decorator.
+
+Example::
+
+ from contextdecorator import ContextDecorator
+
+ class mycontext(ContextDecorator):
+ def __enter__(self):
+ print 'Starting'
+ return self
+
+ def __exit__(self, *exc):
+ print 'Finishing'
+ return False
+
+ >>> @mycontext()
+ ... def function():
+ ... print 'The bit in the middle'
+ ...
+ >>> function()
+ Starting
+ The bit in the middle
+ Finishing
+
+ >>> with mycontext():
+ ... print 'The bit in the middle'
+ ...
+ Starting
+ The bit in the middle
+ Finishing
+
+Existing context managers that already have a base class can be extended by
+using ``ContextDecorator`` as a mixin class::
+
+ from contextdecorator import ContextDecorator
+
+ class mycontext(ContextBaseClass, ContextDecorator):
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *exc):
+ return False
+
+contextdecorator also contains an implementation of `contextlib.contextmanager
+<http://docs.python.org/library/contextlib.html#contextlib.contextmanager>`_
+that uses ``ContextDecorator``. The context managers it creates can be used as
+decorators as well as in with statements. ::
+
+ from contextdecorator import contextmanager
+
+ @contextmanager
+ def mycontext(*args):
+ print 'Started'
+ try:
+ yield
+ finally:
+ print 'Finished!'
+
+ >>> @mycontext('some', 'args')
+ ... def function():
+ ... print 'In the middle'
+ ...
+ Started
+ In the middle
+ Finished!
+
+ >>> with mycontext('some', 'args'):
+ ... print 'In the middle'
+ ...
+ Started
+ In the middle
+ Finished!
+
+Repository and issue tracker:
+
+* `contextdecorator on google code <http://code.google.com/p/contextdecorator/>`_
+
+The project is available for download from `PyPI
+<http://pypi.python.org/pypi/contextdecorator>`_
+so it can be easily installed:
+
+ | ``pip install -U contextdecorator``
+ | ``easy_install -U contextdecorator``
+
+The tests require `unittest2 <http://pypi.python.org/pypi/unittest2>`_
+to run.
+
+%package help
+Summary: Development documents and examples for contextdecorator
+Provides: python3-contextdecorator-doc
+%description help
+If you're a library or framework creator then it is nice to be able to create
+APIs that can be used *either* as decorators or context managers.
+
+The contextdecorator module is a backport of new features added to the
+`contextlib module <http://docs.python.org/library/contextlib.html>`_ in
+Python 3.2. contextdecorator works with Python 2.4+ including Python 3.
+
+Context managers inheriting from ``ContextDecorator`` have to implement
+``__enter__`` and ``__exit__`` as normal.
+`__exit__ <http://docs.python.org/reference/datamodel.html#object.__exit__>`_
+retains its optional exception handling even when used as a decorator.
+
+Example::
+
+ from contextdecorator import ContextDecorator
+
+ class mycontext(ContextDecorator):
+ def __enter__(self):
+ print 'Starting'
+ return self
+
+ def __exit__(self, *exc):
+ print 'Finishing'
+ return False
+
+ >>> @mycontext()
+ ... def function():
+ ... print 'The bit in the middle'
+ ...
+ >>> function()
+ Starting
+ The bit in the middle
+ Finishing
+
+ >>> with mycontext():
+ ... print 'The bit in the middle'
+ ...
+ Starting
+ The bit in the middle
+ Finishing
+
+Existing context managers that already have a base class can be extended by
+using ``ContextDecorator`` as a mixin class::
+
+ from contextdecorator import ContextDecorator
+
+ class mycontext(ContextBaseClass, ContextDecorator):
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *exc):
+ return False
+
+contextdecorator also contains an implementation of `contextlib.contextmanager
+<http://docs.python.org/library/contextlib.html#contextlib.contextmanager>`_
+that uses ``ContextDecorator``. The context managers it creates can be used as
+decorators as well as in with statements. ::
+
+ from contextdecorator import contextmanager
+
+ @contextmanager
+ def mycontext(*args):
+ print 'Started'
+ try:
+ yield
+ finally:
+ print 'Finished!'
+
+ >>> @mycontext('some', 'args')
+ ... def function():
+ ... print 'In the middle'
+ ...
+ Started
+ In the middle
+ Finished!
+
+ >>> with mycontext('some', 'args'):
+ ... print 'In the middle'
+ ...
+ Started
+ In the middle
+ Finished!
+
+Repository and issue tracker:
+
+* `contextdecorator on google code <http://code.google.com/p/contextdecorator/>`_
+
+The project is available for download from `PyPI
+<http://pypi.python.org/pypi/contextdecorator>`_
+so it can be easily installed:
+
+ | ``pip install -U contextdecorator``
+ | ``easy_install -U contextdecorator``
+
+The tests require `unittest2 <http://pypi.python.org/pypi/unittest2>`_
+to run.
+
+%prep
+%autosetup -n contextdecorator-0.10.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-contextdecorator -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.10.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..d15a816
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+779973c0e9502c9fdc7add9628cbb58d contextdecorator-0.10.0.tar.gz