diff --git a/dev-python/stripe/Manifest b/dev-python/stripe/Manifest index 5a09c37151ee8..7a6bb94ca14c1 100644 --- a/dev-python/stripe/Manifest +++ b/dev-python/stripe/Manifest @@ -1,4 +1,8 @@ DIST stripe-15.6.1.tar.gz 1569005 BLAKE2B fd6fd2143291040140eb0172cbc6b04a0ddfc5fa8536d537e074f994d51f00ec8f323eef6361f3d385f9b93a0b7405f3046ed51c5e4f09467e0e7d4c10f79984 SHA512 f46566430302ac8fff22121ee560253a68d909f1fb0d3c27adad4c5f07b9c1d201bf64413ada517748b518c65d5c62a5f158e208370aade1b073634ac6e8b826 DIST stripe-15.6.1.tar.gz.provenance 9757 BLAKE2B 94e375fa32980d5462775d78e7b386e7409e65182d627c5242c78fd4b87461ffc8187a94e7ec8ced22eb7f4cba2ed6748b9f49b45dc49d4b584c654ef4479721 SHA512 4e1f1623c50897edc33fef0f89801f30f18eb89b874446620a3a620977257cf8a25938023038d15dd210ba09daadca59778454bcde3fc419a870371fb1bb1cc3 +DIST stripe-15.6.2.tar.gz 1448958 BLAKE2B 2755be6f084b64be6e4e091e1e14fa7da03c97c0aca809268f9cc02795bca1f1f8975cadb76b38951ac88d9a455cce42b8ec6dc6ba65087268a5298a0254342d SHA512 8fa5b10c94b9b505033b61439f0349115a24e6156351f84c2e18fab64ea662cbeeaef6ec63a0811a931b8ca5698116b76975e9ea44bbc173b63dc196f8840e83 +DIST stripe-15.6.2.tar.gz.provenance 9739 BLAKE2B d891c1dbe5c1034d2d1bdb38d470af7159798ef394f31836a8a6c63d61491c53b88747ab43506ec185a0e7b4e917e44cc01a18fb32782d57e84ff92e96dc7b50 SHA512 697f06714f64d47e06610e23c3ab82b3b39b79da5fab1eb559f82b8d8bf80fa3dec22b22b795e63d908d82c0fc52fc1757f3ab5e6e5f92ff2150508701b78a7f DIST stripe-16.0.0.tar.gz 1665584 BLAKE2B 6a41f06fc8187e5ae23687dc50a509f7ffd23041869ed66e33ce32143fb6e6778f859e7cdd2d2db175ebfd2a76daba5e279b7a265fbfa873b18efb44b65c5a55 SHA512 c6261f3b04b9a7ce86c2d02526626f4ce8a808ce7f6ad3830c6a737f0a872bfb1e14ca8ed603f09d0840526e624fbfbef57fd5672c66e9c3fc3cba56410a374c DIST stripe-16.0.0.tar.gz.provenance 9769 BLAKE2B eeaab3bc0f207641b9a11c32345a76f7ce2115011e53eda5389d0fa5a233a73d2caffcd159822e4a51d37aa3f0454500937af1d557c31eadc8bd94f9eb4a0edf SHA512 be63e4c682e6b30648cd3e762583d16d330380db2632a1ad49d9d356967ce161f5d47b8efa915c52c90925f6ddb59c4553ddb0374453398c657ab9ec66dd992f +DIST stripe-16.0.1.tar.gz 1544782 BLAKE2B 3fd546819f632487fddcca5b5e7610602a0cd12383ca3164313a5893c3092a76e1ce92977e0cf2eaeefaa88ba67f5d42e013e9915628fa22b473ec45c2c5ffc5 SHA512 045ff20af9f80aede3e3b2d120b77737897a167ff4bfc1f7a70e83dde50d6df8d4d410e395fe93df542470083b5198e799fe20a84b3d1f7c81cffb6e5149f579 +DIST stripe-16.0.1.tar.gz.provenance 9598 BLAKE2B f5363f7cf4b336c46c4f89a24eb3164fee4f83cb55aebe014d9bccc779aad33dd0c547f802fe13699f0fc070ba860dffa129ee5bf6f6ceb149e54f53d3d73cd5 SHA512 ca9455f13a46bf147908bbc1449a4123052317952881e01c5ba317dffff0148a589c85676684a9f136f1416bbd6b419774a88c66105b89043ac2ae7cf008ba11 diff --git a/dev-python/stripe/files/stripe-16.0.1-certifi.patch b/dev-python/stripe/files/stripe-16.0.1-certifi.patch new file mode 100644 index 0000000000000..6cf161a88c085 --- /dev/null +++ b/dev-python/stripe/files/stripe-16.0.1-certifi.patch @@ -0,0 +1,31 @@ +diff --git a/stripe/__init__.py b/stripe/__init__.py +index b1e4ffa..2796a15 100644 +--- a/stripe/__init__.py ++++ b/stripe/__init__.py +@@ -37,9 +37,8 @@ default_http_client: Optional["HTTPClient"] = None + app_info: Optional[AppInfo] = None + enable_telemetry: bool = True + max_network_retries: int = 2 +-ca_bundle_path: str = os.path.join( +- os.path.dirname(__file__), "data", "ca-certificates.crt" +-) ++import certifi ++ca_bundle_path: str = certifi.where() + + # Lazily initialized stripe.default_http_client + default_http_client = None +diff --git a/tests/test_http_client.py b/tests/test_http_client.py +index 8b3ab71..33bda97 100644 +--- a/tests/test_http_client.py ++++ b/tests/test_http_client.py +@@ -601,8 +601,9 @@ class RequestsVerify(object): + def __eq__(self, other): + if not other: + return False + normalized = other.replace("\\", "/") +- return normalized.endswith("stripe/data/ca-certificates.crt") ++ import certifi ++ return normalized == certifi.where() + + + class TestRequestsClient(ClientTestBase): diff --git a/dev-python/stripe/stripe-16.0.1.ebuild b/dev-python/stripe/stripe-16.0.1.ebuild new file mode 100644 index 0000000000000..efd7e2d4521d0 --- /dev/null +++ b/dev-python/stripe/stripe-16.0.1.ebuild @@ -0,0 +1,101 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=flit-core +PYPI_VERIFY_REPO=https://github.com/stripe/stripe-python +PYTHON_COMPAT=( python3_{12..15} ) + +inherit distutils-r1 pypi + +DESCRIPTION="Stripe Python bindings" +HOMEPAGE=" + https://github.com/stripe/stripe-python/ + https://pypi.org/project/stripe/ +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="telemetry" + +RDEPEND=" + dev-python/certifi[${PYTHON_USEDEP}] + >=dev-python/requests-2.20[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.7.0[${PYTHON_USEDEP}] +" +# please bump dev-util/stripe-mock dep to the latest version on every bump +BDEPEND=" + test? ( + >=dev-util/stripe-mock-0.201.0 + dev-python/aiohttp[${PYTHON_USEDEP}] + dev-python/httpx[${PYTHON_USEDEP}] + dev-python/trio[${PYTHON_USEDEP}] + net-misc/curl + ) +" + +EPYTEST_PLUGINS=( anyio pytest-mock ) +EPYTEST_XDIST=1 +distutils_enable_tests pytest + +src_prepare() { + local PATCHES=( + # use system certs via certifi + "${FILESDIR}/${PN}-16.0.1-certifi.patch" + ) + + distutils-r1_src_prepare + + # remove bundled certificates + rm stripe/data/ca-certificates.crt || die + + if ! use telemetry; then + sed -i -e '/enable_telemetry/s:True:False:' stripe/__init__.py || die + fi +} + +python_test() { + local EPYTEST_DESELECT=( + # Internet + tests/test_http_client.py::TestLiveHTTPClients::test_httpx_request_async_https + 'tests/test_integration.py::TestIntegration::test_async_raw_request_timeout[asyncio-aiohttp]' + # timing + tests/test_integration.py::TestIntegration::test_passes_client_telemetry_when_enabled + ) + + epytest -o addopts= tests +} + +src_test() { + local stripe_mock_port=12111 + local stripe_mock_max_port=12121 + local stripe_mock_logfile="${T}/stripe_mock_${EPYTHON}.log" + # Try to start stripe-mock until we find a free port + while [[ ${stripe_mock_port} -le ${stripe_mock_max_port} ]]; do + ebegin "Trying to start stripe-mock on port ${stripe_mock_port}" + stripe-mock --http-port "${stripe_mock_port}" &> "${stripe_mock_logfile}" & + local stripe_mock_pid=${!} + sleep 2 + # Did stripe-mock start? + curl --fail -u "sk_test_123:" \ + "http://127.0.0.1:${stripe_mock_port}/v1/customers" &> /dev/null + eend ${?} "Port ${stripe_mock_port} unavailable" + if [[ ${?} -eq 0 ]]; then + einfo "stripe-mock running on port ${stripe_mock_port}" + break + fi + (( stripe_mock_port++ )) + done + if [[ ${stripe_mock_port} -gt ${stripe_mock_max_port} ]]; then + eerror "Unable to start stripe-mock for tests" + die "Please see the logfile located at: ${stripe_mock_logfile}" + fi + + local -x STRIPE_MOCK_PORT=${stripe_mock_port} + distutils-r1_src_test + + # Tear down stripe-mock + kill "${stripe_mock_pid}" || die "Unable to stop stripe-mock" +}