diff --git a/lib/python/Makefile b/lib/python/Makefile index 0f40d6534bb..083a390c7a2 100644 --- a/lib/python/Makefile +++ b/lib/python/Makefile @@ -22,8 +22,7 @@ $(GDIR): $(PYDIR) $(DSTDIR): $(GDIR) test -d $@ || $(MKDIR) -p $@ - test -f __init__.py || touch $(GDIR)/__init__.py - @echo "import script" >> $(GDIR)/__init__.py + @cat grass__init__.py > $(GDIR)/__init__.py $(DSTDIR)/%: % $(INSTALL_DATA) $< $@ diff --git a/lib/python/__init__.py b/lib/python/__init__.py index 5dcae136a17..5110882a5f9 100644 --- a/lib/python/__init__.py +++ b/lib/python/__init__.py @@ -2,4 +2,3 @@ from db import * from raster import * from vector import * - diff --git a/lib/python/grass__init__.py b/lib/python/grass__init__.py new file mode 100644 index 00000000000..10050a91035 --- /dev/null +++ b/lib/python/grass__init__.py @@ -0,0 +1,4 @@ +import os +__all__ = ["script"] +if os.path.exists(os.path.join(os.path.dirname(__file__), "lib", "__init__.py")): + __all__.append("lib") diff --git a/swig/python/Makefile b/swig/python/Makefile index 7aeee36d503..061db95049b 100644 --- a/swig/python/Makefile +++ b/swig/python/Makefile @@ -65,8 +65,6 @@ $(GDIR): $(PYDIR) $(DSTDIR): $(GDIR) test -d $@ || $(MKDIR) -p $@ - test -f __init__.py || touch $(GDIR)/__init__.py - @echo "import lib" >> $(GDIR)/__init__.py $(DSTDIR)/_%.so: _%.so $(INSTALL) $< $@