[devel at bb.net] Request for Python 3 porting help: master.cfg not in PYTHONPATH

Craig Rodrigues rodrigc at crodrigues.org
Wed Feb 1 07:21:07 UTC 2017


Hi,

I followed these steps to set up a Python 3.6 build environment:

https://lists.buildbot.net/pipermail/devel/2017-February/012310.html

If invoke trial like this:

trial buildbot.test.unit.test_scripts_checkconfig.TestConfigLoader

then these two tests fail:
test_success_import_packagetest_success_imports

The weird thing is if I run all the tests individually they pass.

I focused on the test_success_imports case to track the problem down.

That test does the following:

(1)  creates a minimal file othermodule.py in some directory
(2)  creates a master.cfg file in the same directory, with a line that does:
          "from othermodule import ...."
(3)  reads the master.cfg file via the buildbot functions

It works fine on Python 2, but fails in this weird way with Python 3.

I traced the problem down to the loadConfigDict() function here:

https://github.com/buildbot/buildbot/blob/master/master/buildbot/config.py#L103

What that function is supposed to do is:

(1)  Sets the '__file__' local environment variable to the full path of
master.cfg
(2)  Sets the basedir local environment variable to the full path of the
directory where
      master.cfg is located
(3)  Puts the basedir into sys.path
(4)  Reads master.cfg creating a big string, and then calls exec() on the
string.

For some reason, on Python 3, it cannot consistently find othermodule,
because othermodule was not in the PYTHONPATH used when originally
starting buildbot.

If I put othermodule.py into some directory in PYTHONPATH
separate from master.cfg, then this works on Python 3, but that is not
ideal.

I spent a lot of time trying to figure out how to fix this,
but couldn't get anything to work.

If someone can help, that would be great!!

--
Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/devel/attachments/20170131/daeff57b/attachment.html>


More information about the devel mailing list