From 0de0340f4e4b6c97a9a631b9c23f1dbf16e6d7a6 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Fri, 29 Sep 2023 18:26:38 +0200 Subject: [PATCH] publish workspace --- Cargo.toml | 4 +- members/pt-py/src/lib.rs | 101 --------------------------------------- publish.sh | 8 ++++ 3 files changed, 10 insertions(+), 103 deletions(-) delete mode 100644 members/pt-py/src/lib.rs create mode 100755 publish.sh diff --git a/Cargo.toml b/Cargo.toml index 1ddcddf..7e04b43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ default-members = [ "members/libpt-math", ] [workspace.package] -publish = false +publish = true version = "0.1.7" edition = "2021" authors = ["Christoph J. Scherr "] @@ -37,7 +37,7 @@ pyo3 = "0.19" [package] name = "libpt" -publish = true +publish.workspace = true version.workspace = true edition.workspace = true authors.workspace = true diff --git a/members/pt-py/src/lib.rs b/members/pt-py/src/lib.rs deleted file mode 100644 index ab60524..0000000 --- a/members/pt-py/src/lib.rs +++ /dev/null @@ -1,101 +0,0 @@ -// FIXME: Using a local dependency does not work with maturin as it seems? -use libpt::{ - log::*, -}; - -use pyo3::prelude::*; - -//// PUBLIC FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -/// ## Check if [`libpt`](crate) has been loaded -/// -/// Always returns `true` if you can execute it. -#[pyfunction] -pub fn is_loaded() -> bool { - true -} - -//// PRIVATE FUNCTIONS ///////////////////////////////////////////////////////////////////////////// -/// ## Python module: logger -#[pymodule] -fn py_logger(py: Python, parent: &PyModule) -> PyResult<()> { - let module = PyModule::new(py, "logger")?; - module.add_class::()?; - - parent.add_submodule(module)?; - Ok(()) -} -// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// /// ## Python module: common -// #[pymodule] -// fn py_common(py: Python, parent: &PyModule) -> PyResult<()> { -// let module = PyModule::new(py, "common")?; -// py_common_printing(py, module)?; -// -// parent.add_submodule(module)?; -// Ok(()) -// } -// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// /// ## Python module: common.printing -// #[pymodule] -// fn py_common_printing(py: Python, parent: &PyModule) -> PyResult<()> { -// let module = PyModule::new(py, "printing")?; -// module.add_function(wrap_pyfunction!(common::printing::divider, module)?)?; -// module.add_function(wrap_pyfunction!(common::printing::print_divider, module)?)?; -// -// parent.add_submodule(module)?; -// Ok(()) -// } -// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// /// ## Python module: networking -// #[pymodule] -// fn py_networking(py: Python, parent: &PyModule) -> PyResult<()> { -// let module = PyModule::new(py, "networking")?; -// py_networking_monitoring(py, module)?; -// -// parent.add_submodule(module)?; -// Ok(()) -// } -// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// /// ## Python module: networking.monitoring -// #[pymodule] -// fn py_networking_monitoring(py: Python, parent: &PyModule) -> PyResult<()> { -// let module = PyModule::new(py, "monitoring")?; -// py_networking_monitoring_uptime(py, module)?; -// -// parent.add_submodule(module)?; -// Ok(()) -// } -// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// /// ## Python module: networking.monitoring.uptime -// #[pymodule] -// fn py_networking_monitoring_uptime(py: Python, parent: &PyModule) -> PyResult<()> { -// let module = PyModule::new(py, "uptime")?; -// module.add_class::()?; -// module.add_function(wrap_pyfunction!( -// networking::monitoring::uptime::py_continuous_uptime_monitor, -// module -// )?)?; -// -// parent.add_submodule(module)?; -// Ok(()) -// } - -//////////////////////////////////////////////////////////////////////////////////////////////////// -/// ## Python module: root -/// -/// This function is the entry point of [`PyO3`](pyo3). This is where the main module is built. -#[pymodule] -fn _libpt(py: Python, m: &PyModule) -> PyResult<()> { - m.add_function(wrap_pyfunction!(is_loaded, m)?)?; - - // load sub modules - // py_common(py, m)?; - py_logger(py, m)?; - // py_networking(py, m)?; - Ok(()) -} diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..314ca4e --- /dev/null +++ b/publish.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +PKGs=(libpt-{core,math,log,net,bintols,ccc,hedu,bin,py} libpt) +for PKG in "${PKGs[@]}"; do + echo "Package: $PKG" + cargo publish --registry cscherr -p "$PKG" + cargo publish -p "$PKG" +done