Skip to content

Commit 27acef5

Browse files
committed
refactor: reorganize project layout into docs scripts and src/native
1 parent 8d87a1f commit 27acef5

34 files changed

Lines changed: 33 additions & 24 deletions

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
include *.c *.h LICENSE README.md setup.py pyproject.toml
1+
include LICENSE README.md setup.py pyproject.toml docs/README_zh.md
2+
recursive-include src/native *.c *.h
23
recursive-include dpi_bridge *.go
34
include dpi_bridge/go.mod dpi_bridge/go.sum
45
exclude dpi_bridge/libdmdpi.dylib dpi_bridge/libdmdpi.h

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,21 @@ DMPYTHON_SKIP_GO_BUILD=1 python -m build --wheel
7171
dmPython/
7272
├── setup.py # Build script
7373
├── pyproject.toml # Project metadata
74+
├── docs/ # Project docs (zh README, technical notes)
75+
├── scripts/ # Local/ops scripts
76+
├── src/native/ # C extension sources and headers
7477
├── dpi_bridge/ # Go-based DPI bridge (replaces proprietary libdmdpi)
7578
│ ├── main.go
7679
│ ├── go.mod / go.sum
7780
│ └── ...
7881
├── dpi_include/ # DPI header files (not distributed, see README)
79-
├── py_Dameng.c/h # Module entry, type registration, exception hierarchy
80-
├── strct.h # Core struct definitions (Environment, Connection, Cursor)
81-
├── Connection.c # Connection management
82-
├── Cursor.c # Cursor operations, SQL execution
83-
├── var.c # Variable management core
84-
├── v*.c # Type-specific variable handlers
85-
├── ex*.c # External object interfaces (LOB, BFILE, Object)
82+
├── src/native/py_Dameng.c/h # Module entry, type registration, exception hierarchy
83+
├── src/native/strct.h # Core struct definitions (Environment, Connection, Cursor)
84+
├── src/native/Connection.c # Connection management
85+
├── src/native/Cursor.c # Cursor operations, SQL execution
86+
├── src/native/var.c # Variable management core
87+
├── src/native/v*.c # Type-specific variable handlers
88+
├── src/native/ex*.c # External object interfaces (LOB, BFILE, Object)
8689
└── .github/workflows/ # CI: builds macOS ARM64 wheels for Python 3.9–3.13
8790
```
8891

@@ -92,4 +95,4 @@ Licensed under [Mulan PSL v2](http://license.coscl.org.cn/MulanPSL2).
9295

9396
---
9497

95-
[中文文档 (README_zh.md)](README_zh.md)
98+
[中文文档 (docs/README_zh.md)](docs/README_zh.md)

README_zh.md renamed to docs/README_zh.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dmPython 是达梦数据库(DM8)的原生 Python 驱动程序,遵循 [Pyth
99

1010
本项目是 [官方 dmPython](https://github.com/DamengDB/dmPython) 的社区 fork。上游项目依赖的专有 C 库 `libdmdpi` 不提供 macOS 版本,本 fork 使用 Go 编写的 DPI 桥接库(`dpi_bridge/`)替代,实现原生 macOS ARM64 支持,无需安装完整的达梦数据库。
1111

12-
**当前版本:** 2.5.30
12+
**当前版本:** 2.5.31
1313

1414
## 特性
1515

@@ -90,18 +90,21 @@ define_macros.append(('TRACE', None))
9090
dmPython/
9191
├── setup.py # 构建脚本
9292
├── pyproject.toml # 项目元数据
93+
├── docs/ # 项目文档(中文 README、技术报告)
94+
├── scripts/ # 本地/运维脚本
95+
├── src/native/ # C 扩展源码与头文件
9396
├── dpi_bridge/ # Go DPI 桥接库(替代专有 libdmdpi)
9497
│ ├── main.go
9598
│ ├── go.mod / go.sum
9699
│ └── ...
97100
├── dpi_include/ # DPI 头文件(不随源码分发,见 README)
98-
├── py_Dameng.c/h # 模块入口,类型注册,异常层次
99-
├── strct.h # 核心结构定义 (Environment, Connection, Cursor)
100-
├── Connection.c # 连接管理
101-
├── Cursor.c # 游标操作,SQL 执行
102-
├── var.c # 变量管理核心
103-
├── v*.c # 各类型变量处理器
104-
├── ex*.c # 外部对象接口 (LOB, BFILE, Object)
101+
├── src/native/py_Dameng.c/h # 模块入口,类型注册,异常层次
102+
├── src/native/strct.h # 核心结构定义 (Environment, Connection, Cursor)
103+
├── src/native/Connection.c # 连接管理
104+
├── src/native/Cursor.c # 游标操作,SQL 执行
105+
├── src/native/var.c # 变量管理核心
106+
├── src/native/v*.c # 各类型变量处理器
107+
├── src/native/ex*.c # 外部对象接口 (LOB, BFILE, Object)
105108
└── .github/workflows/ # CI:构建 macOS ARM64 wheels (Python 3.9–3.13)
106109
```
107110

@@ -111,4 +114,4 @@ dmPython/
111114

112115
---
113116

114-
[English README (README.md)](README.md)
117+
[English README (README.md)](../README.md)

setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@
1717

1818
BUILD_VERSION = "2.5.31"
1919

20+
# Directories
21+
HERE = os.path.dirname(os.path.abspath(__file__))
22+
DPI_BRIDGE_DIR = os.path.join(HERE, "dpi_bridge")
23+
NATIVE_SRC_DIR = os.path.join("src", "native")
24+
2025
# All C source files
21-
C_SOURCES = [
26+
C_SOURCE_FILES = [
2227
"py_Dameng.c",
2328
"row.c",
2429
"Cursor.c",
@@ -42,10 +47,7 @@
4247
"vBfile.c",
4348
"trc.c",
4449
]
45-
46-
# Directories
47-
HERE = os.path.dirname(os.path.abspath(__file__))
48-
DPI_BRIDGE_DIR = os.path.join(HERE, "dpi_bridge")
50+
C_SOURCES = [os.path.join(NATIVE_SRC_DIR, f) for f in C_SOURCE_FILES]
4951

5052

5153
def find_dpi_include():
@@ -130,7 +132,7 @@ def _build_go_bridge(self):
130132
extension = Extension(
131133
name="dmPython",
132134
sources=C_SOURCES,
133-
include_dirs=[DPI_INCLUDE_DIR],
135+
include_dirs=[DPI_INCLUDE_DIR, os.path.join(HERE, NATIVE_SRC_DIR)],
134136
library_dirs=[DPI_BRIDGE_DIR],
135137
libraries=["dmdpi"],
136138
define_macros=define_macros,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)