%define scl rh-python36 %{?scl:%scl_package %{name}} %{!?scl:%global pkg_name %{name}} %define name sqlparse %define version 0.3.0 %define unmangled_version 0.3.0 %define unmangled_version 0.3.0 %define release 1 Summary: Non-validating SQL parser %{?scl:Requires: %{scl}-runtime} %{?scl:BuildRequires: %{scl}-runtime} Name: %{?scl_prefix}sqlparse Version: %{version} Release: %{release} Source0: sqlparse-%{unmangled_version}.tar.gz License: BSD Group: Development/Libraries BuildRoot: %{_tmppath}/sqlparse-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Vendor: Andi Albrecht Packager: Martin Juhl Url: https://github.com/andialbrecht/sqlparse %description ``sqlparse`` is a non-validating SQL parser module. It provides support for parsing, splitting and formatting SQL statements. Visit the `project page `_ for additional information and documentation. **Example Usage** Splitting SQL statements:: >>> import sqlparse >>> sqlparse.split('select * from foo; select * from bar;') [u'select * from foo; ', u'select * from bar;'] Formatting statements:: >>> sql = 'select * from foo where id in (select id from bar);' >>> print sqlparse.format(sql, reindent=True, keyword_case='upper') SELECT * FROM foo WHERE id IN (SELECT id FROM bar); Parsing:: >>> sql = 'select * from someschema.mytable where id = 1' >>> res = sqlparse.parse(sql) >>> res (,) >>> stmt = res[0] >>> str(stmt) # converting it back to unicode 'select * from someschema.mytable where id = 1' >>> # This is how the internal representation looks like: >>> stmt.tokens (, , , , , , , , ) %prep %{?scl:scl enable %{scl} - << \EOF} set -ex %setup -n sqlparse-%{unmangled_version} -n sqlparse-%{unmangled_version} %{?scl:EOF} %build %{?scl:scl enable %{scl} - << \EOF} set -ex python3 setup.py build %{?scl:EOF} %install %{?scl:scl enable %{scl} - << \EOF} set -ex python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES %{?scl:EOF} %clean %{?scl:scl enable %{scl} - << \EOF} set -ex rm -rf $RPM_BUILD_ROOT %{?scl:EOF} %files -f INSTALLED_FILES %defattr(-,root,root)