From 4caadadf205a97da25d6304665904d29693d9e4e Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Fri, 29 Sep 2023 23:51:00 +0300 Subject: [PATCH] add script and increment version --- bindings/python/Cargo.toml | 24 ++++++------- rookie-rs/Cargo.toml | 74 +++++++++++++++++++------------------- scripts/publish.py | 23 ++++++++++++ 3 files changed, 72 insertions(+), 49 deletions(-) create mode 100644 scripts/publish.py diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index 9e2a001..8eb1fea 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -1,13 +1,13 @@ -[package] -name = "rookiepy" -version = "0.1.2" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[lib] -name = "rookiepy" -crate-type = ["cdylib"] - -[dependencies] -pyo3 = "0.19.0" +[package] +name = "rookiepy" +version = "0.1.3" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +name = "rookiepy" +crate-type = ["cdylib"] + +[dependencies] +pyo3 = "0.19.0" rookie = { path = "../../rookie-rs" } \ No newline at end of file diff --git a/rookie-rs/Cargo.toml b/rookie-rs/Cargo.toml index 4eaadb4..0094c2b 100644 --- a/rookie-rs/Cargo.toml +++ b/rookie-rs/Cargo.toml @@ -1,37 +1,37 @@ -[package] -name = "rookie" -version = "0.1.2" -edition = "2021" -description = "Load cookie from your web browsers" -license-file = "MIT-LICENSE.txt" -homepage = "https://crates.io/crates/rookie" -documentation = "https://docs.rs/rookie/" -repository = "https://github.com/thewh1teagle/rookie" -readme = "README.md" -keywords = ["windows", "cookies", "rust", "web"] - -[lib] -name = "rookie" -path = "src/lib.rs" - -[[bin]] -name = "main" -path = "bin/main.rs" - -[dependencies] -aes-gcm = "0.10.3" -rusqlite = { version = "0.29.0", features = ["bundled"] } -rust-ini = "0.19.0" -serde = { version = "1.0.188", features = ["derive"] } -serde_json = "1.0.107" -url = "2.4.1" - -[target.'cfg(unix)'.dependencies] -bcrypt-pbkdf = "0.10.0" - -[target.'cfg(target_os = "macos")'.dependencies] -bcrypt-pbkdf = "0.10.0" - -[target.'cfg(windows)'.dependencies] -windows = { version = "0.51.1", features = ["Win32_Security_Cryptography", "Win32_Foundation"] } -base64 = "0.21.4" +[package] +name = "rookie" +version = "0.1.3" +edition = "2021" +description = "Load cookie from your web browsers" +license-file = "MIT-LICENSE.txt" +homepage = "https://crates.io/crates/rookie" +documentation = "https://docs.rs/rookie/" +repository = "https://github.com/thewh1teagle/rookie" +readme = "README.md" +keywords = ["windows", "cookies", "rust", "web"] + +[lib] +name = "rookie" +path = "src/lib.rs" + +[[bin]] +name = "main" +path = "bin/main.rs" + +[dependencies] +aes-gcm = "0.10.3" +rusqlite = { version = "0.29.0", features = ["bundled"] } +rust-ini = "0.19.0" +serde = { version = "1.0.188", features = ["derive"] } +serde_json = "1.0.107" +url = "2.4.1" + +[target.'cfg(unix)'.dependencies] +bcrypt-pbkdf = "0.10.0" + +[target.'cfg(target_os = "macos")'.dependencies] +bcrypt-pbkdf = "0.10.0" + +[target.'cfg(windows)'.dependencies] +windows = { version = "0.51.1", features = ["Win32_Security_Cryptography", "Win32_Foundation"] } +base64 = "0.21.4" diff --git a/scripts/publish.py b/scripts/publish.py new file mode 100644 index 0000000..41fcb8b --- /dev/null +++ b/scripts/publish.py @@ -0,0 +1,23 @@ +from pathlib import Path +import re + + +def increment_ver(version): + version = version.split('.') + version[2] = str(int(version[2]) + 1) + return '.'.join(version) + +cur = Path(__file__).parent +cargo_paths = [cur / '../rookie-rs', cur / '../bindings/python'] + + +for path in cargo_paths: + toml = path / 'cargo.toml' + content = toml.open('r').read() + pattern = 'version = "(.+)"[\S\s]edition = ".+"' + ver = re.search(pattern, content) + if ver: + new_ver = increment_ver(ver.group(1)) + new_content = re.sub(pattern, f'version = "{new_ver}"\nedition = "2021"', content) + with toml.open('w') as f: + f.write(new_content)