From d0a490be3765e3756db41aa88cb89530d6e08619 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 14 Apr 2022 18:31:56 +0000 Subject: [PATCH] Make sources around that we can run tests without location installed In order to run the test suite, we need to make the Python module loadable from the build directory so that we first of all test the right code and that it just works without running "make install" first. Signed-off-by: Michael Tremer --- .gitignore | 5 +-- Makefile.am | 37 ++++++++----------- po/POTFILES.in | 18 ++++----- .../{__init__.py.in => location/__init__.py} | 2 - src/python/{ => location}/database.py | 0 src/python/{ => location}/downloader.py | 0 src/python/{ => location}/export.py | 0 src/python/{ => location}/i18n.py | 0 src/python/{ => location}/importer.py | 0 src/python/{ => location}/logger.py | 0 src/{python => scripts}/location-importer.in | 0 src/{python => scripts}/location.in | 0 12 files changed, 26 insertions(+), 36 deletions(-) rename src/python/{__init__.py.in => location/__init__.py} (98%) rename src/python/{ => location}/database.py (100%) rename src/python/{ => location}/downloader.py (100%) rename src/python/{ => location}/export.py (100%) rename src/python/{ => location}/i18n.py (100%) rename src/python/{ => location}/importer.py (100%) rename src/python/{ => location}/logger.py (100%) rename src/{python => scripts}/location-importer.in (100%) rename src/{python => scripts}/location.in (100%) diff --git a/.gitignore b/.gitignore index f04b70e..20bc895 100644 --- a/.gitignore +++ b/.gitignore @@ -15,9 +15,8 @@ Makefile.in /*.db.xz /libtool /stamp-h1 -/src/python/location -/src/python/location-importer -/src/python/__init__.py +/src/scripts/location +/src/scripts/location-importer /src/systemd/location-update.service /src/systemd/location-update.timer /test.db diff --git a/Makefile.am b/Makefile.am index 983cb4a..38ce961 100644 --- a/Makefile.am +++ b/Makefile.am @@ -175,21 +175,13 @@ CLEANFILES += \ src/libloc.pc dist_pkgpython_PYTHON = \ - src/python/database.py \ - src/python/downloader.py \ - src/python/export.py \ - src/python/i18n.py \ - src/python/importer.py \ - src/python/logger.py - -pkgpython_PYTHON = \ - src/python/__init__.py - -EXTRA_DIST += \ - src/python/__init__.py.in - -CLEANFILES += \ - src/python/__init__.py + src/python/location/__init__.py \ + src/python/location/database.py \ + src/python/location/downloader.py \ + src/python/location/export.py \ + src/python/location/i18n.py \ + src/python/location/importer.py \ + src/python/location/logger.py pyexec_LTLIBRARIES = \ src/python/_location.la @@ -275,16 +267,16 @@ uninstall-perl: $(DESTDIR)/$(prefix)/man/man3/Location.3pm bin_SCRIPTS = \ - src/python/location \ - src/python/location-importer + src/scripts/location \ + src/scripts/location-importer EXTRA_DIST += \ - src/python/location.in \ - src/python/location-importer.in + src/scripts/location.in \ + src/scripts/location-importer.in CLEANFILES += \ - src/python/location \ - src/python/location-importer + src/scripts/location \ + src/scripts/location-importer # ------------------------------------------------------------------------------ @@ -321,6 +313,7 @@ TESTS_LDADD = \ src/libloc-internal.la TESTS_ENVIRONMENT = \ + PYTHONPATH=$(abs_srcdir)/src/python:$(abs_builddir)/src/python/.libs \ TEST_DATA_DIR="$(abs_top_srcdir)/tests/data" TESTS = \ @@ -334,7 +327,7 @@ CLEANFILES += \ testdata.db testdata.db: examples/python/create-database.py - PYTHONPATH=$(abs_builddir)/src/python/.libs \ + PYTHONPATH=$(abs_srcdir)/src/python:$(abs_builddir)/src/python/.libs \ ABS_SRCDIR="$(abs_srcdir)" \ $(PYTHON) $< $@ diff --git a/po/POTFILES.in b/po/POTFILES.in index 5d2cc46..5f5afa8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,12 +1,12 @@ src/libloc.pc.in -src/python/__init__.py.in -src/python/database.py -src/python/downloader.py -src/python/export.py -src/python/i18n.py -src/python/importer.py -src/python/location-importer.in -src/python/location.in -src/python/logger.py +src/python/location/__init__.py +src/python/location/database.py +src/python/location/downloader.py +src/python/location/export.py +src/python/location/i18n.py +src/python/location/importer.py +src/python/location/logger.py +src/scripts/location-importer.in +src/scripts/location.in src/systemd/location-update.service.in src/systemd/location-update.timer.in diff --git a/src/python/__init__.py.in b/src/python/location/__init__.py similarity index 98% rename from src/python/__init__.py.in rename to src/python/location/__init__.py index bd94d35..9b570c7 100644 --- a/src/python/__init__.py.in +++ b/src/python/location/__init__.py @@ -17,8 +17,6 @@ # # ############################################################################### -__version__ = "@VERSION@" - # Import everything from the C module from _location import * diff --git a/src/python/database.py b/src/python/location/database.py similarity index 100% rename from src/python/database.py rename to src/python/location/database.py diff --git a/src/python/downloader.py b/src/python/location/downloader.py similarity index 100% rename from src/python/downloader.py rename to src/python/location/downloader.py diff --git a/src/python/export.py b/src/python/location/export.py similarity index 100% rename from src/python/export.py rename to src/python/location/export.py diff --git a/src/python/i18n.py b/src/python/location/i18n.py similarity index 100% rename from src/python/i18n.py rename to src/python/location/i18n.py diff --git a/src/python/importer.py b/src/python/location/importer.py similarity index 100% rename from src/python/importer.py rename to src/python/location/importer.py diff --git a/src/python/logger.py b/src/python/location/logger.py similarity index 100% rename from src/python/logger.py rename to src/python/location/logger.py diff --git a/src/python/location-importer.in b/src/scripts/location-importer.in similarity index 100% rename from src/python/location-importer.in rename to src/scripts/location-importer.in diff --git a/src/python/location.in b/src/scripts/location.in similarity index 100% rename from src/python/location.in rename to src/scripts/location.in -- 2.39.2