flowmark 0.1.2

Fast, modern Markdown formatter with smart typography and paragraph wrapping
Documentation
use std::process::Command;

fn main() {
    // Try to get Python version from submodule git tag
    let python_version = Command::new("git")
        .args(["describe", "--tags", "--always"])
        .current_dir("../../python-repo")
        .output()
        .ok()
        .and_then(|output| {
            if output.status.success() { String::from_utf8(output.stdout).ok() } else { None }
        })
        .map_or_else(
            || {
                // Fallback to metadata in Cargo.toml
                std::env::var("CARGO_PKG_METADATA_PYTHON_SOURCE_VERSION")
                    .unwrap_or_else(|_| "unknown".to_string())
            },
            |s| s.trim().to_string(),
        );

    println!("cargo:rustc-env=PYTHON_SOURCE_VERSION={python_version}");

    // Rebuild if python-repo submodule changes
    println!("cargo:rerun-if-changed=../../python-repo");
}