[Buildbot-devel] Escaping the slave virtualenv

Dustin J. Mitchell dustin at v.igoro.us
Thu Oct 30 01:18:04 UTC 2014


It really depends on how Nukita is invoking whatever eventually
requires the 'mercurial' module.

Vritualenvs aren't magic, and they don't actually involve modifying
PYTHONPATH.  The critical bit about a virtualenv is that modules are
loaded from sys.prefix, which is calculated from the location of the
Python executable.  Virtualenvs don't have to be "activated" - just
running the 'bin/python' from a virtualenv means that the resulting
process is executing in that virtualenv's environment.

All of which means that PATH is the critical environment variable to
look at, either as a way to find `python` or as a way to find some
other executable like `hg` which has a shebang line pointing to
python.

So, what python executable are you running?

Dustin

On Wed, Oct 29, 2014 at 4:51 PM, Vasily <vasslitvinov at pisem.net> wrote:
> Hi Kay,
>
> Did you try explicitly setting PYTHONPATH to empty string via
> env={'PYTHONPATH': ''} parameter for ShellCommand step?
>
> Did you try manually reproducing what you're seeing (with all the
> environment variables Buildbot so nicely dumps)?
>
> What Buildbot version (master / slave) are you using?
>
> Thanks,
> Vasily
>
> 29 окт. 2014 г. 20:51 пользователь "Kay Hayen" <kay.hayen at gmail.com>
> написал:
>>
>> Hello there,
>>
>> I am running Python tests which are supposed to run outside
>> of the slave virtualenv. But I have reasons to believe that even
>> if using /usr/bin/python, the PYTHONPATH is apparently still
>> set, is it? I am not seeing it in the build log:
>>
>> /usr/bin/python tests/mercurial/run_all.py search
>>  in dir /opt/buildbot/slave/mercurial-Py27/build (timeout 3600 secs)
>>  watching logfiles {}
>>  argv: ['/usr/bin/python', 'tests/mercurial/run_all.py', 'search']
>>  environment:
>>   COLUMNS=240
>>   CONSOLE=/dev/console
>>   HOME=/
>>   INIT_VERSION=sysvinit-2.88
>>   LINES=67
>>   OLDPWD=/
>>
>> PATH=/opt/buildbot/sandbox/bin:/usr/lib/ccache:/sbin:/usr/sbin:/bin:/usr/bin
>>   PREVLEVEL=N
>>   PS1=(sandbox)#
>>   PWD=/opt/buildbot/slave/mercurial-Py27/build
>>   PYTHON=/usr/bin/python2.7
>>   RUNLEVEL=2
>>   SHELL=/bin/sh
>>   TERM=linux
>>   VIRTUAL_ENV=/opt/buildbot/sandbox
>>   previous=N
>>   runlevel=2
>>
>> The PYTHON variable is from my "env". The VIRTUAL_ENV is definitely the
>> sandbox that runs Buildbot I am not seeing PYTHONPATH, I am not sure
>> if VIRTUAL_ENV has an impact on it.
>>
>> As a matter of fact, the job has an issue there:
>>
>> Nuitka:WARNING:/usr/bin/hg:29: Cannot find 'mercurial' as relative or
>> absolute import.
>>
>> which means "mercurial" is not in the PYTHONPATH. It is however, in the
>> default
>> system path of /usr/bin/python, and /usr/bin/hg finds it. Check this:
>>
>> Python 2.7.8 (default, Oct  7 2014, 22:02:06)
>> [GCC 4.9.1] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import mercurial
>> >>> mercurial.__path__
>> ['/usr/lib/python2.7/dist-packages/mercurial']
>>
>> Any help is welcome here. What I really want is to have shell commands run
>> that
>> escape the virtualenv, without solving that in the commands. That is
>> because I
>> also run tests (or at least intend to) inside virtualenv, to test that is
>> working fine
>> with Nuitka.
>>
>> Yours,
>> Kay
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Buildbot-devel mailing list
>> Buildbot-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>




More information about the devel mailing list