public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-db/pgcli/files/, dev-db/pgcli/
@ 2020-12-16  8:29 Joonas Niilola
  0 siblings, 0 replies; 3+ messages in thread
From: Joonas Niilola @ 2020-12-16  8:29 UTC (permalink / raw
  To: gentoo-commits

commit:     78c1f7595563a40139ad9465822390f58f2950dd
Author:     Jakov Smolic <jakov.smolic <AT> sartura <DOT> hr>
AuthorDate: Thu Dec  3 11:46:14 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Wed Dec 16 08:29:15 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78c1f759

dev-db/pgcli: Support latest sqlparse

Closes: https://bugs.gentoo.org/754669
Package-Manager: Portage-3.0.9, Repoman-3.0.1
Signed-off-by: Jakov Smolic <jakov.smolic <AT> sartura.hr>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch      | 37 ++++++++++++++++++++++
 .../{pgcli-3.0.0.ebuild => pgcli-3.0.0-r1.ebuild}  | 27 +++++++---------
 2 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch b/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch
new file mode 100644
index 00000000000..4403a2e9c03
--- /dev/null
+++ b/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch
@@ -0,0 +1,37 @@
+Taken from: https://github.com/dbcli/pgcli/pull/1224
+Author: Kevin Marsh <kevinmarsh3@gmail.com>
+
+--- a/pgcli/packages/parseutils/ctes.py
++++ b/pgcli/packages/parseutils/ctes.py
+@@ -16,7 +16,7 @@
+ def isolate_query_ctes(full_text, text_before_cursor):
+     """Simplify a query by converting CTEs into table metadata objects"""
+ 
+-    if not full_text:
++    if not full_text or not full_text.strip():
+         return full_text, text_before_cursor, tuple()
+ 
+     ctes, remainder = extract_ctes(full_text)
+--- a/setup.py
++++ b/setup.py
+@@ -13,7 +13,7 @@
+     # see: https://github.com/dbcli/pgcli/pull/1197
+     "prompt_toolkit>=2.0.6,<4.0.0",
+     "psycopg2 >= 2.8",
+-    "sqlparse >=0.3.0,<0.4",
++    "sqlparse >=0.3.0,<0.5",
+     "configobj >= 5.0.6",
+     "pendulum>=2.1.0",
+     "cli_helpers[styles] >= 2.0.0",
+--- a/tests/test_sqlcompletion.py
++++ b/tests/test_sqlcompletion.py
+@@ -816,7 +816,7 @@ def test_create_db_with_template():
+     assert set(suggestions) == set((Database(),))
+ 
+ 
+-@pytest.mark.parametrize("initial_text", ("", "    ", "\t \t"))
++@pytest.mark.parametrize("initial_text", ("", "    ", "\t \t", "\n"))
+ def test_specials_included_for_initial_completion(initial_text):
+     suggestions = suggest_type(initial_text, initial_text)
+ 
+

diff --git a/dev-db/pgcli/pgcli-3.0.0.ebuild b/dev-db/pgcli/pgcli-3.0.0-r1.ebuild
similarity index 55%
rename from dev-db/pgcli/pgcli-3.0.0.ebuild
rename to dev-db/pgcli/pgcli-3.0.0-r1.ebuild
index b5da66f7a3d..a7cfb05f2c0 100644
--- a/dev-db/pgcli/pgcli-3.0.0.ebuild
+++ b/dev-db/pgcli/pgcli-3.0.0-r1.ebuild
@@ -16,26 +16,23 @@ SLOT="0"
 KEYWORDS="~amd64 x86"
 
 RDEPEND="
+	dev-python/click[${PYTHON_USEDEP}]
+	dev-python/cli_helpers[${PYTHON_USEDEP}]
+	dev-python/configobj[${PYTHON_USEDEP}]
+	dev-python/humanize[${PYTHON_USEDEP}]
+	dev-python/pgspecial[${PYTHON_USEDEP}]
 	>=dev-python/prompt_toolkit-3.0.0[${PYTHON_USEDEP}]
-	<dev-python/prompt_toolkit-4.0.0[${PYTHON_USEDEP}]
-	>=dev-python/psycopg-2.8.0[${PYTHON_USEDEP}]
-	>=dev-python/sqlparse-0.3.0[${PYTHON_USEDEP}]
-	<dev-python/sqlparse-0.4.0[${PYTHON_USEDEP}]
-	>=dev-python/cli_helpers-1.2.0[${PYTHON_USEDEP}]
-	>=dev-python/click-4.1[${PYTHON_USEDEP}]
-	>=dev-python/configobj-5.0.6[${PYTHON_USEDEP}]
-	>=dev-python/humanize-0.5.1[${PYTHON_USEDEP}]
-	>=dev-python/pgspecial-1.11.8[${PYTHON_USEDEP}]
-	>=dev-python/pygments-2.0[${PYTHON_USEDEP}]
-	>=dev-python/setproctitle-1.1.9[${PYTHON_USEDEP}]
-"
+	dev-python/psycopg[${PYTHON_USEDEP}]
+	dev-python/pygments[${PYTHON_USEDEP}]
+	dev-python/setproctitle[${PYTHON_USEDEP}]
+	dev-python/sqlparse[${PYTHON_USEDEP}]"
 DEPEND="${RDEPEND}"
-
 BDEPEND="
 	test? (
 		dev-db/postgresql
 		dev-python/mock[${PYTHON_USEDEP}]
-	)
-"
+	)"
+
+PATCHES=( "${FILESDIR}"/${P}-sqlparse.patch )
 
 distutils_enable_tests pytest


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

