0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 17:24:15 +01:00
posthog/hogql_parser/setup.py
Michael Matloka 715a8b924e
fix(hogql): Only expose HogQL exceptions relevant to users (#21329)
* fix(hogql): Only expose HogQL exceptions relevant to users

* Update http.py

* Use exposed exceptions more liberally

* Update more handling

* Update action.py

* Rename `Exception` to `Error`

* Use new hogql-parser version

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-05 11:39:20 +00:00

58 lines
1.8 KiB
Python

from setuptools import setup, Extension
import platform
system = platform.system()
if system not in ("Darwin", "Linux"):
raise Exception("Only Linux and macOS are supported by hogql_parser")
is_macos = system == "Darwin"
homebrew_location = "/opt/homebrew" if platform.machine() == "arm64" else "/usr/local"
module = Extension(
"hogql_parser",
sources=[
"HogQLLexer.cpp",
"HogQLParser.cpp",
"HogQLParserBaseVisitor.cpp",
"HogQLParserVisitor.cpp",
"error.cpp",
"string.cpp",
"parser.cpp",
],
include_dirs=[
f"{homebrew_location}/include/",
f"{homebrew_location}/include/antlr4-runtime/",
]
if is_macos
else ["/usr/include/", "/usr/include/antlr4-runtime/"],
library_dirs=[f"{homebrew_location}/lib/"] if is_macos else ["/usr/lib/", "/usr/lib64/"],
libraries=["antlr4-runtime"],
extra_compile_args=["-std=c++20"],
)
setup(
name="hogql_parser",
version="1.0.7",
url="https://github.com/PostHog/posthog/tree/master/hogql_parser",
author="PostHog Inc.",
author_email="hey@posthog.com",
maintainer="PostHog Inc.",
maintainer_email="hey@posthog.com",
description="HogQL parser for internal PostHog use",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
package_data={"hogql_parser": ["__init__.pyi", "py.typed"]},
ext_modules=[module],
python_requires=">=3.10",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)