Skip to content

Commit 6f344e9

Browse files
committedJun 7, 2024
Fix dbapi feature packaging
1 parent 08b4ec6 commit 6f344e9

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed
 

‎MANIFEST.in

-2
This file was deleted.

‎chdb/dbapi/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
DatabaseError, OperationalError, IntegrityError, InternalError,
66
NotSupportedError, ProgrammingError)
77
from . import connections as _orig_conn
8+
from .. import chdb_version
89

9-
VERSION = (0, 1, 0, None)
10-
if VERSION[3] is not None:
11-
VERSION_STRING = "%d.%d.%d_%s" % VERSION
10+
if chdb_version[3] is not None:
11+
VERSION_STRING = "%d.%d.%d_%s" % chdb_version
1212
else:
13-
VERSION_STRING = "%d.%d.%d" % VERSION[:3]
13+
VERSION_STRING = "%d.%d.%d" % chdb_version[:3]
1414

1515
threadsafety = 1
1616
apilevel = "2.0"
@@ -71,9 +71,9 @@ def Connect(*args, **kwargs):
7171

7272

7373
def get_client_info(): # for MySQLdb compatibility
74-
version = VERSION
75-
if VERSION[3] is None:
76-
version = VERSION[:3]
74+
version = chdb_version
75+
if chdb_version[3] is None:
76+
version = chdb_version[:3]
7777
return '.'.join(map(str, version))
7878

7979

‎gen_manifest.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
66

77
cd ${DIR}
88

9-
echo "include chdb/*.py" > MANIFEST.in
9+
rm -f MANIFEST.in
10+
11+
echo "include README.md" >> MANIFEST.in
12+
echo "include LICENSE.txt" >> MANIFEST.in
13+
echo "graft chdb" >> MANIFEST.in
14+
echo "global-exclude *.py[cod]" >> MANIFEST.in
15+
echo "global-exclude __pycache__" >> MANIFEST.in
16+
echo "global-exclude .DS_Store" >> MANIFEST.in
17+
echo "global-exclude .git*" >> MANIFEST.in
18+
echo "global-exclude ~*" >> MANIFEST.in
1019
export SO_SUFFIX=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
1120
echo "include chdb/_chdb${SO_SUFFIX}" >> MANIFEST.in

‎setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,19 @@ def build_extensions(self):
170170
# fix the version in chdb/__init__.py
171171
versionStr = get_latest_git_tag()
172172
fix_version_init(versionStr)
173+
174+
# scan the chdb directory and add all the .py files to the package
175+
pkg_files = []
176+
for root, dirs, files in os.walk(libdir):
177+
for file in files:
178+
if file.endswith(".py"):
179+
pkg_files.append(os.path.join(root, file))
180+
pkg_files.append(chdb_so)
181+
173182
setup(
174183
packages=['chdb'],
175184
version=versionStr,
176-
package_data={'chdb': [chdb_so]},
185+
package_data={'chdb': pkg_files},
177186
exclude_package_data={'': ['*.pyc', 'src/**']},
178187
ext_modules=ext_modules,
179188
python_requires='>=3.7',

0 commit comments

Comments
 (0)
Please sign in to comment.