Compare commits

..

No commits in common. "d246913b4cbd3fae2e1acc4a45004b3ab108c1dc" and "0ef4aeb4f3a1f00346c6bf47edf5fbd02babadcd" have entirely different histories.

6 changed files with 4 additions and 2217 deletions

View File

@ -1,43 +0,0 @@
name: build and test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: 获取版本号
id: get_version
uses: sravinet/toml-select@v1.0.1
with:
file: ./ica-rs/Cargo.toml
field: "package.version"
- name: Setup Python
uses: actions/setup-python@v5.0.0
with:
# Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset.
python-version: 3.8
- name: Run tests
run: cargo test --verbose
- name: Build
run: cargo build --release
- name: 上传
uses: actions/upload-artifact@v2
with:
name: ica-rs-b${{ github.run_number }}-${{ steps.get_version.outputs.value }}-py38-win-x64
path: ./target/release/ica-rs.exe

5
.gitignore vendored
View File

@ -6,8 +6,3 @@ config.toml
*.pyc
*__pycache__/
# Added by cargo
/target

2146
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
[workspace]
members = [
"ica-rs"
]
resolver = "2"
[patch.crates-io]
rust_socketio = { git = "https://github.com/shenjackyuanjie/rust-socketio.git", branch = "mult_payload" }
# pyo3 = { git = "https://github.com/PyO3/pyo3.git", branch = "main" }

View File

@ -25,3 +25,7 @@ pyo3-asyncio = { version = "0.20.0", features = ["attributes", "tokio-runtime"]
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["time"] }
[patch.crates-io]
rust_socketio = { git = "https://github.com/shenjackyuanjie/rust-socketio.git", branch = "mult_payload" }
# pyo3 = { git = "https://github.com/PyO3/pyo3.git", branch = "main" }

View File

@ -141,20 +141,6 @@ pub fn get_change_time(path: &PathBuf) -> Option<SystemTime> {
path.metadata().ok()?.modified().ok()
}
pub fn py_module_from_code(content: &str, path: &str) -> PyResult<Py<PyAny>> {
Python::with_gil(|py| -> PyResult<Py<PyAny>> {
let module: PyResult<Py<PyAny>> = PyModule::from_code(
py,
&content,
&path,
&path,
// !!!! 请注意, 一定要给他一个名字, cpython 会自动把后面的重名模块覆盖掉前面的
)
.map(|module| module.into());
module
})
}
/// 传入文件路径
/// 返回 hash 和 文件内容
pub fn load_py_file(path: &PathBuf) -> std::io::Result<(Option<SystemTime>, String)> {