public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/passlib/files/, dev-python/passlib/
@ 2019-12-04  1:15 Patrick McLean
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McLean @ 2019-12-04  1:15 UTC (permalink / raw
  To: gentoo-commits

commit:     1b2f1f9f2f025dc9f616733647e14580d9bfd2ab
Author:     Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Tue Dec  3 22:44:14 2019 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Wed Dec  4 01:11:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b2f1f9f

dev-python/passlib-1.7.2: Verbump, add pypy3, distutils helpers

Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.80, Repoman-2.3.19
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 dev-python/passlib/Manifest                        |  1 +
 dev-python/passlib/files/passlib-1.7.2-pypy3.patch | 65 ++++++++++++++++++++++
 dev-python/passlib/passlib-1.7.2.ebuild            | 33 +++++++++++
 3 files changed, 99 insertions(+)

diff --git a/dev-python/passlib/Manifest b/dev-python/passlib/Manifest
index 9fcb6b2ef94..2dc05f8ad0f 100644
--- a/dev-python/passlib/Manifest
+++ b/dev-python/passlib/Manifest
@@ -1 +1,2 @@
 DIST passlib-1.7.1.tar.gz 645724 BLAKE2B f34e3bbc5a61ff71cc989fa26edb9f992909bfdcc6ca1b094ebc02fc9942eb1db1ea18fc3dd5bb7d9fcecf6b4bd82e93aba07c7ce63ec85452b5d7117a6e1968 SHA512 3d5f069cd4e44e5e87cdabc46845acbdd6c1eeedb7ce1f611aebee87b0f7af19009b6a47a10ec555fd84260b9f5c933c6429e325d30326de3869f05031674168
+DIST passlib-1.7.2.tar.gz 649654 BLAKE2B 40279113d9ff633cea47222f2d72af0abee78dc52a9b46adf66aaae213594eaae7f245cc80004f85b5055b882741b4bedfd81ee39132db23760d37a34e87ac6a SHA512 1ea0654b177b5ab2e1a7e5c3949642c34805ace6e4e4a0f82fafdb3f374edd99c667906ce598c335b668da049860648d5cbebb3e62d775898d5b0cb8cfc7bf53

diff --git a/dev-python/passlib/files/passlib-1.7.2-pypy3.patch b/dev-python/passlib/files/passlib-1.7.2-pypy3.patch
new file mode 100644
index 00000000000..304388196b2
--- /dev/null
+++ b/dev-python/passlib/files/passlib-1.7.2-pypy3.patch
@@ -0,0 +1,65 @@
+diff -ur a/passlib/utils/__init__.py b/passlib/utils/__init__.py
+--- a/passlib/utils/__init__.py	2019-11-19 11:41:26.000000000 -0800
++++ b/passlib/utils/__init__.py	2019-12-03 14:16:15.153791186 -0800
+@@ -57,7 +57,7 @@
+ )
+ from passlib.exc import ExpectedStringError
+ from passlib.utils.compat import (add_doc, join_bytes, join_byte_values,
+-                                  join_byte_elems, irange, imap, PY3, u,
++                                  join_byte_elems, irange, imap, PY3, PYPY, u,
+                                   join_unicode, unicode, byte_elem_value, nextgetter,
+                                   unicode_or_bytes_types,
+                                   get_method_function, suppress_cause)
+@@ -776,23 +776,41 @@
+
+     if PY3:
+         def safe_crypt(secret, hash):
+-            if isinstance(secret, bytes):
+-                # Python 3's crypt() only accepts unicode, which is then
+-                # encoding using utf-8 before passing to the C-level crypt().
+-                # so we have to decode the secret.
+-                orig = secret
++            if not PYPY:
++                if isinstance(secret, bytes):
++                    # Python 3's crypt() only accepts unicode, which is then
++                    # encoding using utf-8 before passing to the C-level crypt().
++                    # so we have to decode the secret.
++                    orig = secret
++                    try:
++                        secret = secret.decode("utf-8")
++                    except UnicodeDecodeError:
++                        return None
++                    assert secret.encode("utf-8") == orig, \
++                                "utf-8 spec says this can't happen!"
++                if _NULL in secret:
++                    raise ValueError("null character in secret")
++            else:
++                if isinstance(secret, str):
++                    orig = secret
++                    try:
++                        secret = secret.encode("utf-8")
++                    except UnicodeEncodeError:
++                        return None
++                    assert secret.decode("utf-8") == orig, \
++                                "utf-8 spec says this can't happen!"
+                 try:
+-                    secret = secret.decode("utf-8")
++                    if _NULL in secret.decode("utf-8"):
++                        raise ValueError("null character in secret")
+                 except UnicodeDecodeError:
+                     return None
+-                assert secret.encode("utf-8") == orig, \
+-                            "utf-8 spec says this can't happen!"
+-            if _NULL in secret:
+-                raise ValueError("null character in secret")
++
+             if isinstance(hash, bytes):
+                 hash = hash.decode("ascii")
+             result = _crypt(secret, hash)
+-            if not result or result[0] in _invalid_prefixes:
++            if PYPY and isinstance(result, bytes):
++                result = result.decode("utf-8")
++            if not result or result[0:1] in _invalid_prefixes:
+                 return None
+             return result
+     else:

