Skip to content
Snippets Groups Projects
  • Robin Jarry's avatar
    Fix individual modules import · 60579063
    Robin Jarry authored
    
    When using scapy as a third party library, we do not "benefit" from the
    loading routine that puts all symbols in the __builtin__ namespace. This
    implies that all modules must be "importable" without any errors for
    undefined symbols.
    
    This patch fixes importing every scapy module individually. Some
    circular imports were fixed (between inet6 and dhcp6).
    
    Most errors were detected by using pylint with the right configuration
    (scapy produces a *lot* of errors). Other errors were detected with the
    following shell script:
    
        export PYTHONPATH=".:$PYTHONPATH"
        for f in $(find scapy/ -name '*.py'); do
            f=${f%/__init__.py}
            module=$(echo ${f%.py} | sed 's,/,.,g')
            python -c "import $module; print $module"
        done
    
    Also, replace all implicit relative imports by absolute imports to avoid
    surprises with some python versions.
    
    Signed-off-by: default avatarRobin Jarry <robin.jarry@6wind.com>
    60579063