Closed vithalsm closed 10 months ago
I could surpass (or mask) the above error by adjusting the input value from the build.rs (listed below). I believe, problem is due to below code snippet, in which argument '-if' is used. Wondering whether it should be '-of' rather.
let output_dir = self.output_dir(); if let Some(output_dir) = &output_dir { let current_dir = env::current_dir()?.to_path_buf(); if output_dir != ¤t_dir { <<<<<< By passing same value as being derived here, skipped below lines where '-if' is being passed. args.extend(&["-if", output_dir.to_str().unwrap()]); } }
my build.rs >>>>>>>>>> fn main() { let conan_profile = "default"; let opts = ["sign", "True"]; let _cur_dir = env::current_dir().unwrap(); let _dest_path = Path::new(&_cur_dir);
let command = InstallCommandBuilder::new()
.with_profile(&conan_profile)
**.with_options(&opts)**
.build_policy(BuildPolicy::Missing)
.recipe_path(Path::new("conanfile.txt"))
**.output_dir(&_dest_path)**
.build();
New error observed:
Running `/home/vmohare/rust/rust-conan/target/debug/build/rust-conan-ab89c5392bdc9e1a/build-script-build`
[rust-conan 0.1.0] ERROR: not enough values to unpack (expected 2, got 1) [rust-conan 0.1.0] Traceback (most recent call last): [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conan/cli/cli.py", line 272, in main [rust-conan 0.1.0] cli.run(args) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conan/cli/cli.py", line 171, in run [rust-conan 0.1.0] command.run(self._conan_api, self._commands[command_argument].parser, args[0][1:]) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conan/cli/command.py", line 157, in run [rust-conan 0.1.0] info = self._method(conan_api, parser, *args) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conan/cli/commands/install.py", line 61, in install [rust-conan 0.1.0] profile_host, profile_build = conan_api.profiles.get_profiles_from_args(args) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conan/api/subapi/profiles.py", line 36, in get_profiles_from_args [rust-conan 0.1.0] profile_host = self.get_profile(profiles=host, settings=args.settings_host, [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conan/api/subapi/profiles.py", line 48, in get_profile [rust-conan 0.1.0] profile = loader.from_cli_args(profiles, settings, options, conf, cwd) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conans/client/profile_loader.py", line 131, in from_cli_args [rust-conan 0.1.0] args_profile = _profile_parse_args(settings, options, conf) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conans/client/profile_loader.py", line 385, in _profile_parse_args [rust-conan 0.1.0] result.options = Options.loads("\n".join(options or [])) [rust-conan 0.1.0] File "/home/vmohare/.local/lib/python3.8/site-packages/conans/model/options.py", line 275, in loads [rust-conan 0.1.0] name, value = line.split("=", 1) [rust-conan 0.1.0] ValueError: not enough values to unpack (expected 2, got 1) [rust-conan 0.1.0]
Fixed above issue, this is due to the way 'options' being sent to 'install' command. Help text needs to be adjusted.
@vithalsm , I believe I hit a similar problem as you.. and the fix was to remove the following line from the example
.with_option("sign", "True")
Seems that a PR would help the original author if you can confirm
Hi @EMCP, Yes, it can be removed. However, the right API is .with_options(...). Documentation needs to be fixed with name and signatures.
Hi,
I tried to use 'conan-rs' following the steps mentioned. However, I am getting an error as below:
[rust-conan 0.1.0] usage: conan install [-h] [-f FORMAT] [-v [V]] [--name NAME] [rust-conan 0.1.0] [--version VERSION] [--user USER] [--channel CHANNEL] [rust-conan 0.1.0] [--requires REQUIRES] [--tool-requires TOOL_REQUIRES] [rust-conan 0.1.0] [-b BUILD] [-r REMOTE | -nr] [-u] [-o OPTIONS_HOST] [rust-conan 0.1.0] [-o:b OPTIONS_BUILD] [-o:h OPTIONS_HOST] [rust-conan 0.1.0] [-pr PROFILE_HOST] [-pr:b PROFILE_BUILD] [rust-conan 0.1.0] [-pr:h PROFILE_HOST] [-s SETTINGS_HOST] [rust-conan 0.1.0] [-s:b SETTINGS_BUILD] [-s:h SETTINGS_HOST] [-c CONF_HOST] [rust-conan 0.1.0] [-c:b CONF_BUILD] [-c:h CONF_HOST] [-l LOCKFILE] [rust-conan 0.1.0] [--lockfile-partial] [--lockfile-out LOCKFILE_OUT] [rust-conan 0.1.0] [--lockfile-packages] [--lockfile-clean] [-g GENERATOR] [rust-conan 0.1.0] [-of OUTPUT_FOLDER] [--deploy DEPLOY] [rust-conan 0.1.0] [path] [rust-conan 0.1.0] conan install: error: unrecognized arguments: -if conanfile.txt [rust-conan 0.1.0] ERROR: Exiting with code: 2
Please let me know how to fix the same.