conan create . fails: ERROR: conanfile didn't specify version

200 views Asked by At

Conan version: 2.0.13

I have a conan recipe where I define the set_version() method to set my package version based on an external script.

When I try to generate the package by doing

conan create .

I get the next error:

ERROR: conanfile didn't specify version

It seems that I must use --version flag for it to work and that set_version() is not called.

  1. --version is an optional parameter of conan
  2. set_version() method is defined in conanfile
  3. For what I know, set_version() will be automatically called when doing conan create or conan export

What am I missing?

(EDIT)

    def set_version(self):
        if self.version:
            return
        version_script = self.recipe_folder / "scripts" / "version"
        self.version = check_output([version_script], text=True).strip()
0

There are 0 answers