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 43d55e3143
commit 7712d68cb5
7 changed files with 35 additions and 23 deletions

View file

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

View file

@ -0,0 +1 @@
f629b2a823b8f4d351a4641f0f42bf84f95406c8

View file

@ -0,0 +1 @@
5f1dfe7e8371de1f4967223a801cf49286065133

View file

@ -1,18 +1,27 @@
#!/bin/sh
ROOT_DIR="$(pwd)"
BUILD_DIR="$ROOT_DIR/target/debug/deps"
FILENAME="libcodemp_client"
BUILD_DIR="$ROOT_DIR/target/debug/"
WHEEL_DIR="$ROOT_DIR/target/wheels"
FILENAME="libcodemp"
TARGET_DIR="$ROOT_DIR/bindings"
TARGET_NAME="codemp_client"
SO_NAME="codemp"
WHEEL_NAME="Codemp_Sublime"
PYO3_PYTHON="$(pyenv which python)"
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
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_plugin
from Codemp.src.codemp_client import VirtualClient
from Codemp.src.codemp_client import CodempLogger
from Codemp.src.TaskManager import rt
from Codemp.src.utils import status_log
from Codemp.src.utils import safe_listener_detach
from Codemp.src.utils import get_contents
from Codemp.src.utils import populate_view
from Codemp.src.utils import get_view_from_local_path
import Codemp.src.globals as g
from Codemp.bindings.codemp_client import init_logger
# import os
# import sys
# import importlib.util
from .src.codemp_client import VirtualClient
from .src.codemp_client import CodempLogger
from .src.TaskManager import rt
from .src.utils import status_log
from .src.utils import safe_listener_detach
from .src import globals as g
from .bindings.codemp import init_logger
CLIENT = None
TEXT_LISTENER = None

View file

@ -4,8 +4,8 @@ use tokio::sync::{mpsc, Mutex, RwLock};
use tracing;
use tracing_subscriber;
use codemp::errors::Error as CodempError;
use codemp::prelude::*;
use ::codemp::errors::Error as CodempError;
use ::codemp::prelude::*;
use codemp_proto::{
common::Identity,
cursor::{CursorEvent, CursorPosition},
@ -536,7 +536,7 @@ impl PyTextChange {
/* ------ Python module --------*/
#[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!(init_logger, m)?)?;
m.add_class::<PyClient>()?;

View file

@ -1,6 +1,6 @@
from __future__ import annotations
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