Ver código fonte

Put the obtained sdist in a useful location

default_compile_flags
vector-of-bool 5 anos atrás
pai
commit
0d23ff3146
2 arquivos alterados com 25 adições e 11 exclusões
  1. +23
    -11
      src/dds/dds.main.cpp
  2. +2
    -0
      tests/catalog/get_test.py

+ 23
- 11
src/dds/dds.main.cpp Ver arquivo

@@ -47,8 +47,8 @@ struct toolchain_flag : string_flag {
}
};

struct repo_where_flag : path_flag {
repo_where_flag(args::Group& grp)
struct repo_path_flag : path_flag {
repo_path_flag(args::Group& grp)
: path_flag{grp,
"dir",
"Path to the DDS repository directory",
@@ -155,7 +155,14 @@ struct cli_catalog {
cli_catalog& parent;
args::Command cmd{parent.cat_group, "get", "Obtain an sdist from a catalog listing"};

catalog_path_flag path{cmd};
catalog_path_flag path{cmd};

path_flag out{cmd,
"out",
"The directory where the source distributions will be placed",
{"out-dir", 'o'},
dds::fs::current_path()};

args::PositionalList<std::string> requirements{cmd,
"requirement",
"The package IDs to obtain"};
@@ -167,9 +174,14 @@ struct cli_catalog {
auto info = cat.get(id);
if (!info) {
throw std::runtime_error(
fmt::format("No package in the catalog matched the given ID"));
fmt::format("No package in the catalog matched the ID '{}'", req));
}
dds::get_package_sdist(*info);
auto tsd = dds::get_package_sdist(*info);
auto out_path = out.Get();
auto dest = out_path / id.to_string();
spdlog::info("Create sdist at {}", dest.string());
dds::fs::remove_all(dest);
dds::safe_rename(tsd.sdist.path, dest);
}
return 0;
}
@@ -204,7 +216,7 @@ struct cli_repo {
args::Command cmd{base.cmd_group, "repo", "Manage the package repository"};
common_flags _common{cmd};

repo_where_flag where{cmd};
repo_path_flag where{cmd};

args::Group repo_group{cmd, "Repo subcommands"};

@@ -324,8 +336,8 @@ struct cli_sdist {

common_project_flags project{cmd};

repo_where_flag repo_where{cmd};
args::Flag force{cmd,
repo_path_flag repo_where{cmd};
args::Flag force{cmd,
"replace-if-exists",
"Replace an existing export in the repository",
{"replace"}};
@@ -477,8 +489,8 @@ struct cli_deps {
"Ensure we have local copies of the project dependencies"};
common_flags _common{cmd};

repo_where_flag repo_where{cmd};
path_flag remote_listing_file{
repo_path_flag repo_where{cmd};
path_flag remote_listing_file{
cmd,
"remote-listing",
"Path to a file containing listing of remote sdists and how to obtain them",
@@ -539,7 +551,7 @@ struct cli_deps {
"If specified, will not generate an INDEX.lmi",
{"skip-lmi"}};

repo_where_flag repo_where{cmd};
repo_path_flag repo_where{cmd};

toolchain_flag tc_filepath{cmd};


+ 2
- 0
tests/catalog/get_test.py Ver arquivo

@@ -31,3 +31,5 @@ def test_get(dds: DDS):
dds.catalog_import(cat_path, json_path)

dds.catalog_get(cat_path, 'neo-sqlite3@0.2.2')
assert (dds.source_root / 'neo-sqlite3@0.2.2').is_dir()
assert (dds.source_root / 'neo-sqlite3@0.2.2/package.dds').is_file()

Carregando…
Cancelar
Salvar