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

Commit

Permalink
Remove attempting to install a local yapf package because it was too …
Browse files Browse the repository at this point in the history
…much trouble.
  • Loading branch information
dsherret committed Aug 14, 2020
1 parent b182bf7 commit cc3dac4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ jobs:
Dependencies:
1. Install python and pip
2. Ensure `python`/`python.exe` & pip is available on the path
3. Ensure dprint >= 0.9.0
1. Install python and pip and ensure they're on the path.
2. Install dprint's CLI >= 0.9.0
In *.dprintrc.json*:
Expand Down
16 changes: 7 additions & 9 deletions executable/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,19 @@ fn main() {
}

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

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

Expand Down
5 changes: 0 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import sys
import os
packages_dir = os.path.normpath(
os.path.dirname(os.path.realpath(__file__)) + "/packages")
sys.path.insert(0, str(packages_dir))

import argparse
import struct
import json
Expand Down

0 comments on commit cc3dac4

Please sign in to comment.