diff --git a/lang/python/python-sqlparse/Makefile b/lang/python/python-sqlparse/Makefile index d7f37b8812..cd6bb988c2 100644 --- a/lang/python/python-sqlparse/Makefile +++ b/lang/python/python-sqlparse/Makefile @@ -1,18 +1,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sqlparse -PKG_VERSION:=0.4.4 +PKG_VERSION:=0.5.5 PKG_RELEASE:=1 PYPI_NAME:=sqlparse -PKG_HASH:=d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c +PKG_HASH:=e20d4a9b0b8585fdf63b10d30066c7c94c5d7a7ec47c889a2d83a3caa93ff28e PKG_MAINTAINER:=Peter Stadler PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:sqlparse_project:sqlparse -PKG_BUILD_DEPENDS:=python-flit-core/host +PKG_BUILD_DEPENDS:=python-hatchling/host include ../pypi.mk include $(INCLUDE_DIR)/package.mk diff --git a/lang/python/python-sqlparse/test.sh b/lang/python/python-sqlparse/test.sh new file mode 100755 index 0000000000..9d2c868ccf --- /dev/null +++ b/lang/python/python-sqlparse/test.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +[ "$1" = "python3-sqlparse" ] || exit 0 + +python3 - << EOF +import sys +import sqlparse + +if sqlparse.__version__ != "$2": + print("Wrong version: " + sqlparse.__version__) + sys.exit(1) + +# Format: uppercase keywords +formatted = sqlparse.format("select id, name from users where id=1", keyword_case="upper") +assert "SELECT" in formatted +assert "FROM" in formatted +assert "WHERE" in formatted + +# Split multiple statements +stmts = sqlparse.split("SELECT 1; SELECT 2; SELECT 3") +assert len(stmts) == 3 + +# Parse: token inspection +parsed = sqlparse.parse("SELECT a, b FROM t")[0] +assert parsed.get_type() == "SELECT" + +# Format with indentation +sql = "select a,b from t where x=1 and y=2" +out = sqlparse.format(sql, reindent=True, keyword_case="upper") +assert "SELECT" in out +assert "WHERE" in out + +sys.exit(0) +EOF