From 769dc506003cfc7cac4debdc7426e7977dbc04b2 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Tue, 20 Jun 2023 06:04:22 +0000 Subject: automatic import of python-roles --- .gitignore | 1 + python-roles.spec | 294 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 296 insertions(+) create mode 100644 python-roles.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..95c0c78 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/roles-1.0.0.tar.gz diff --git a/python-roles.spec b/python-roles.spec new file mode 100644 index 0000000..eb8e693 --- /dev/null +++ b/python-roles.spec @@ -0,0 +1,294 @@ +%global _empty_manifest_terminate_build 0 +Name: python-roles +Version: 1.0.0 +Release: 1 +Summary: Role based software development +License: BSD License +URL: https://github.com/amolenaar/roles +Source0: https://mirrors.aliyun.com/pypi/web/packages/c9/6f/7fd955e74bae50565d8a010ea1a4e45aa06841d6d38111ea736879fc7678/roles-1.0.0.tar.gz +BuildArch: noarch + + +%description +# Roles + +Library for Role based development. + +Pythonic implementation of the DCI (Data Context Interaction) pattern +(http://www.artima.com/articles/dci_vision.html). + +The big difference with mixins is that this role is applied only to the subject +instance, not to the subject class (alas, a new class is constructed). + +Roles can be assigned and revoked. Multiple roles can be applied to an +instance. Revocation can happen in any particular order. + +Homepage: http://github.com/amolenaar/roles + +Releases: http://pypi.python.org/pypi/roles + + +## Using Roles + +As a basic example, consider a domain class: + +```python +>>> class Person: +... def __init__(self, name): +... self.name = name +>>> person = Person("John") +``` + +The instance should participate in a collaboration in which it fulfills a +particular role: + +```python +>>> from roles import RoleType +>>> class Carpenter(metaclass=RoleType): +... def chop(self): +... return "chop, chop" + +``` +Assign the role to the person: + +```python +>>> Carpenter(person) # doctest: +ELLIPSIS +<__main__.Person+Carpenter object at 0x...> +>>> person # doctest: +ELLIPSIS +<__main__.Person+Carpenter object at 0x...> + +``` + +The person is still a Person: + +```python +>>> isinstance(person, Person) +True + +``` +... and can do carpenter things: + +```python +>>> person.chop() +'chop, chop' + +``` + +See [`roles.py`](http://github.com/amolenaar/roles/blob/master/roles.py) for more examples. + +## Context + +Roles make a lot of sense when used in a context. A classic example is the +money transfer example. Here two accounts are used and an amount of money is +transfered from one account to the other. So, one account playes the role of +source account and the other plays the role of target account. + +An example can be found in [`example.py`](http://github.com/amolenaar/roles/blob/master/example.py). + + +%package -n python3-roles +Summary: Role based software development +Provides: python-roles +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-roles +# Roles + +Library for Role based development. + +Pythonic implementation of the DCI (Data Context Interaction) pattern +(http://www.artima.com/articles/dci_vision.html). + +The big difference with mixins is that this role is applied only to the subject +instance, not to the subject class (alas, a new class is constructed). + +Roles can be assigned and revoked. Multiple roles can be applied to an +instance. Revocation can happen in any particular order. + +Homepage: http://github.com/amolenaar/roles + +Releases: http://pypi.python.org/pypi/roles + + +## Using Roles + +As a basic example, consider a domain class: + +```python +>>> class Person: +... def __init__(self, name): +... self.name = name +>>> person = Person("John") +``` + +The instance should participate in a collaboration in which it fulfills a +particular role: + +```python +>>> from roles import RoleType +>>> class Carpenter(metaclass=RoleType): +... def chop(self): +... return "chop, chop" + +``` +Assign the role to the person: + +```python +>>> Carpenter(person) # doctest: +ELLIPSIS +<__main__.Person+Carpenter object at 0x...> +>>> person # doctest: +ELLIPSIS +<__main__.Person+Carpenter object at 0x...> + +``` + +The person is still a Person: + +```python +>>> isinstance(person, Person) +True + +``` +... and can do carpenter things: + +```python +>>> person.chop() +'chop, chop' + +``` + +See [`roles.py`](http://github.com/amolenaar/roles/blob/master/roles.py) for more examples. + +## Context + +Roles make a lot of sense when used in a context. A classic example is the +money transfer example. Here two accounts are used and an amount of money is +transfered from one account to the other. So, one account playes the role of +source account and the other plays the role of target account. + +An example can be found in [`example.py`](http://github.com/amolenaar/roles/blob/master/example.py). + + +%package help +Summary: Development documents and examples for roles +Provides: python3-roles-doc +%description help +# Roles + +Library for Role based development. + +Pythonic implementation of the DCI (Data Context Interaction) pattern +(http://www.artima.com/articles/dci_vision.html). + +The big difference with mixins is that this role is applied only to the subject +instance, not to the subject class (alas, a new class is constructed). + +Roles can be assigned and revoked. Multiple roles can be applied to an +instance. Revocation can happen in any particular order. + +Homepage: http://github.com/amolenaar/roles + +Releases: http://pypi.python.org/pypi/roles + + +## Using Roles + +As a basic example, consider a domain class: + +```python +>>> class Person: +... def __init__(self, name): +... self.name = name +>>> person = Person("John") +``` + +The instance should participate in a collaboration in which it fulfills a +particular role: + +```python +>>> from roles import RoleType +>>> class Carpenter(metaclass=RoleType): +... def chop(self): +... return "chop, chop" + +``` +Assign the role to the person: + +```python +>>> Carpenter(person) # doctest: +ELLIPSIS +<__main__.Person+Carpenter object at 0x...> +>>> person # doctest: +ELLIPSIS +<__main__.Person+Carpenter object at 0x...> + +``` + +The person is still a Person: + +```python +>>> isinstance(person, Person) +True + +``` +... and can do carpenter things: + +```python +>>> person.chop() +'chop, chop' + +``` + +See [`roles.py`](http://github.com/amolenaar/roles/blob/master/roles.py) for more examples. + +## Context + +Roles make a lot of sense when used in a context. A classic example is the +money transfer example. Here two accounts are used and an amount of money is +transfered from one account to the other. So, one account playes the role of +source account and the other plays the role of target account. + +An example can be found in [`example.py`](http://github.com/amolenaar/roles/blob/master/example.py). + + +%prep +%autosetup -n roles-1.0.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-roles -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot - 1.0.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..83420bb --- /dev/null +++ b/sources @@ -0,0 +1 @@ +d0d235c7f6c192a7b6c04e2970d27212 roles-1.0.0.tar.gz -- cgit v1.2.3