On 8/2/19 5:33 pm, Sebastian Huber wrote: > On 08/02/2019 07:29, Sebastian Huber wrote: >> On 07/02/2019 18:28, Chris Johns wrote: >>> On 8/2/19 11:09 pm, Sebastian Huber wrote: >>>> After the update I get: >>>> >>>> File "/home/EB/sebastian_h/git-rtems-docs/wscript", line 67, in build >>>> ver_version, ver_date, ver_released = version.get(ctx, >>>> rtems_major_version) >>>> AttributeError: 'module' object has no attribute 'get' >>> It works on MacOS, FreeBSD 11.2-p5 and sync.rtems.org (docs.rtems.org shows >>> the >>> patch I pushed built). >>> >>> I wonder if you are loading a different `version.py`. >>> >>> On MacOS with Python2 I have: >>> >>> $ python >>> Python 2.7.10 (default, Aug 17 2018, 19:45:58) >>> [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin >>> Type "help", "copyright", "credits" or "license" for more information. >>>>>> import sys >>>>>> import os.path >>>>>> sys.path.append(os.path.abspath('common')) >>>>>> import version >>>>>> version.__file__ >>> '/Users/chris/development/rtems/docs/rtems-docs.git/common/version.pyc' >>>>>> version.__dict__['get'] >>> <function get at 0x107b69410> >>> >>> And on FreeBSD 11.2-p5 with python3 I have: >>> >>> $ python3 >>> Python 3.6.6 (default, Oct 2 2018, 01:22:29) >>> [GCC 4.2.1 Compatible FreeBSD Clang 6.0.0 (tags/RELEASE_600/final 326565)] >>> on >>> freebsd11 >>> Type "help", "copyright", "credits" or "license" for more information. >>>>>> import sys >>>>>> import os.path >>>>>> sys.path.append(os.path.abspath('common')) >>>>>> import version >>>>>> version.__file__ >>> '/opt/work/chris/rtems/docs/rtems-docs.git/common/version.py' >>>>>> version.__dict__['get'] >>> <function get at 0x8007b7730> >>> >>> What are you seeing? >> >> Yes, there seems to be a conflict with another version module: >> >> python >> Python 2.7.14 (default, Oct 12 2017, 15:50:02) [GCC] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> import os.path >> >>> sys.path.append(os.path.abspath('common')) >> >>> import version >> >>> version.__file__ >> '/usr/lib64/python2.7/site-packages/PIL/version.pyc' ^^^ >> >>> version.__dict__['get'] >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> KeyError: 'get' >> >> The module concept is not really the greatest thing in Python.
I would not blame python for a package using `version` as a module name installed in site-packages and I suppose PIL is in the sys.path. I have done some pretty interesting things with Python modules in some projects and I think it is a solid design. >> > > It works if I use: > > sys.path.insert(0, os.path.abspath('common')) > Yeah this is simplest and smallest fix so please commit and push it. Thinking about this maybe the sys.path hack is a poor option. I am wondering if: from common import waf as doc_waf from common import version This ripples out into all the `wscripts`. I feel this is the most robust solution however it is a number of changes. If you push the change I can clean it up. Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel