Skip to content

Commit

Permalink
dev-db/pgcli: Support latest sqlparse
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/754669
Package-Manager: Portage-3.0.9, Repoman-3.0.1
Signed-off-by: Jakov Smolic <[email protected]>
Signed-off-by: Joonas Niilola <[email protected]>
  • Loading branch information
Jakov Smolic authored and juippis committed Dec 16, 2020
1 parent 1f47a2c commit 78c1f75
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 15 deletions.
37 changes: 37 additions & 0 deletions dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Taken from: https://github.com/dbcli/pgcli/pull/1224
Author: Kevin Marsh <[email protected]>

--- 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)


Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 78c1f75

Please sign in to comment.