diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-10 14:02:08 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 14:02:08 +0000 |
| commit | 55529ac5bc50f9f3b2f10c8689011421472e87cd (patch) | |
| tree | e489253fac71f2fb7b81ba67b02441d41c397593 /python-htpasswd.spec | |
| parent | 2d7e044c2cdaa6d298fa489cd2eae26d0b6f1876 (diff) | |
automatic import of python-htpasswd
Diffstat (limited to 'python-htpasswd.spec')
| -rw-r--r-- | python-htpasswd.spec | 294 |
1 files changed, 294 insertions, 0 deletions
diff --git a/python-htpasswd.spec b/python-htpasswd.spec new file mode 100644 index 0000000..1f63a98 --- /dev/null +++ b/python-htpasswd.spec @@ -0,0 +1,294 @@ +%global _empty_manifest_terminate_build 0 +Name: python-htpasswd +Version: 2.3 +Release: 1 +Summary: Library to work with htpasswd user (basic authorization) and group files. +License: MIT +URL: https://github.com/thesharp/htpasswd +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b9/2f/8b76f8b77125b75c3532966f3291f9e8787268be65fc4c9694887cba9375/htpasswd-2.3.tar.gz +BuildArch: noarch + + +%description +# htpasswd [](http://travis-ci.org/thesharp/htpasswd) + +## Description +**htpasswd** is a library for working with htpasswd user (only basic authorization) and group files. It supports CRYPT and MD5 encryption methods. To actually use MD5 encryption method you *MUST* have an ``openssl`` binary installed into system ``$PATH``. + +## Dependencies +- Python 2.7 or 3.3 or 3.4 +- [orderedmultidict](http://pypi.python.org/pypi/orderedmultidict/0.7) >= 0.7 +- [future](https://pypi.python.org/pypi/future) +- [nose](http://pypi.python.org/pypi/nose/) >= 1.1.2 (for tests) + +## Sample usage + import htpasswd + + with htpasswd.Basic("/path/to/user.db") as userdb: + try: + userdb.add("bob", "password") + except htpasswd.basic.UserExists, e: + print e + try: + userdb.change_password("alice", "newpassword") + except htpasswd.basic.UserNotExists, e: + print e + + with htpasswd.Group("/path/to/group.db") as groupdb: + try: + groupdb.add_user("bob", "admins") + except htpasswd.group.UserAlreadyInAGroup, e: + print e + try: + groupdb.delete_user("alice", "managers") + except htpasswd.group.UserNotInAGroup, e: + print e + +To use MD5 encryotion, add ``mode="md5"`` to the constructor: + + with htpasswd.Basic("/path/to/user.db", mode="md5") as userdb + +## Provided methods + +### Basic +- ``__contains__(user)`` +- ``users`` +- ``add(user, password)`` +- ``pop(user)`` +- ``change_password(user, password)`` +- ``_encrypt_password(password)`` + +### Group +- ``__contains__(group)`` +- ``groups`` +- ``is_user_in(user, group)`` +- ``add_user(user, group)`` +- ``delete_user(user, group)`` + +## Exceptions + +### UserExists +Raised by ``Basic.add`` if user already exists. + +### UserNotExists +Raised by ``Basic.delete`` and ``Basic.change_password`` if there is no such user. + +### GroupNotExists +Raised by ``Group.delete_user`` if there is no such group. + +### UserAlreadyInAGroup +Raised by ``Group.add_user`` if user is already in a group. + +### UserNotInAGroup +Raised by ``Group.delete_user`` if user isn't in a group. + +### UnknownEncryptionMode +Raised by _encrypt_password if mode is not 'crypt' or 'md5'. + + +%package -n python3-htpasswd +Summary: Library to work with htpasswd user (basic authorization) and group files. +Provides: python-htpasswd +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-htpasswd +# htpasswd [](http://travis-ci.org/thesharp/htpasswd) + +## Description +**htpasswd** is a library for working with htpasswd user (only basic authorization) and group files. It supports CRYPT and MD5 encryption methods. To actually use MD5 encryption method you *MUST* have an ``openssl`` binary installed into system ``$PATH``. + +## Dependencies +- Python 2.7 or 3.3 or 3.4 +- [orderedmultidict](http://pypi.python.org/pypi/orderedmultidict/0.7) >= 0.7 +- [future](https://pypi.python.org/pypi/future) +- [nose](http://pypi.python.org/pypi/nose/) >= 1.1.2 (for tests) + +## Sample usage + import htpasswd + + with htpasswd.Basic("/path/to/user.db") as userdb: + try: + userdb.add("bob", "password") + except htpasswd.basic.UserExists, e: + print e + try: + userdb.change_password("alice", "newpassword") + except htpasswd.basic.UserNotExists, e: + print e + + with htpasswd.Group("/path/to/group.db") as groupdb: + try: + groupdb.add_user("bob", "admins") + except htpasswd.group.UserAlreadyInAGroup, e: + print e + try: + groupdb.delete_user("alice", "managers") + except htpasswd.group.UserNotInAGroup, e: + print e + +To use MD5 encryotion, add ``mode="md5"`` to the constructor: + + with htpasswd.Basic("/path/to/user.db", mode="md5") as userdb + +## Provided methods + +### Basic +- ``__contains__(user)`` +- ``users`` +- ``add(user, password)`` +- ``pop(user)`` +- ``change_password(user, password)`` +- ``_encrypt_password(password)`` + +### Group +- ``__contains__(group)`` +- ``groups`` +- ``is_user_in(user, group)`` +- ``add_user(user, group)`` +- ``delete_user(user, group)`` + +## Exceptions + +### UserExists +Raised by ``Basic.add`` if user already exists. + +### UserNotExists +Raised by ``Basic.delete`` and ``Basic.change_password`` if there is no such user. + +### GroupNotExists +Raised by ``Group.delete_user`` if there is no such group. + +### UserAlreadyInAGroup +Raised by ``Group.add_user`` if user is already in a group. + +### UserNotInAGroup +Raised by ``Group.delete_user`` if user isn't in a group. + +### UnknownEncryptionMode +Raised by _encrypt_password if mode is not 'crypt' or 'md5'. + + +%package help +Summary: Development documents and examples for htpasswd +Provides: python3-htpasswd-doc +%description help +# htpasswd [](http://travis-ci.org/thesharp/htpasswd) + +## Description +**htpasswd** is a library for working with htpasswd user (only basic authorization) and group files. It supports CRYPT and MD5 encryption methods. To actually use MD5 encryption method you *MUST* have an ``openssl`` binary installed into system ``$PATH``. + +## Dependencies +- Python 2.7 or 3.3 or 3.4 +- [orderedmultidict](http://pypi.python.org/pypi/orderedmultidict/0.7) >= 0.7 +- [future](https://pypi.python.org/pypi/future) +- [nose](http://pypi.python.org/pypi/nose/) >= 1.1.2 (for tests) + +## Sample usage + import htpasswd + + with htpasswd.Basic("/path/to/user.db") as userdb: + try: + userdb.add("bob", "password") + except htpasswd.basic.UserExists, e: + print e + try: + userdb.change_password("alice", "newpassword") + except htpasswd.basic.UserNotExists, e: + print e + + with htpasswd.Group("/path/to/group.db") as groupdb: + try: + groupdb.add_user("bob", "admins") + except htpasswd.group.UserAlreadyInAGroup, e: + print e + try: + groupdb.delete_user("alice", "managers") + except htpasswd.group.UserNotInAGroup, e: + print e + +To use MD5 encryotion, add ``mode="md5"`` to the constructor: + + with htpasswd.Basic("/path/to/user.db", mode="md5") as userdb + +## Provided methods + +### Basic +- ``__contains__(user)`` +- ``users`` +- ``add(user, password)`` +- ``pop(user)`` +- ``change_password(user, password)`` +- ``_encrypt_password(password)`` + +### Group +- ``__contains__(group)`` +- ``groups`` +- ``is_user_in(user, group)`` +- ``add_user(user, group)`` +- ``delete_user(user, group)`` + +## Exceptions + +### UserExists +Raised by ``Basic.add`` if user already exists. + +### UserNotExists +Raised by ``Basic.delete`` and ``Basic.change_password`` if there is no such user. + +### GroupNotExists +Raised by ``Group.delete_user`` if there is no such group. + +### UserAlreadyInAGroup +Raised by ``Group.add_user`` if user is already in a group. + +### UserNotInAGroup +Raised by ``Group.delete_user`` if user isn't in a group. + +### UnknownEncryptionMode +Raised by _encrypt_password if mode is not 'crypt' or 'md5'. + + +%prep +%autosetup -n htpasswd-2.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-htpasswd -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 2.3-1 +- Package Spec generated |
