ducpy 3.2.3__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ducpy-3.2.3 → ducpy-3.3.0}/Cargo.lock +1 -1
- {ducpy-3.2.3 → ducpy-3.3.0}/PKG-INFO +1 -1
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducpy/crate/Cargo.toml +1 -1
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/build.rs +32 -10
- {ducpy-3.2.3 → ducpy-3.3.0}/pyproject.toml +3 -1
- ducpy-3.3.0/schema/duc.sql +847 -0
- ducpy-3.3.0/schema/migrations/3000000_to_3000001.sql +39 -0
- ducpy-3.3.0/schema/migrations/3000001_to_3000002.sql +39 -0
- ducpy-3.3.0/schema/migrations/3000002_to_3000003.sql +144 -0
- ducpy-3.3.0/schema/migrations/3000003_to_3000004.sql +20 -0
- ducpy-3.3.0/schema/search.sql +148 -0
- ducpy-3.3.0/schema/version_control.sql +144 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/Cargo.toml +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/LICENSE +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/README.md +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducpy/crate/src/lib.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/.gitignore +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/Cargo.toml +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/LICENSE +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/README.md +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/package.json +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/release.config.cjs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/document.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/meta.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/mod.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/version_control.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/bootstrap.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/mod.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/native.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/wasm.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/lib.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/parse.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/serde_utils.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/serialize.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/types.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/sst-env.d.ts +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/.gitignore +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/common/mod.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/parser_assets.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/synthetic_roundtrip.rs +0 -0
- {ducpy-3.2.3 → ducpy-3.3.0}/src/ducpy_native/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use std::env;
|
|
2
2
|
use std::fs;
|
|
3
|
-
use std::path::PathBuf;
|
|
3
|
+
use std::path::{Path, PathBuf};
|
|
4
4
|
|
|
5
5
|
/// Extract raw `PRAGMA user_version = <N>;` from `duc.sql`.
|
|
6
6
|
fn schema_user_version_from_sql(sql: &str) -> u32 {
|
|
@@ -24,23 +24,45 @@ fn decode_user_version_to_semver(user_version: u32) -> String {
|
|
|
24
24
|
format!("{major}.{minor}.{patch}")
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
fn find_schema_dir(manifest_dir: &Path) -> Result<PathBuf, Box<dyn std::error::Error>> {
|
|
28
|
+
if let Ok(path) = env::var("DUC_SCHEMA_DIR") {
|
|
29
|
+
let candidate = PathBuf::from(path);
|
|
30
|
+
if candidate.join("duc.sql").is_file() {
|
|
31
|
+
return Ok(candidate);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
for ancestor in manifest_dir.ancestors() {
|
|
36
|
+
for candidate in [
|
|
37
|
+
ancestor.join("schema"),
|
|
38
|
+
ancestor.join("packages").join("ducpy").join("schema"),
|
|
39
|
+
] {
|
|
40
|
+
if candidate.join("duc.sql").is_file() {
|
|
41
|
+
return Ok(candidate);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Err(format!(
|
|
47
|
+
"Could not locate schema/duc.sql from {}. Set DUC_SCHEMA_DIR to a directory containing duc.sql.",
|
|
48
|
+
manifest_dir.display()
|
|
49
|
+
)
|
|
50
|
+
.into())
|
|
51
|
+
}
|
|
52
|
+
|
|
27
53
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
28
54
|
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
|
|
29
|
-
let schema_dir = manifest_dir
|
|
55
|
+
let schema_dir = find_schema_dir(&manifest_dir)?;
|
|
30
56
|
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
|
|
57
|
+
println!("cargo:rerun-if-env-changed=DUC_SCHEMA_DIR");
|
|
31
58
|
|
|
32
59
|
// Copy schema files into OUT_DIR so bootstrap.rs can include_str! them
|
|
33
60
|
// even when the crate is built from an sdist in a temp directory.
|
|
34
61
|
for name in ["duc.sql", "version_control.sql", "search.sql"] {
|
|
35
62
|
let src = schema_dir.join(name);
|
|
36
63
|
let dst = out_dir.join(name);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Err(e) => {
|
|
40
|
-
eprintln!("cargo:warning=Could not read {:?}: {e}. Writing empty stub.", src);
|
|
41
|
-
fs::write(&dst, "")?;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
64
|
+
let contents = fs::read_to_string(&src)?;
|
|
65
|
+
fs::write(&dst, contents)?;
|
|
44
66
|
println!("cargo:rerun-if-changed={}", src.display());
|
|
45
67
|
}
|
|
46
68
|
// Scan schema/migrations/*.sql, parse (from, to) from filenames like
|
|
@@ -127,4 +149,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
127
149
|
println!("cargo:rerun-if-changed=build.rs");
|
|
128
150
|
|
|
129
151
|
Ok(())
|
|
130
|
-
}
|
|
152
|
+
}
|
|
@@ -32,7 +32,9 @@ build-backend = "maturin"
|
|
|
32
32
|
[tool.maturin]
|
|
33
33
|
module-name = "ducpy_native"
|
|
34
34
|
include = [
|
|
35
|
-
{ path = "LICENSE", format = "sdist" }
|
|
35
|
+
{ path = "LICENSE", format = "sdist" },
|
|
36
|
+
{ path = "schema/**/*", format = "sdist" },
|
|
37
|
+
{ path = "schema/**/*", format = "wheel" }
|
|
36
38
|
]
|
|
37
39
|
manifest-path = "packages/ducpy/crate/Cargo.toml"
|
|
38
40
|
python-source = "src"
|