Skip to content

Commit

Permalink
add --pip-check option
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Feb 20, 2024
1 parent 0bb161e commit cf01032
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/build.er
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ac = import "ansicolor"

.build! cfg: Config =
start = time!()
vers = download_dependencies_on_demand!()
vers = download_dependencies_on_demand! cfg
cmd = .compile_command! vers
print! "\{ac.GREEN}Building\{ac.RESET}: \{cfg.project_root.stem}"
metadata = load_package_er_as_json!()
Expand Down
2 changes: 2 additions & 0 deletions src/cfg.er
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ sys = pyimport "sys"
.no_verify = Bool;
.allow_dirty = Bool;
.certified = Bool;
.pip_check = Bool;
.args = Array(Str);
}
.Config.
Expand All @@ -23,6 +24,7 @@ sys = pyimport "sys"
.lib = "--lib" in sys.argv;
.no_verify = "--no-verify" in sys.argv;
.allow_dirty = "--allow-dirty" in sys.argv;
.pip_check = "--pip-check" in sys.argv;
.certified = "--certified" in sys.argv;
.args = sys.argv[1..10000];
}
2 changes: 1 addition & 1 deletion src/check.er
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ac = import "ansicolor"

.check!(cfg: Config) =
start = time!()
vers = download_dependencies_on_demand!()
vers = download_dependencies_on_demand! cfg
print! "\{ac.GREEN}Checking\{ac.RESET}: \{cfg.project_root.stem}"
metadata = load_package_er_as_json!()
if! metadata.get("pre_build") isnot! None, do!:
Expand Down
5 changes: 3 additions & 2 deletions src/download.er
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sub = pyimport "subprocess"
{SemVer;} = import "semver"
ac = import "ansicolor"

{Config;} = import "cfg"
{load_package_er_as_json!; load_er_as_json!} = import "metadata"

erg_path = os.environ.get("ERG_PATH", os.path.expanduser!("~") + "/.erg")
Expand Down Expand Up @@ -245,11 +246,11 @@ get_latest_version!(name: Str, path: Str or NoneType): SemVer =
make_lock_file! deps
deps

.download_dependencies_on_demand!() =
.download_dependencies_on_demand!(cfg: Config) =
deps = .Versions!.from_package_lock_er!()
if! deps != None:
do!:
deps.install_if_not_exists! False
deps.install_if_not_exists! cfg.pip_check
deps
do! .download_dependencies!()

Expand Down
1 change: 1 addition & 0 deletions src/initializ.er
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ initialize_tests! cfg: Config, path: PathLike =
.no_verify = cfg.no_verify;
.allow_dirty = cfg.allow_dirty;
.certified = cfg.certified;
.pip_check = cfg.pip_check;
.args = cfg.args;
}
.initialize! cfg_, "."
Expand Down
1 change: 1 addition & 0 deletions src/install.er
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ To use it as a dependency, add it to the "dependencies" list in the package.er f
.no_verify = cfg.no_verify;
.allow_dirty = cfg.allow_dirty;
.certified = cfg.certified;
.pip_check = cfg.pip_check;
.args = cfg.args;
})
.install_local! build_cfg
Expand Down
2 changes: 1 addition & 1 deletion src/publish.er
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ create_pr! cfg: Config, user_name, metadata =
discard sub.run! ["git", "checkout", "main"], capture_output:=True

.publish! cfg: Config =
discard download_dependencies_on_demand!()
discard download_dependencies_on_demand! cfg
check_commit! cfg
metadata = load_package_er_as_json!()
assert metadata in {Str: Str or Array(Str) or Record}
Expand Down
2 changes: 1 addition & 1 deletion src/test.er
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exc = import "exception"
{load_package_er_as_json!;} = import "metadata"

.test! cfg: Config =
discard download_dependencies_on_demand!()
discard download_dependencies_on_demand! cfg
metadata = load_package_er_as_json!()
files = sorted os.listdir! "tests"
n_tests = !0
Expand Down

0 comments on commit cf01032

Please sign in to comment.