* [gentoo-commits] repo/gentoo:master commit in: dev-db/pgcli/files/, dev-db/pgcli/
@ 2021-02-18 18:57 David Seifert
  0 siblings, 0 replies; 3+ messages in thread
From: David Seifert @ 2021-02-18 18:57 UTC (permalink / raw
  To: gentoo-commits

commit:     cbdcaf3bbed131b764e0159730bdcd6bd24d2faf
Author:     Jakov Smolic <jakov.smolic <AT> sartura <DOT> hr>
AuthorDate: Thu Feb 18 18:55:21 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Thu Feb 18 18:55:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbdcaf3b

dev-db/pgcli: Remove old

Signed-off-by: Jakov Smolic <jakov.smolic <AT> sartura.hr>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 dev-db/pgcli/Manifest                         |  1 -
 dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch | 37 --------------------------
 dev-db/pgcli/pgcli-3.0.0-r1.ebuild            | 38 ---------------------------
 3 files changed, 76 deletions(-)

diff --git a/dev-db/pgcli/Manifest b/dev-db/pgcli/Manifest
index f22aac8bbf3..18f2a1baa60 100644
--- a/dev-db/pgcli/Manifest
+++ b/dev-db/pgcli/Manifest
@@ -1,2 +1 @@
-DIST pgcli-3.0.0.tar.gz 437733 BLAKE2B 5db69997f675812c3ef847b220b66e7872b134b4d8debd668154bdfa6020432ac08829e7c2ce42adc4cf124e84de5eb9aacbe19636216502f81373a71f21b68f SHA512 7ac52cbfc492dc85163dac7df7a5dde6bfa0327ac1ef6580891cb76d617b998d74c2a59b27d2f8abf8699eb5a69aba30bf13e95ad7bee75c83350730ac061262
 DIST pgcli-3.1.0.tar.gz 441939 BLAKE2B 2c9c9a3afb233eee6f88d304e26e482760f1ff2a458103a80ffb80d877f63bd3ec74ba4be06238e8d78adf36ec251cd27849e0899f3b257b75ac9585f3c04572 SHA512 458871bf7ea0a83a66f44ecbde88590ca2aa08420a58c97d2716d4e36c61738d92283d007fc3968063daa01c25b2c46360292ad6339757c119ff04891e1a1c46

diff --git a/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch b/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch
deleted file mode 100644
index 4403a2e9c03..00000000000
--- a/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Taken from: https://github.com/dbcli/pgcli/pull/1224
-Author: Kevin Marsh <kevinmarsh3@gmail.com>
-
---- a/pgcli/packages/parseutils/ctes.py
-+++ b/pgcli/packages/parseutils/ctes.py
-@@ -16,7 +16,7 @@
- def isolate_query_ctes(full_text, text_before_cursor):
-     """Simplify a query by converting CTEs into table metadata objects"""
- 
--    if not full_text:
-+    if not full_text or not full_text.strip():
-         return full_text, text_before_cursor, tuple()
- 
-     ctes, remainder = extract_ctes(full_text)
---- a/setup.py
-+++ b/setup.py
-@@ -13,7 +13,7 @@
-     # see: https://github.com/dbcli/pgcli/pull/1197
-     "prompt_toolkit>=2.0.6,<4.0.0",
-     "psycopg2 >= 2.8",
--    "sqlparse >=0.3.0,<0.4",
-+    "sqlparse >=0.3.0,<0.5",
-     "configobj >= 5.0.6",
-     "pendulum>=2.1.0",
-     "cli_helpers[styles] >= 2.0.0",
---- a/tests/test_sqlcompletion.py
-+++ b/tests/test_sqlcompletion.py
-@@ -816,7 +816,7 @@ def test_create_db_with_template():
-     assert set(suggestions) == set((Database(),))
- 
- 
--@pytest.mark.parametrize("initial_text", ("", "    ", "\t \t"))
-+@pytest.mark.parametrize("initial_text", ("", "    ", "\t \t", "\n"))
- def test_specials_included_for_initial_completion(initial_text):
-     suggestions = suggest_type(initial_text, initial_text)
- 
-

diff --git a/dev-db/pgcli/pgcli-3.0.0-r1.ebuild b/dev-db/pgcli/pgcli-3.0.0-r1.ebuild
deleted file mode 100644
index dfbd3a9b475..00000000000
--- a/dev-db/pgcli/pgcli-3.0.0-r1.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DISTUTILS_USE_SETUPTOOLS=rdepend
-PYTHON_COMPAT=( python3_{7..9} )
-inherit distutils-r1
-
-DESCRIPTION="CLI for Postgres with auto-completion and syntax highlighting"
-HOMEPAGE="https://www.pgcli.com https://github.com/dbcli/pgcli"
-SRC_URI="https://github.com/dbcli/pgcli/archive/v${PV}.tar.gz -> ${P}.tar.gz"
-
-LICENSE="BSD MIT"
-SLOT="0"
-KEYWORDS="amd64 x86"
-
-RDEPEND="
-	dev-python/click[${PYTHON_USEDEP}]
-	dev-python/cli_helpers[${PYTHON_USEDEP}]
-	dev-python/configobj[${PYTHON_USEDEP}]
-	dev-python/humanize[${PYTHON_USEDEP}]
-	dev-python/pgspecial[${PYTHON_USEDEP}]
-	>=dev-python/prompt_toolkit-3.0.0[${PYTHON_USEDEP}]
-	dev-python/psycopg[${PYTHON_USEDEP}]
-	dev-python/pygments[${PYTHON_USEDEP}]
-	dev-python/setproctitle[${PYTHON_USEDEP}]
-	dev-python/sqlparse[${PYTHON_USEDEP}]"
-DEPEND="${RDEPEND}"
-BDEPEND="
-	test? (
-		dev-db/postgresql
-		dev-python/mock[${PYTHON_USEDEP}]
-	)"
-
-PATCHES=( "${FILESDIR}"/${P}-sqlparse.patch )
-
-distutils_enable_tests pytest


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

* [gentoo-commits] repo/gentoo:master commit in: dev-db/pgcli/files/, dev-db/pgcli/
@ 2024-02-20 12:23 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2024-02-20 12:23 UTC (permalink / raw
  To: gentoo-commits

commit:     34109a72d19f799791d16bbfac2c643c82c36a0d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 20 12:20:42 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Feb 20 12:23:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34109a72

dev-db/pgcli: Backport dev-python/pendulum removal

Bug: https://bugs.gentoo.org/924881
Pull-Request: https://github.com/dbcli/pgcli/pull/1452
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-db/pgcli/files/pgcli-4.0.1-no-pendulum.patch | 112 +++++++++++++++++++++++
 dev-db/pgcli/pgcli-4.0.1-r1.ebuild               |   6 +-
 2 files changed, 117 insertions(+), 1 deletion(-)

diff --git a/dev-db/pgcli/files/pgcli-4.0.1-no-pendulum.patch b/dev-db/pgcli/files/pgcli-4.0.1-no-pendulum.patch
new file mode 100644
index 000000000000..b761f1c13634
--- /dev/null
+++ b/dev-db/pgcli/files/pgcli-4.0.1-no-pendulum.patch
@@ -0,0 +1,112 @@
+From da189aaa1852170cb852a7a435a20d8246e59c30 Mon Sep 17 00:00:00 2001
+From: Damien Baty <damien@damienbaty.com>
+Date: Mon, 19 Feb 2024 09:36:46 +0100
+Subject: [PATCH] feat: Replace pendulum by home-made duration-to-words
+ function
+
+diff --git a/pgcli/main.py b/pgcli/main.py
+index bbb1989d..cfa1c970 100644
+--- a/pgcli/main.py
++++ b/pgcli/main.py
+@@ -11,7 +11,6 @@
+ import threading
+ import shutil
+ import functools
+-import pendulum
+ import datetime as dt
+ import itertools
+ import platform
+@@ -800,9 +799,9 @@ def execute_command(self, text, handle_closed_connection=True):
+                         "Time: %0.03fs (%s), executed in: %0.03fs (%s)"
+                         % (
+                             query.total_time,
+-                            pendulum.Duration(seconds=query.total_time).in_words(),
++                            duration_in_words(query.total_time),
+                             query.execution_time,
+-                            pendulum.Duration(seconds=query.execution_time).in_words(),
++                            duration_in_words(query.execution_time),
+                         )
+                     )
+                 else:
+@@ -1735,5 +1734,28 @@ def parse_service_info(service):
+     return service_conf, service_file
+ 
+ 
++def duration_in_words(duration_in_seconds: float) -> str:
++    if not duration_in_seconds:
++        return "0 seconds"
++    components = []
++    hours, remainder = divmod(duration_in_seconds, 3600)
++    if hours > 1:
++        components.append(f"{hours} hours")
++    elif hours == 1:
++        components.append("1 hour")
++    minutes, seconds = divmod(remainder, 60)
++    if minutes > 1:
++        components.append(f"{minutes} minutes")
++    elif minutes == 1:
++        components.append("1 minute")
++    if seconds >= 2:
++        components.append(f"{int(seconds)} seconds")
++    elif seconds >= 1:
++        components.append("1 second")
++    elif seconds:
++        components.append(f"{round(seconds, 3)} second")
++    return " ".join(components)
++
++
+ if __name__ == "__main__":
+     cli()
+diff --git a/setup.py b/setup.py
+index f9dbc56a..640dca00 100644
+--- a/setup.py
++++ b/setup.py
+@@ -16,7 +16,6 @@
+     "psycopg-binary >= 3.0.14; sys_platform == 'win32'",
+     "sqlparse >=0.3.0,<0.5",
+     "configobj >= 5.0.6",
+-    "pendulum>=2.1.0",
+     "cli_helpers[styles] >= 2.2.1",
+ ]
+ 
+diff --git a/tests/test_main.py b/tests/test_main.py
+index cbf20a6a..0aeba80e 100644
+--- a/tests/test_main.py
++++ b/tests/test_main.py
+@@ -11,6 +11,7 @@
+ 
+ from pgcli.main import (
+     obfuscate_process_password,
++    duration_in_words,
+     format_output,
+     PGCli,
+     OutputSettings,
+@@ -488,3 +489,28 @@ def test_application_name_db_uri(tmpdir):
+     mock_pgexecute.assert_called_with(
+         "bar", "bar", "", "baz.com", "", "", application_name="cow"
+     )
++
++
++@pytest.mark.parametrize(
++    "duration_in_seconds,words",
++    [
++        (0, "0 seconds"),
++        (0.0009, "0.001 second"),
++        (0.0005, "0.001 second"),
++        (0.0004, "0.0 second"),  # not perfect, but will do
++        (0.2, "0.2 second"),
++        (1, "1 second"),
++        (1.4, "1 second"),
++        (2, "2 seconds"),
++        (3.4, "3 seconds"),
++        (60, "1 minute"),
++        (61, "1 minute 1 second"),
++        (123, "2 minutes 3 seconds"),
++        (3600, "1 hour"),
++        (7235, "2 hours 35 seconds"),
++        (9005, "2 hours 30 minutes 5 seconds"),
++        (86401, "24 hours 1 second"),
++    ],
++)
++def test_duration_in_words(duration_in_seconds, words):
++    assert duration_in_words(duration_in_seconds) == words

diff --git a/dev-db/pgcli/pgcli-4.0.1-r1.ebuild b/dev-db/pgcli/pgcli-4.0.1-r1.ebuild
index 510cad08ad1e..d168855385f8 100644
--- a/dev-db/pgcli/pgcli-4.0.1-r1.ebuild
+++ b/dev-db/pgcli/pgcli-4.0.1-r1.ebuild
@@ -19,7 +19,6 @@ RDEPEND="
 	dev-python/click[${PYTHON_USEDEP}]
 	>=dev-python/cli-helpers-2.2.1[${PYTHON_USEDEP}]
 	dev-python/configobj[${PYTHON_USEDEP}]
-	dev-python/pendulum[${PYTHON_USEDEP}]
 	dev-python/pgspecial[${PYTHON_USEDEP}]
 	dev-python/prompt-toolkit[${PYTHON_USEDEP}]
 	dev-python/psycopg:0[${PYTHON_USEDEP}]
@@ -37,6 +36,11 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+	# https://github.com/dbcli/pgcli/pull/1452
+	"${FILESDIR}/${P}-no-pendulum.patch"
+)
+
 python_test() {
 	local EPYTEST_DESELECT=(
 		# hang while trying to create a keyring


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

end of thread, other threads:[~2024-02-20 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 12:23 [gentoo-commits] repo/gentoo:master commit in: dev-db/pgcli/files/, dev-db/pgcli/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2021-02-18 18:57 David Seifert
2020-12-16  8:29 Joonas Niilola

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