diff --git a/dev-python/passlib/passlib-1.7.2.ebuild b/dev-python/passlib/passlib-1.7.2.ebuild
new file mode 100644
index 00000000000..90238f18517
--- /dev/null
+++ b/dev-python/passlib/passlib-1.7.2.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python{2_7,3_{5,6,7,8}} pypy{,3} )
+
+inherit distutils-r1
+
+DESCRIPTION="Password hashing framework supporting over 20 schemes"
+HOMEPAGE="https://bitbucket.org/ecollins/passlib/wiki/Home/"
+SRC_URI="mirror://pypi/p/${PN}/${P}.tar.gz"
+
+LICENSE="BSD-2"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+SLOT="0"
+IUSE="+bcrypt doc +scrypt +totp"
+
+RDEPEND="bcrypt? ( dev-python/bcrypt[${PYTHON_USEDEP}] )
+	totp? ( dev-python/cryptography[${PYTHON_USEDEP}] )
+	scrypt? ( dev-python/scrypt[${PYTHON_USEDEP}] )"
+DEPEND="${RDEPEND}
+	dev-python/setuptools[${PYTHON_USEDEP}]"
+
+PATCHES=(
+	"${FILESDIR}/passlib-1.7.2-pypy3.patch"
+)
+
+distutils_enable_tests nose
+
+python_install_all() {
+	distutils-r1_python_install_all
+	use doc && dodoc docs/{*.rst,requirements.txt,lib/*.rst}
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/passlib/files/, dev-python/passlib/
@ 2024-04-25 12:52 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-04-25 12:52 UTC (permalink / raw
  To: gentoo-commits

commit:     c1e015b65b74283a51893672739c5e4784b95273
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 25 12:30:53 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Apr 25 12:51:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1e015b6

dev-python/passlib: Fix warning with dev-python/bcrypt-4.1.1

Fix a warning due to `dev-python/bcrypt` removing `bcrypt.__about__`.
Apparently this breaks random packages.

Closes: https://bugs.gentoo.org/925289
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/passlib/files/passlib-1.7.4-bcrypt-4.1.patch     | 13 +++++++++++++
 .../{passlib-1.7.4-r2.ebuild => passlib-1.7.4-r3.ebuild}    | 10 +++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/dev-python/passlib/files/passlib-1.7.4-bcrypt-4.1.patch b/dev-python/passlib/files/passlib-1.7.4-bcrypt-4.1.patch
new file mode 100644
index 000000000000..706ff73f3b5f
--- /dev/null
+++ b/dev-python/passlib/files/passlib-1.7.4-bcrypt-4.1.patch
@@ -0,0 +1,13 @@
+diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py
+index b83b110..42dd019 100644
+--- a/passlib/handlers/bcrypt.py
++++ b/passlib/handlers/bcrypt.py
+@@ -617,7 +617,7 @@ class _BcryptBackend(_BcryptCommon):
+         except ImportError: # pragma: no cover
+             return False
+         try:
+-            version = _bcrypt.__about__.__version__
++            version = _bcrypt.__version__
+         except:
+             log.warning("(trapped) error reading bcrypt version", exc_info=True)
+             version = '<unknown>'

diff --git a/dev-python/passlib/passlib-1.7.4-r2.ebuild b/dev-python/passlib/passlib-1.7.4-r3.ebuild
similarity index 82%
rename from dev-python/passlib/passlib-1.7.4-r2.ebuild
rename to dev-python/passlib/passlib-1.7.4-r3.ebuild
index 708ef7f23b53..51d6fda8f495 100644
--- a/dev-python/passlib/passlib-1.7.4-r2.ebuild
+++ b/dev-python/passlib/passlib-1.7.4-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -30,6 +30,14 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+src_prepare() {
+	# fix compatibility with >=dev-python/bcrypt-4.1
+	# https://foss.heptapod.net/python-libs/passlib/-/issues/190
+	sed -i -e '/bcrypt/s:__about__\.::' passlib/handlers/bcrypt.py || die
+
+	distutils-r1_src_prepare
+}
+
 python_test() {
 	local EPYTEST_DESELECT=(
 		# broken all the time by new django releases


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-25 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-04  1:15 [gentoo-commits] repo/gentoo:master commit in: dev-python/passlib/files/, dev-python/passlib/ Patrick McLean
  -- strict thread matches above, loose matches on Subject: below --
2024-04-25 12:52 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox