Skip to content

Add missing install/__init__.py so build_hostapd import resolves - #47

Open
fvsion wants to merge 1 commit into
InfamousSYN:masterfrom
fvsion:fix/install-package-init
Open

Add missing install/__init__.py so build_hostapd import resolves#47
fvsion wants to merge 1 commit into
InfamousSYN:masterfrom
fvsion:fix/install-package-init

Conversation

@fvsion

@fvsion fvsion commented Aug 13, 2026

Copy link
Copy Markdown

Problem

install.py aborts at import time on every platform at master HEAD, before doing any work:

$ sudo python3 install.py
  File "install.py", line 5, in <module>
    from install import build_hostapd
  File "install.py", line 5, in <module>
    from install import build_hostapd
ImportError: cannot import name 'build_hostapd' from 'install' (consider renaming
'install.py' if it has the same name as a library you intended to import)

Note the traceback hits line 5 twice — install.py is importing itself.

Cause

install.py:5 does from install import build_hostapd, but install/ ships no __init__.py, so it is only a namespace package. In Python's import resolution a regular module outranks a namespace package, so install resolves to install.py, which has no build_hostapd attribute.

Introduced in ceaeae0, which added the import together with install/build_hostapd.py.

Why CI didn't catch it

.github/workflows/install.yml triggers on pull_request to master (plus workflow_dispatch). ceaeae0 landed directly on master, so the install job never ran against it.

Fix

Add an empty install/__init__.py, making install/ a regular package — which then outranks install.py and resolves correctly. This matches the existing convention: ., core/ and core/libs/ all ship one.

Verification

Built on Kali rolling (arm64) and ran the same three steps as install.yml:

  • python3 install.py — apt deps, pip deps, hostapd-wpe v2.11 compiled from source to core/vendor/bin/hostapd-wpe, runtime dirs created
  • python3 rogue.py --help — v3.5.1 launches
  • python3 rogue.py --cert-wizard — full CA chain generated, server.pem: OK

KARMA patch confirmed applied in the built binary (rogue_karma symbol present, -k added to the getopt string).


🤖 Generated with Claude Code

install.py does `from install import build_hostapd`, but install/ has no
__init__.py, so it is only a namespace package. In Python's import
resolution a regular module outranks a namespace package, so `install`
resolves to install.py itself -- which has no build_hostapd attribute:

    File "install.py", line 5, in <module>
        from install import build_hostapd
    File "install.py", line 5, in <module>
        from install import build_hostapd
    ImportError: cannot import name 'build_hostapd' from 'install'

install.py therefore aborts at import time, before doing any work, on
every platform. Adding the empty __init__.py makes install/ a regular
package, which then takes precedence and resolves correctly. This also
matches the existing convention: ., core/ and core/libs/ all ship one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant