Warning: This is only a quick reply after some investigation. I would have to delve deeper to figure out more of the why things are the way they are (for better or worse)..

On Mon, Feb 13, 2017 at 9:35 AM, Stefan Seefeld via Boost-build <boost-build@lists.boost.org> wrote:
Hello,

having learned a bit more about Boost.Build and its internals, I'm
trying to apply my understanding.


My user-config.jam file contains

  using python : 2.7 ;
  using pyhon : 3.5 ;

Then I issue this command:

  ./b2 --with-python python=2.7


Inside my Jamfile, I see that `feature.values python` reports "2.7 3.5",
independently on what I specify on the command-line.

The "python" feature is composed of *all* the configured version of python. If you had no python installed or configured it would be empty. 
 
So it seems I'm
missing something:

What is b2's interpretation of the above user-config.jam file ?

It configures two python interpreters, and potentially libraries and headers.
 
And what does it mean to provide the `python=2.7` option on the
command-line ?

It means to add the "<python>2.7" as a build request to match against the targets to build.
 
How can I specify that I want to

* build with Python 2.7 only

You can't [1].
 
* build with Python 3.5 only

You can't [1]
 
* build both variants at the same time

[1] The way the BPL build file is written by default it builds both a 2 and 3 version of the library if both a 2 and 3 python version are configured. Now.. Theoretically it would be possible that specifying the version on the command would limit it to just that version to build. But it seems that the way the python.jam module sets up python libraries it fails to trigger the b2 target requirements selection mechanics. Or simply put.. It's broken. And I don't know entirely why yet. I'll keep looking at it so see if I can resolve this better eventually.

--
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net
-- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail