Skip to content
This repository was archived by the owner on Mar 27, 2022. It is now read-only.

Commit cc3dac4

Browse files
committed
Remove attempting to install a local yapf package because it was too much trouble.
1 parent b182bf7 commit cc3dac4

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

.github/workflows/ci.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ jobs:
153153
154154
Dependencies:
155155
156-
1. Install python and pip
157-
2. Ensure `python`/`python.exe` & pip is available on the path
158-
3. Ensure dprint >= 0.9.0
156+
1. Install python and pip and ensure they're on the path.
157+
2. Install dprint's CLI >= 0.9.0
159158
160159
In *.dprintrc.json*:
161160

executable/src/main.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,19 @@ fn main() {
2525
}
2626

2727
fn init() {
28+
// I tried getting this to work by installing a local yapf version,
29+
// but there seems to be some bugs in pip where it can't use the --target <dir path>
30+
// on linux without a --system flag. The --system flag then doesn't exist on
31+
// windows or mac, so it's just a pain and I'm not going to bother with it for now
2832
let exe_dir_path = get_exe_dir_path();
29-
let _ = Command::new("mkdir")
30-
.current_dir(&exe_dir_path)
31-
.args(&["packages"]);
3233
let result = Command::new("pip")
3334
.current_dir(&exe_dir_path)
34-
// needs --system because otherwise ubuntu errors
35-
// https://github.com/pypa/pip/issues/3826#issuecomment-427622702
36-
.args(&["install", "-Iv", "yapf==0.30.0", "--target", "packages", "--system"])
37-
.stderr(Stdio::inherit())
35+
.args(&["install", "yapf"])
36+
// .stderr(Stdio::inherit())
3837
.output();
3938

4039
if let Err(err) = result {
41-
eprintln!("[dprint-plugin-yapf]: {}", err.to_string());
42-
panic!("[dprint-plugin-yapf]: Failed to install yapf.");
40+
eprintln!("[dprint-plugin-yapf]: Failed to install yapf. You may need to run `pip install yapf` manually. {}", err.to_string());
4341
}
4442
}
4543

main.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
import sys
2-
import os
3-
packages_dir = os.path.normpath(
4-
os.path.dirname(os.path.realpath(__file__)) + "/packages")
5-
sys.path.insert(0, str(packages_dir))
6-
72
import argparse
83
import struct
94
import json

0 commit comments

Comments
 (0)