Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Conan build command does not support conanfile.txt as described #13198

Closed
uilianries opened this issue Feb 23, 2023 · 3 comments · Fixed by #13211
Closed

[bug] Conan build command does not support conanfile.txt as described #13198

uilianries opened this issue Feb 23, 2023 · 3 comments · Fixed by #13211
Assignees
Labels
bug component: ux No changes to core business logic good first issue
Milestone

Comments

@uilianries
Copy link
Member

uilianries commented Feb 23, 2023

Description

The documentation about build command says:

usage: conan build [-h] [-v [V]] [--logger] [--name NAME] [--version VERSION] [--user USER] [--channel CHANNEL] [-of OUTPUT_FOLDER] [-b BUILD] [-r REMOTE | -nr] [-u] [-o OPTIONS_HOST] [-o:b OPTIONS_BUILD] [-o:h OPTIONS_HOST] [-pr PROFILE_HOST] [-pr:b PROFILE_BUILD]
                   [-pr:h PROFILE_HOST] [-s SETTINGS_HOST] [-s:b SETTINGS_BUILD] [-s:h SETTINGS_HOST] [-c CONF_HOST] [-c:b CONF_BUILD] [-c:h CONF_HOST] [-l LOCKFILE] [--lockfile-partial] [--lockfile-out LOCKFILE_OUT] [--lockfile-packages] [--lockfile-clean]
                   [path]

Install dependencies and call the build() method.

positional arguments:
  path                  Path to a folder containing a recipe (conanfile.py or conanfile.txt) or to a recipe file. e.g., ./my_project/conanfile.txt.

However, conanfile.txt is not acceptable by build command.

As the documentation is extracted from the command output, it should be fixed on Conan client first.

Environment details

  • Operating System+version: OSX 13
  • Compiler+version: Apple-Clang 14
  • Conan version: 2.0.0
  • Python version: 3.10

Steps to reproduce

  1. mkdir /tmp/foo && cd /tmp/foo
  2. echo "[requires]\nzlib/1.2.13" > conanfile.txt
  3. conan build .
  4. Or, conan build ./conanfile.txt

Logs

% conan build .
ERROR: Conanfile not found at /private/tmp/foo/conanfile.py

% conan build ./conanfile.txt   
ERROR: A conanfile.py is needed, /private/tmp/conantxt/conanfile.txt is not acceptable
@memsharded memsharded added this to the 2.0.1 milestone Feb 23, 2023
@memsharded memsharded added bug component: ux No changes to core business logic good first issue labels Feb 23, 2023
@AbrilRBS
Copy link
Member

Anyone wanting to take a stab at this, I'll give some pointers:

  • Conan commands live under conan/cli/commands
  • Conan uses argparse for its CLI interaction
  • The solution for this one is easy: we do require it to be a .py file, so the help text suggesting that .txt files in the command are valid is wrong, and should be changed, but as I'm not an enligh native speaker, I'll let you choose the best wording :)
  • If the PR you open has failing tests, do not worry! Some tests might rely on CLI output, we can fix those after the fact

@kammce
Copy link
Contributor

kammce commented Feb 23, 2023

I can take a stab at it 😄

@memsharded
Copy link
Member

Amazing! thanks for the offer @kammce !

kammce added a commit to kammce/conan that referenced this issue Feb 23, 2023
Change conan build argument description for "path" to indicate it is
for conanfile.py and explicitly state that it does not work with
conanfile.txt

Resolves conan-io#13198
kammce added a commit to kammce/conan that referenced this issue Feb 23, 2023
Change conan build argument description for "path" to indicate it is
only for conanfile.py and explicitly state that it does not work with
conanfile.txt.

Resolves conan-io#13198
memsharded pushed a commit that referenced this issue Feb 23, 2023
Change conan build argument description for "path" to indicate it is
only for conanfile.py and explicitly state that it does not work with
conanfile.txt.

Resolves #13198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: ux No changes to core business logic good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants