blob: f66889c1ac688b900a2e3ad77928846c72a21d58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
# Copyright 2023-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..13} )
CARGO_OPTIONAL=1
CRATES="
aho-corasick@1.1.3
anes@0.1.6
anstyle@1.0.10
autocfg@1.1.0
bumpalo@3.16.0
cast@0.3.0
cfg-if@1.0.0
ciborium-io@0.2.2
ciborium-ll@0.2.2
ciborium@0.2.2
clap@4.5.23
clap_builder@4.5.23
clap_lex@0.7.4
criterion-plot@0.5.0
criterion@0.5.1
crossbeam-deque@0.8.6
crossbeam-epoch@0.9.18
crossbeam-utils@0.8.21
crunchy@0.2.2
either@1.13.0
half@2.4.1
heck@0.5.0
hermit-abi@0.4.0
indoc@2.0.4
is-terminal@0.4.13
itertools@0.10.5
itoa@1.0.14
js-sys@0.3.76
libc@0.2.169
log@0.4.22
memchr@2.7.4
memoffset@0.9.0
num-traits@0.2.19
once_cell@1.19.0
oorandom@11.1.4
plotters-backend@0.3.7
plotters-svg@0.3.7
plotters@0.3.7
portable-atomic@1.9.0
proc-macro2@1.0.89
pyo3-build-config@0.22.6
pyo3-ffi@0.22.6
pyo3-macros-backend@0.22.6
pyo3-macros@0.22.6
pyo3@0.22.6
quote@1.0.37
rayon-core@1.12.1
rayon@1.10.0
regex-automata@0.4.9
regex-syntax@0.8.5
regex@1.11.1
rustc-hash@2.1.0
ryu@1.0.18
same-file@1.0.6
serde@1.0.216
serde_derive@1.0.216
serde_json@1.0.133
syn@2.0.87
target-lexicon@0.12.16
tinytemplate@1.2.1
unicode-ident@1.0.12
unindent@0.2.3
walkdir@2.5.0
wasm-bindgen-backend@0.2.99
wasm-bindgen-macro-support@0.2.99
wasm-bindgen-macro@0.2.99
wasm-bindgen-shared@0.2.99
wasm-bindgen@0.2.99
web-sys@0.3.76
winapi-util@0.1.9
windows-sys@0.52.0
windows-sys@0.59.0
windows-targets@0.52.6
windows_aarch64_gnullvm@0.52.6
windows_aarch64_msvc@0.52.6
windows_i686_gnu@0.52.6
windows_i686_gnullvm@0.52.6
windows_i686_msvc@0.52.6
windows_x86_64_gnu@0.52.6
windows_x86_64_gnullvm@0.52.6
windows_x86_64_msvc@0.52.6
"
inherit cargo distutils-r1 pypi optfeature
DESCRIPTION="An easily customizable SQL parser and transpiler"
HOMEPAGE="
https://sqlglot.com/
https://github.com/tobymao/sqlglot/
https://pypi.org/project/sqlglot/
"
SRC_URI+="
native-extensions? (
${CARGO_CRATE_URIS}
)
"
LICENSE="MIT"
LICENSE+=" native-extensions? ("
# Dependent crate licenses
LICENSE+="
Apache-2.0 Apache-2.0-with-LLVM-exceptions MIT Unicode-DFS-2016
"
LICENSE+=" )"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="+native-extensions"
BDEPEND="
native-extensions? (
${RUST_DEPEND}
dev-util/maturin[${PYTHON_USEDEP}]
)
test? (
dev-python/pytz[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
QA_FLAGS_IGNORED="usr/lib.*/py.*/site-packages/sqlglotrs/sqlglotrs.*.so"
pkg_setup() {
use native-extensions && rust_pkg_setup
}
src_unpack() {
cargo_src_unpack
}
python_compile() {
distutils-r1_python_compile
if use native-extensions; then
local DISTUTILS_USE_PEP517=maturin
cd sqlglotrs || die
distutils-r1_python_compile
cd - >/dev/null || die
fi
}
python_test() {
local EPYTEST_DESELECT=(
# timing, sigh
# https://github.com/tobymao/sqlglot/issues/3961
tests/test_generator.py::TestGenerator::test_generate_nested_binary
)
local EPYTEST_IGNORE=(
# Tests require pyspark or duckdb which aren't in the tree.
# Pandas would be a requirement normally, but it gets ignored by proxy.
"tests/dataframe/integration/test_dataframe.py"
"tests/dataframe/integration/test_grouped_data.py"
"tests/dataframe/integration/test_session.py"
"tests/test_executor.py"
"tests/test_optimizer.py"
)
# make sure not to use an earlier installed version
local -x SQLGLOTRS_TOKENIZER=$(usex native-extensions 1 0)
rm -rf sqlglotrs || die
epytest
}
pkg_postinst() {
optfeature "simplifying timedelta expressions" dev-python/python-dateutil
}
|