forked from pool/python-sqlglot
- Add missing-duckdb.patch until we package duckdb as well.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sqlglot?expand=0&rev=3
This commit is contained in:
50
missing-duckdb.patch
Normal file
50
missing-duckdb.patch
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
tests/test_executor.py | 7 ++++++-
|
||||||
|
tests/test_optimizer.py | 7 ++++++-
|
||||||
|
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/tests/test_executor.py
|
||||||
|
+++ b/tests/test_executor.py
|
||||||
|
@@ -1,6 +1,10 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
-import duckdb
|
||||||
|
+try:
|
||||||
|
+ import duckdb
|
||||||
|
+ DUCKDB_AVAILABLE = True
|
||||||
|
+except ImportError:
|
||||||
|
+ DUCKDB_AVAILABLE = False
|
||||||
|
import pandas as pd
|
||||||
|
from pandas.testing import assert_frame_equal
|
||||||
|
|
||||||
|
@@ -12,6 +16,7 @@ from tests.helpers import FIXTURES_DIR,
|
||||||
|
DIR = FIXTURES_DIR + "/optimizer/tpc-h/"
|
||||||
|
|
||||||
|
|
||||||
|
+@unittest.skipUnless(DUCKDB_AVAILABLE, "Cannot work without duckdb.")
|
||||||
|
class TestExecutor(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
--- a/tests/test_optimizer.py
|
||||||
|
+++ b/tests/test_optimizer.py
|
||||||
|
@@ -1,7 +1,11 @@
|
||||||
|
import unittest
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
-import duckdb
|
||||||
|
+try:
|
||||||
|
+ import duckdb
|
||||||
|
+ DUCKDB_AVAILABLE = True
|
||||||
|
+except ImportError:
|
||||||
|
+ DUCKDB_AVAILABLE = False
|
||||||
|
from pandas.testing import assert_frame_equal
|
||||||
|
|
||||||
|
import sqlglot
|
||||||
|
@@ -18,6 +22,7 @@ from tests.helpers import (
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
+@unittest.skipUnless(DUCKDB_AVAILABLE, "Cannot work without duckdb.")
|
||||||
|
class TestOptimizer(unittest.TestCase):
|
||||||
|
maxDiff = None
|
||||||
|
|
@@ -1,6 +1,7 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Oct 13 09:43:59 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
Thu Oct 13 10:03:56 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Add missing-duckdb.patch until we package duckdb as well.
|
||||||
- Clean up SPEC file.
|
- Clean up SPEC file.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define modname sqlglot
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
Name: python-sqlglot
|
Name: python-sqlglot
|
||||||
Version: 7.0.0
|
Version: 7.0.0
|
||||||
@@ -23,10 +24,17 @@ Release: 0
|
|||||||
Summary: An easily customizable SQL parser and transpiler
|
Summary: An easily customizable SQL parser and transpiler
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/tobymao/sqlglot
|
URL: https://github.com/tobymao/sqlglot
|
||||||
Source: https://files.pythonhosted.org/packages/source/s/sqlglot/sqlglot-%{version}.tar.gz
|
Source: https://github.com/tobymao/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
|
||||||
BuildRequires: %{python_module setuptools}
|
# PATCH-FIX-OPENSUSE missing-duckdb.patch mcepl@suse.com
|
||||||
|
# Skip over duckdb requiring tests until it is packaged
|
||||||
|
Patch0: missing-duckdb.patch
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
# FOR TESTS
|
||||||
|
BuildRequires: %{python_module pandas}
|
||||||
|
# END FOR TESTS
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@@ -43,15 +51,18 @@ Syntax errors are highlighted and dialect incompatibilities can warn or raise
|
|||||||
depending on configurations.
|
depending on configurations.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n sqlglot-%{version}
|
%autosetup -p1 -n sqlglot-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
|
%check
|
||||||
|
%pyunittest discover -v
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%doc README.md
|
%doc README.md
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:09bd4055f2cdfe1e8e3ac3e16f46ccd555f7beb2742092bb70f5c702ab0c1718
|
oid sha256:a56f5e380bb3a29ef6fe70b7c8bcda04135df78b4574d8fd8ba264c358539637
|
||||||
size 112825
|
size 3548763
|
||||||
|
Reference in New Issue
Block a user