chore: name change and build script tweak, adding the wheel

Former-commit-id: e77044f56c199268115c8768d69b4fe06357d6c3
This commit is contained in:
Camillo Schenone 2024-03-23 18:55:26 +01:00
parent 0062c292a8
commit 55da78ad91
7 changed files with 35 additions and 23 deletions

View file

@ -1,11 +1,11 @@
[package] [package]
name = "CodempClient-Sublime" name = "Codemp-Sublime"
version = "0.6.1" version = "0.6.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib] [lib]
name = "codemp_client" name = "codemp"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]

View file

@ -0,0 +1 @@
f629b2a823b8f4d351a4641f0f42bf84f95406c8

View file

@ -0,0 +1 @@
5f1dfe7e8371de1f4967223a801cf49286065133

View file

@ -1,18 +1,27 @@
#!/bin/sh #!/bin/sh
ROOT_DIR="$(pwd)" ROOT_DIR="$(pwd)"
BUILD_DIR="$ROOT_DIR/target/debug/deps" BUILD_DIR="$ROOT_DIR/target/debug/"
FILENAME="libcodemp_client" WHEEL_DIR="$ROOT_DIR/target/wheels"
FILENAME="libcodemp"
TARGET_DIR="$ROOT_DIR/bindings" TARGET_DIR="$ROOT_DIR/bindings"
TARGET_NAME="codemp_client" SO_NAME="codemp"
WHEEL_NAME="Codemp_Sublime"
PYO3_PYTHON="$(pyenv which python)" PYO3_PYTHON="$(pyenv which python)"
TARGET_EXT="$($PYO3_PYTHON -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')" TARGET_EXT="$($PYO3_PYTHON -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')"
FULL_TARGET="${TARGET_NAME}${TARGET_EXT}" SO_TARGET="${SO_NAME}${TARGET_EXT}"
echo "Building with python: $PYO3_PYTHON" echo "Building .SO with python: $PYO3_PYTHON"
env PYO3_PYTHON="${PYO3_PYTHON}" cargo build env PYO3_PYTHON="${PYO3_PYTHON}" cargo build
echo "Copying into: $TARGET_DIR/$FULL_TARGET" echo "Copying into: $TARGET_DIR/$SO_TARGET"
ditto "$BUILD_DIR/${FILENAME}.dylib" "$TARGET_DIR/$FULL_TARGET" echo "Building python wheel..."
maturin build -i "$PYO3_PYTHON"
wheels=($WHEEL_DIR/$WHEEL_NAME*.whl)
for whl in $wheels; do
cp $whl $TARGET_DIR
done
ditto "$BUILD_DIR/${FILENAME}.dylib" "$TARGET_DIR/$SO_TARGET"

View file

@ -1,16 +1,17 @@
import sublime import sublime
import sublime_plugin import sublime_plugin
from Codemp.src.codemp_client import VirtualClient # import os
from Codemp.src.codemp_client import CodempLogger # import sys
from Codemp.src.TaskManager import rt # import importlib.util
from Codemp.src.utils import status_log
from Codemp.src.utils import safe_listener_detach from .src.codemp_client import VirtualClient
from Codemp.src.utils import get_contents from .src.codemp_client import CodempLogger
from Codemp.src.utils import populate_view from .src.TaskManager import rt
from Codemp.src.utils import get_view_from_local_path from .src.utils import status_log
import Codemp.src.globals as g from .src.utils import safe_listener_detach
from Codemp.bindings.codemp_client import init_logger from .src import globals as g
from .bindings.codemp import init_logger
CLIENT = None CLIENT = None
TEXT_LISTENER = None TEXT_LISTENER = None

View file

@ -4,8 +4,8 @@ use tokio::sync::{mpsc, Mutex, RwLock};
use tracing; use tracing;
use tracing_subscriber; use tracing_subscriber;
use codemp::errors::Error as CodempError; use ::codemp::errors::Error as CodempError;
use codemp::prelude::*; use ::codemp::prelude::*;
use codemp_proto::{ use codemp_proto::{
common::Identity, common::Identity,
cursor::{CursorEvent, CursorPosition}, cursor::{CursorEvent, CursorPosition},
@ -536,7 +536,7 @@ impl PyTextChange {
/* ------ Python module --------*/ /* ------ Python module --------*/
#[pymodule] #[pymodule]
fn codemp_client(_py: Python, m: &PyModule) -> PyResult<()> { fn codemp(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(codemp_init, m)?)?; m.add_function(wrap_pyfunction!(codemp_init, m)?)?;
m.add_function(wrap_pyfunction!(init_logger, m)?)?; m.add_function(wrap_pyfunction!(init_logger, m)?)?;
m.add_class::<PyClient>()?; m.add_class::<PyClient>()?;

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import Optional from typing import Optional
from Codemp.bindings.codemp_client import codemp_init, PyCursorEvent, PyTextChange, PyId from ..bindings.codemp import codemp_init, PyCursorEvent, PyTextChange, PyId
###################################################################################### ######################################################################################
# These are helper wrappers, that wrap the coroutines returned from the # These are helper wrappers, that wrap the coroutines returned from the