Skip to content

Add a gidocgen/__main__.py

FeRD (Frank Dana) requested to merge ferdnyc/gi-docgen:dunder-main into main

This allows gidocgen to be run with:

python3 -m gidocgen

avoiding ambiguity about whether the correct Python binary is being used to execute the module. (A problem with scripts like gi-docgen.py, especially in venvs, is that their shebang lines will run the wrong interpreter, and their sys.path manipulations can end up failing to pull in the correct module.)

The __main__.py is basically a neutered version of gi-docgen.py with the sys.path manipulations removed (unnecessary as it's guaranteed to be executing inside the package, and uses relative imports), and only thy Python version check remaining.

Merge request reports