Skip to content

Commit 13f3ee8

Browse files
committed
build json during sdist
1 parent 5c87e03 commit 13f3ee8

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

setup.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import setuptools
2-
from setuptools.command.install import install
2+
from distutils.command import build as build_module
33

44
about = {}
55
with open("mindsdb_sql_parser/__about__.py") as fp:
66
exec(fp.read(), about)
77

8-
class PostInstallCommand(install):
9-
"""Post-installation for installation mode."""
10-
def run(self):
11-
install.run(self)
12-
from mindsdb_sql_parser.parser import MindsDBParser
13-
try:
14-
MindsDBParser.build_to_file()
15-
except Exception as e:
16-
print(f'Problem with building syntax. Import might be not efficient: {e}')
8+
class Build(build_module.build):
9+
def run(self):
10+
from mindsdb_sql_parser.parser import MindsDBParser
11+
try:
12+
MindsDBParser.build_to_file()
13+
except Exception as e:
14+
print(f'Problem with building syntax. Import might be not efficient: {e}')
15+
build_module.build.run(self)
1716

1817
setuptools.setup(
1918
name=about['__title__'],
@@ -25,12 +24,15 @@ def run(self):
2524
author_email=about['__email__'],
2625
description=about['__description__'],
2726
packages=setuptools.find_packages(exclude=('tests*',)),
27+
package_data={
28+
about['__title__']: ['*.json'], # Adjust the path as needed
29+
},
2830
classifiers=[
2931
"Programming Language :: Python :: 3",
3032
"Operating System :: OS Independent",
3133
],
3234
python_requires=">=3.6",
3335
cmdclass={
34-
'install': PostInstallCommand,
35-
}
36+
'sdist': Build
37+
},
3638
)

0 commit comments

Comments
 (0)