Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e9989e

Browse files
Merge pull request clearloop#13 from hulufei/pyo-feature
Make programmable support to be an advanced feature
2 parents 2b54347 + f43e67d commit 0e9989e

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

‎Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ keyring = "0.8.0"
2626
log = "0.4"
2727
openssl = "0.10.26"
2828
rand = "0.7.2"
29-
serde = "1.0.104"
30-
serde_derive = "1.0.104"
29+
serde = { version = "1.0.104", features = ["derive"] }
3130
serde_json = "1.0.44"
32-
pyo3 = "0.8.5"
31+
pyo3 = { version = "0.8.5", optional = true }
3332
toml = "0.5.5"
3433
escaper = "0.1.0"
3534

@@ -40,3 +39,6 @@ features = ["sqlite"]
4039
[dependencies.reqwest]
4140
version = "0.10.3"
4241
features = ["blocking", "gzip", "json"]
42+
43+
[features]
44+
pym = ["pyo3"]

‎src/cmds/list.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,12 @@ impl Command for ListCommand {
132132

133133
// filtering...
134134
// pym scripts
135-
if m.is_present("plan") {
136-
let ids = crate::pym::exec(m.value_of("plan").unwrap_or(""))?;
137-
crate::helper::squash(&mut ps, ids)?;
135+
#[cfg(feature = "pym")]
136+
{
137+
if m.is_present("plan") {
138+
let ids = crate::pym::exec(m.value_of("plan").unwrap_or(""))?;
139+
crate::helper::squash(&mut ps, ids)?;
140+
}
138141
}
139142

140143
// filter tag

‎src/cmds/pick.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ impl Command for PickCommand {
7878

7979
// filtering...
8080
// pym scripts
81-
if m.is_present("plan") {
82-
let ids = crate::pym::exec(m.value_of("plan").unwrap_or(""))?;
83-
crate::helper::squash(&mut problems, ids)?;
81+
#[cfg(feature = "pym")]
82+
{
83+
if m.is_present("plan") {
84+
let ids = crate::pym::exec(m.value_of("plan").unwrap_or(""))?;
85+
crate::helper::squash(&mut problems, ids)?;
86+
}
8487
}
8588

8689
// tag filter

‎src/err.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl std::convert::From<openssl::error::ErrorStack> for Error {
124124
}
125125

126126
// pyo3
127+
#[cfg(feature = "pym")]
127128
impl std::convert::From<pyo3::PyErr> for Error {
128129
fn from(_: pyo3::PyErr) -> Self {
129130
Error::ScriptError("Python script went Error".to_string())

‎src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ pub mod err;
252252
pub mod flag;
253253
pub mod helper;
254254
pub mod plugins;
255+
#[cfg(feature = "pym")]
255256
pub mod pym;
256257

257258
// re-exports

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /