We are pleased to announce that Conan 1.39 has been released and brings some
significant new features and bug fixes. One of the most important features is the new syntax for aliases
that we have backported from 2.0 to 1.39. We have added a new
--require-override argument to define
dependency overrides directly on the command line. Also, for the new toolchains and generators, you can
set the new
win_bash property in the ConanFile to enable running commands in a bash shell in
Windows. We have a new VCVars generator that creates a batch script that will activate the
Visual Studio Developer Command Prompt. Finally, the new
Environment model comes with several
Aliases syntax from 2.0 backported to 1.39
Current alias syntax is problematic as they are impossible to distinguish from any other requirement. Because of this, we have introduced a new explicit syntax for Conan 2.0 that we are now backporting to 1.39. Porting this syntax to the current Conan version will also make the transition of recipes smoother.
The new syntax adds
() characters (in a similar way that the
 brackets do for version ranges
definition) to indicate that we are requiring an alias:
class MyPkg(ConanFile): # With the previous syntax youn can't know if it's an alias upfront: # requires = "boost/latest@mycompany/stable" # New experimental syntax is explicit: requires = "boost/(latest)@mycompany/stable"
If you want to read the original proposal for the new aliases syntax, please check the pull request in the Conan 2.0 Tribe GitHub repository.
New –require-override CLI argument
conan install command has a new
--require-override argument. Setting this argument is
equivalent to declaring
overrides=True when adding a
require. This can be
very convenient to test things during development, but for production it is better to update the
conanfiles to explicitly reflect in code which specific versions upstream are used.
You can use it like:
conan install mypkg/1.0@ --require-override=zlib/1.2.11
That is equivalent to declare this in the conanfile.py:
New self.win_bash mechanism
There’s a new
self.win_bash attribute for the ConanFile that supersedes the “classic”
to run commands inside a Windows subsystem. Setting
True will run all the
self.run() commands in the ConanFile inside a bash shell. Also, this will only happen for Windows
so there’s no need to check the platform in recipes.
The new subsystem model is explicit and there’s no more auto-detection. To set the path to bash.exe and the type of subsystem, please use these new configuration variables:
tools.microsoft.bash:subsystem: msys2, cygwin, msys or wsl. tools.microsoft.bash:path: C:/Path/To/Bash.exe
New conan.tools.microsoft.VCVars generator
We have also added a new VCVars generator that generates a file called conanvcvars.bat that activates the Visual Studio developer command prompt according to the current settings by wrapping the vcvarsall Microsoft bash script.
You can use it in your conanfile.py
class MyPkg(ConanFile): generators = "VCVars"
Note that this generator runs the conanvcvars.bat script by default. This can be controlled setting the
auto_activate argument in the
generate method. Please read more about
this in the
Several improvements in the new Environment model
Environment objects implement
Also, a unique environment
named conanenv.bat/sh is now generated to aggregate all the environment generators
(VirtualRunEnv, VirtualBuildEnv, AutotoolsToolchain, and AutotoolsDeps) so you can easily
activate all of them with just one command.
Besides the items listed above, there were some minor bug fixes you may wish to read about. If so, please refer to the changelog for the complete list.
We hope you enjoy this release, and look forward to your feedback.