Bug 13030 - python bindings to dcerpc lack py3 __init_.py version
Summary: python bindings to dcerpc lack py3 __init_.py version
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.7.0rc5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jelmer Vernooij
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-13 10:10 UTC by Alexander Bokovoy
Modified: 2017-09-17 16:55 UTC (History)
0 users

See Also:


Attachments
fix for master (1.22 KB, patch)
2017-09-13 10:10 UTC, Alexander Bokovoy
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Bokovoy 2017-09-13 10:10:18 UTC
Created attachment 13591 [details]
fix for master

Description of problem:
`modutils.load_module_from_name()` is unable to load an existing package (samba.dcerpc in this case)

Version-Release number of selected component (if applicable):
python3-samba-4.7.0-0.10.rc5.fc26.x86_64 (see koji)
python3-astroid-1.5.3-1.fc26.noarch

How reproducible:
100%

Steps to Reproduce:
1. python3 -c 'import samba' && echo "yay"
2. python3 -c 'from astroid import modutils; modutils.load_module_from_name("samba.dcerpc")' && echo "yay"

Actual results:
1. "yay" is printed
2. Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/astroid/modutils.py", line 190, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/usr/lib/python3.6/site-packages/astroid/modutils.py", line 232, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = imp.find_module(part, path)
  File "/usr/lib64/python3.6/imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'dcerpc'

Expected results:
"yay" being printed in both steps 1. and 2.

(10:28:47 AM) ab: slaznick: looks like this particular issue is a build issue in samba build. We have
(10:28:49 AM) ab: * installing source4/librpc/rpc/dcerpc.py as /builddir/build/BUILDROOT/samba-4.7.0-0.10.rc5.fc27.x86_64/usr/lib64/python2.7/site-packages/samba/dcerpc/__init__.py
(10:29:13 AM) ab: but we don't have a similar one for 3.6
(10:29:28 AM) ab: in https://kojipkgs.fedoraproject.org//packages/samba/4.7.0/0.10.rc5.fc27/data/logs/x86_64/build.log
(10:29:48 AM) slaznick: ab: ah ha, you're right, there's no such file
(10:30:12 AM) ab: and astroid does this:
(10:30:14 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc/__init__.py", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:15 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc/__init__.pyc", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:17 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.cpython-36m-x86_64-linux-gnu.so", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:18 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.abi3.so", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:20 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.so", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:21 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.py", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
(10:30:23 AM) ab: stat("/usr/lib64/python3.6/site-packages/samba/dcerpc.pyc", 0x7ffc6006a3b0) = -1 ENOENT (No such file or directory)
Comment 1 Stefan Metzmacher 2017-09-17 16:55:56 UTC
Pushed to v4-7-test with review from slow@samba.org