From ac94fb86fdfbe542a07efe63343e39a1788fe7e8 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 13 Sep 2024 22:21:53 +0200 Subject: [PATCH] chore: rename feature to py for consistency --- .github/workflows/test.yml | 2 +- Cargo.toml | 10 +++------- build.rs | 4 ++-- src/api/change.rs | 4 ++-- src/api/config.rs | 2 +- src/api/cursor.rs | 6 +++--- src/api/event.rs | 2 +- src/buffer/controller.rs | 2 +- src/client.rs | 4 ++-- src/cursor/controller.rs | 2 +- src/ffi/mod.rs | 2 +- src/workspace.rs | 6 +++--- 12 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e204dc..1485c9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - luajit # should we test with lua54 instead? - java - js - - python + - py toolchain: - stable # - beta diff --git a/Cargo.toml b/Cargo.toml index 62f2389..4ca0a86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,13 +71,9 @@ serialize = ["dep:serde", "uuid/serde"] rust = [] # used for ci matrix java = ["lazy_static", "jni", "tracing-subscriber"] js = ["napi-build", "tracing-subscriber", "napi", "napi-derive"] -python = ["pyo3", "tracing-subscriber", "pyo3-build-config"] -lua = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize"] -lua54 = ["lua", "mlua-codemp-patch/lua54"] -lua53 = ["lua", "mlua-codemp-patch/lua53"] -lua52 = ["lua", "mlua-codemp-patch/lua52"] -lua51 = ["lua", "mlua-codemp-patch/lua51"] -luajit = ["lua", "mlua-codemp-patch/luajit"] +py = ["pyo3", "tracing-subscriber", "pyo3-build-config"] +lua = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize", "mlua-codemp-patch/lua54"] +luajit = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize", "mlua-codemp-patch/luajit"] [package.metadata.docs.rs] # enabled features when building on docs.rs diff --git a/build.rs b/build.rs index 9522fcb..fa74299 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,7 @@ #[cfg(feature = "js")] extern crate napi_build; -#[cfg(feature = "python")] +#[cfg(feature = "py")] extern crate pyo3_build_config; /// The main method of the buildscript, required by some glue modules. @@ -11,7 +11,7 @@ fn main() { napi_build::setup(); } - #[cfg(feature = "python")] + #[cfg(feature = "py")] { pyo3_build_config::add_extension_module_link_args(); } diff --git a/src/api/change.rs b/src/api/change.rs index b7142e6..6e0aa1c 100644 --- a/src/api/change.rs +++ b/src/api/change.rs @@ -22,7 +22,7 @@ /// #[derive(Clone, Debug, Default)] #[cfg_attr(feature = "js", napi_derive::napi(object))] -#[cfg_attr(feature = "python", pyo3::pyclass(get_all))] +#[cfg_attr(feature = "py", pyo3::pyclass(get_all))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub struct TextChange { /// Range start of text change, as char indexes in buffer previous state. @@ -42,7 +42,7 @@ impl TextChange { } } -#[cfg_attr(feature = "python", pyo3::pymethods)] +#[cfg_attr(feature = "py", pyo3::pymethods)] impl TextChange { /// Returns true if this [`TextChange`] deletes existing text. /// diff --git a/src/api/config.rs b/src/api/config.rs index 0e57725..3412512 100644 --- a/src/api/config.rs +++ b/src/api/config.rs @@ -11,7 +11,7 @@ /// http{tls?'s':''}://{host}:{port} #[derive(Clone, Debug)] #[cfg_attr(feature = "js", napi_derive::napi(object))] -#[cfg_attr(feature = "python", pyo3::pyclass(get_all))] +#[cfg_attr(feature = "py", pyo3::pyclass(get_all))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub struct Config { /// user identifier used to register, possibly your email diff --git a/src/api/cursor.rs b/src/api/cursor.rs index f68cdb4..06b6b94 100644 --- a/src/api/cursor.rs +++ b/src/api/cursor.rs @@ -1,14 +1,14 @@ //! ### Cursor //! Represents the position of a remote user's cursor. -#[cfg(feature = "python")] +#[cfg(feature = "py")] use pyo3::prelude::*; /// User cursor position in a buffer #[derive(Clone, Debug, Default)] -#[cfg_attr(feature = "python", pyclass)] +#[cfg_attr(feature = "py", pyclass)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -// #[cfg_attr(feature = "python", pyo3(crate = "reexported::pyo3"))] +// #[cfg_attr(feature = "py", pyo3(crate = "reexported::pyo3"))] pub struct Cursor { /// Cursor start position in buffer, as 0-indexed row-column tuple. pub start: (i32, i32), diff --git a/src/api/event.rs b/src/api/event.rs index 23f2831..26e87df 100644 --- a/src/api/event.rs +++ b/src/api/event.rs @@ -4,7 +4,7 @@ use codemp_proto::workspace::workspace_event::Event as WorkspaceEventInner; /// Event in a [crate::Workspace]. #[derive(Debug, Clone)] -#[cfg_attr(feature = "python", pyo3::pyclass)] +#[cfg_attr(feature = "py", pyo3::pyclass)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub enum Event { /// Fired when the file tree changes. diff --git a/src/buffer/controller.rs b/src/buffer/controller.rs index b91016b..a690b05 100644 --- a/src/buffer/controller.rs +++ b/src/buffer/controller.rs @@ -18,7 +18,7 @@ use super::worker::DeltaRequest; /// Each buffer controller internally tracks the last acknowledged state, remaining always in sync /// with the server while allowing to procedurally receive changes while still sending new ones. #[derive(Debug, Clone)] -#[cfg_attr(feature = "python", pyo3::pyclass)] +#[cfg_attr(feature = "py", pyo3::pyclass)] #[cfg_attr(feature = "js", napi_derive::napi)] pub struct BufferController(pub(crate) Arc); diff --git a/src/client.rs b/src/client.rs index 8930994..bd425d9 100644 --- a/src/client.rs +++ b/src/client.rs @@ -12,7 +12,7 @@ use codemp_proto::{ common::{Empty, Token}, session::{session_client::SessionClient, InviteRequest, WorkspaceRequest}, }; -#[cfg(feature = "python")] +#[cfg(feature = "py")] use pyo3::prelude::*; /// A `codemp` client handle. @@ -22,7 +22,7 @@ use pyo3::prelude::*; /// A new [`Client`] can be obtained with [`Client::connect`]. #[derive(Debug, Clone)] #[cfg_attr(feature = "js", napi_derive::napi)] -#[cfg_attr(feature = "python", pyclass)] +#[cfg_attr(feature = "py", pyclass)] pub struct Client(Arc); #[derive(Debug)] diff --git a/src/cursor/controller.rs b/src/cursor/controller.rs index 780590e..7bb1789 100644 --- a/src/cursor/controller.rs +++ b/src/cursor/controller.rs @@ -12,7 +12,7 @@ use codemp_proto::{cursor::{CursorPosition, RowCol}, files::BufferNode}; /// /// An unique [CursorController] exists for each active [crate::Workspace]. #[derive(Debug, Clone)] -#[cfg_attr(feature = "python", pyo3::pyclass)] +#[cfg_attr(feature = "py", pyo3::pyclass)] #[cfg_attr(feature = "js", napi_derive::napi)] pub struct CursorController(pub(crate) Arc); diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index ea93cd2..0cd53e1 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -47,5 +47,5 @@ pub mod lua; pub mod js; /// python bindings, built with [pyo3] -#[cfg(feature = "python")] +#[cfg(feature = "py")] pub mod python; diff --git a/src/workspace.rs b/src/workspace.rs index 0bb3bcd..c8ed85c 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -33,7 +33,7 @@ use uuid::Uuid; use napi_derive::napi; #[derive(Debug, Clone)] -#[cfg_attr(feature = "python", pyo3::pyclass)] +#[cfg_attr(feature = "py", pyo3::pyclass)] #[cfg_attr(feature = "js", napi)] pub struct Workspace(Arc); @@ -357,8 +357,8 @@ impl Drop for WorkspaceInner { } } -#[cfg_attr(feature = "python", pyo3::pyclass(eq, eq_int))] -#[cfg_attr(feature = "python", derive(PartialEq))] +#[cfg_attr(feature = "py", pyo3::pyclass(eq, eq_int))] +#[cfg_attr(feature = "py", derive(PartialEq))] pub enum DetachResult { NotAttached, Detaching,